diff options
author | cduvall@chromium.org <cduvall@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-03-03 01:34:35 +0000 |
---|---|---|
committer | cduvall@chromium.org <cduvall@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-03-03 01:34:35 +0000 |
commit | 94107d8139121804148564a97fd13e80c6f4473b (patch) | |
tree | e68b5706136156bfdcfff37d7122cd484e08bd02 /chrome | |
parent | 25ee02bb11bbc339b3202d5988181ce80b2547a5 (diff) | |
download | chromium_src-94107d8139121804148564a97fd13e80c6f4473b.zip chromium_src-94107d8139121804148564a97fd13e80c6f4473b.tar.gz chromium_src-94107d8139121804148564a97fd13e80c6f4473b.tar.bz2 |
Default parentId for bookmarks.create()
Made the parentId argument for bookmarks.create() optional.
The default is the "Other Bookmarks" folder.
BUG=21410
TEST=Some of the bookmarks tests have been reported as flaky, so you will need
to change "DISABLED_Bookmarks" to "Bookmarks" in
chrome/browser/bookmarks/bookmark_extension_apitest.cc to run my test.
My test is called createNoParentId.
Review URL: http://codereview.chromium.org/9420041
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@124812 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/common/extensions/api/bookmarks.json | 5 | ||||
-rw-r--r-- | chrome/test/data/extensions/api_test/bookmarks/test.js | 20 |
2 files changed, 23 insertions, 2 deletions
diff --git a/chrome/common/extensions/api/bookmarks.json b/chrome/common/extensions/api/bookmarks.json index 8d115f4..936bf8a 100644 --- a/chrome/common/extensions/api/bookmarks.json +++ b/chrome/common/extensions/api/bookmarks.json @@ -133,7 +133,10 @@ "type": "object", "name": "bookmark", "properties": { - "parentId": {"type": "string"}, + "parentId": { + "type": "string", + "optional": true, + "description": "Defaults to the Other Bookmarks folder."}, "index": {"type": "integer", "minimum": 0, "optional": true}, "title": {"type": "string", "optional": true}, "url": {"type": "string", "optional": true} diff --git a/chrome/test/data/extensions/api_test/bookmarks/test.js b/chrome/test/data/extensions/api_test/bookmarks/test.js index a744091..cc7f6b89 100644 --- a/chrome/test/data/extensions/api_test/bookmarks/test.js +++ b/chrome/test/data/extensions/api_test/bookmarks/test.js @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -168,6 +168,24 @@ chrome.test.runTests([ })); }, + function createNoParentId() { + var node = {title:"google", url:"http://www.google.com/"}; + chrome.test.listenOnce(chrome.bookmarks.onCreated, function(id, created) { + node.id = created.id; + node.index = 0; + chrome.test.assertEq(id, node.id); + // Make sure the parentId defaults to the Other Bookmarks folder. + chrome.test.assertEq(expected[0].children[1].id, created.parentId); + chrome.test.assertTrue(compareNode(node, created)); + }); + chrome.bookmarks.create(node, pass(function(results) { + node.id = results.id; // since we couldn't know this going in + node.index = 0; + chrome.test.assertTrue(compareNode(node, results), + "created node != source"); + })); + }, + function createInRoot() { const error = "Can't modify the root bookmark folders."; var node = {parentId:"0", title:"g404", url:"http://www.google.com/404"}; |