diff options
author | rafaelw@chromium.org <rafaelw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-24 02:14:56 +0000 |
---|---|---|
committer | rafaelw@chromium.org <rafaelw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-24 02:14:56 +0000 |
commit | 76a3db852fb58323d63b6857493191e00e97422a (patch) | |
tree | a9af5546c680a37ec89c1aaec0733f1026a24711 /chrome/renderer | |
parent | d267ac762bb0764857fedb92a516a9aa290b0dd2 (diff) | |
download | chromium_src-76a3db852fb58323d63b6857493191e00e97422a.zip chromium_src-76a3db852fb58323d63b6857493191e00e97422a.tar.gz chromium_src-76a3db852fb58323d63b6857493191e00e97422a.tar.bz2 |
Push bookmarks.remove/removeAll polymorphism into c++. fix bookmarks id schema issues (http://code.google.com/p/chromium/issues/detail?id=17562 failed to update schema types from int to string).
R=erikkay
BUG=17417
Review URL: http://codereview.chromium.org/160064
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@21503 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer')
-rw-r--r-- | chrome/renderer/extensions/extension_api_client_unittest.cc | 44 | ||||
-rw-r--r-- | chrome/renderer/renderer_resources.grd | 2 | ||||
-rw-r--r-- | chrome/renderer/resources/extension_process_bindings.js | 26 |
3 files changed, 23 insertions, 49 deletions
diff --git a/chrome/renderer/extensions/extension_api_client_unittest.cc b/chrome/renderer/extensions/extension_api_client_unittest.cc index 33fdbe1..bd0ce09 100644 --- a/chrome/renderer/extensions/extension_api_client_unittest.cc +++ b/chrome/renderer/extensions/extension_api_client_unittest.cc @@ -427,24 +427,24 @@ TEST_F(ExtensionAPIClientTest, RemoveTab) { TEST_F(ExtensionAPIClientTest, CreateBookmark) { ExpectJsFail( - "chrome.bookmarks.create({parentId:'x', title:0}, function(){})", + "chrome.bookmarks.create({parentId:0, title:0}, function(){})", "Uncaught Error: Invalid value for argument 0. " - "Property 'parentId': Expected 'integer' but got 'string', " + "Property 'parentId': Expected 'string' but got 'integer', " "Property 'title': Expected 'string' but got 'integer'."); ExpectJsPass( - "chrome.bookmarks.create({parentId:0, title:'x'}, function(){})", + "chrome.bookmarks.create({parentId:'0', title:'x'}, function(){})", "bookmarks.create", - "{\"parentId\":0,\"title\":\"x\"}"); + "{\"parentId\":\"0\",\"title\":\"x\"}"); } TEST_F(ExtensionAPIClientTest, GetBookmarks) { - ExpectJsPass("chrome.bookmarks.get(0, function(){});", + ExpectJsPass("chrome.bookmarks.get('0', function(){});", "bookmarks.get", - "0"); - ExpectJsPass("chrome.bookmarks.get([0,1,2,3], function(){});", + "\"0\""); + ExpectJsPass("chrome.bookmarks.get(['0','1','2','3'], function(){});", "bookmarks.get", - "[0,1,2,3]"); + "[\"0\",\"1\",\"2\",\"3\"]"); ExpectJsFail("chrome.bookmarks.get(null, function(){});", "Uncaught Error: Parameter 0 is required."); // TODO(erikkay) This is succeeding, when it should fail. @@ -457,9 +457,9 @@ TEST_F(ExtensionAPIClientTest, GetBookmarks) { } TEST_F(ExtensionAPIClientTest, GetBookmarkChildren) { - ExpectJsPass("chrome.bookmarks.getChildren(42, function(){});", + ExpectJsPass("chrome.bookmarks.getChildren('42', function(){});", "bookmarks.getChildren", - "42"); + "\"42\""); } TEST_F(ExtensionAPIClientTest, GetBookmarkTree) { @@ -475,46 +475,46 @@ TEST_F(ExtensionAPIClientTest, SearchBookmarks) { } TEST_F(ExtensionAPIClientTest, RemoveBookmark) { - ExpectJsPass("chrome.bookmarks.remove(42);", + ExpectJsPass("chrome.bookmarks.remove('42');", "bookmarks.remove", - "[42,false]"); + "\"42\""); } TEST_F(ExtensionAPIClientTest, RemoveBookmarkTree) { - ExpectJsPass("chrome.bookmarks.removeTree(42);", + ExpectJsPass("chrome.bookmarks.removeTree('42');", "bookmarks.removeTree", - "[42,true]"); + "\"42\""); } TEST_F(ExtensionAPIClientTest, MoveBookmark) { - ExpectJsPass("chrome.bookmarks.move(42,{parentId:1,index:0});", + ExpectJsPass("chrome.bookmarks.move('42',{parentId:'1',index:0});", "bookmarks.move", - "[42,{\"parentId\":1,\"index\":0}]"); + "[\"42\",{\"parentId\":\"1\",\"index\":0}]"); } TEST_F(ExtensionAPIClientTest, SetBookmarkTitle) { - ExpectJsPass("chrome.bookmarks.update(42,{title:'x'});", + ExpectJsPass("chrome.bookmarks.update('42',{title:'x'});", "bookmarks.update", - "[42,{\"title\":\"x\"}]"); + "[\"42\",{\"title\":\"x\"}]"); } TEST_F(ExtensionAPIClientTest, EnablePageAction) { // Basic old-school enablePageAction call. ExpectJsPass("chrome.pageActions.enableForTab(" - "\"dummy\", {tabId: 0, url: \"http://foo/\"});", + "'dummy', {tabId: 0, url: 'http://foo/'});", "pageActions.enableForTab", "[\"dummy\",{\"tabId\":0,\"url\":\"http://foo/\"}]"); // Try both optional parameters (title and iconId). ExpectJsPass("chrome.pageActions.enableForTab(" - "\"dummy\", {tabId: 0, url: \"http://foo/\"," - "title: \"a\", iconId: 0});", + "'dummy', {tabId: 0, url: 'http://foo/'," + "title: 'a', iconId: 0});", "pageActions.enableForTab", "[\"dummy\",{\"tabId\":0,\"url\":\"http://foo/\"," "\"title\":\"a\",\"iconId\":0}]"); // Now try disablePageAction. ExpectJsPass("chrome.pageActions.disableForTab(" - "\"dummy\", {tabId: 0, url: \"http://foo/\"});", + "'dummy', {tabId: 0, url: 'http://foo/'});", "pageActions.disableForTab", "[\"dummy\",{\"tabId\":0,\"url\":\"http://foo/\"}]"); } diff --git a/chrome/renderer/renderer_resources.grd b/chrome/renderer/renderer_resources.grd index 5ec2309..e5c7fcf 100644 --- a/chrome/renderer/renderer_resources.grd +++ b/chrome/renderer/renderer_resources.grd @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <!-- This comment is only here because changes to resources are not picked up -without changes to the corresponding grd file. rw --> +without changes to the corresponding grd file. rw2 --> <grit latest_public_release="0" current_release="1"> <outputs> <output filename="grit/renderer_resources.h" type="rc_header"> diff --git a/chrome/renderer/resources/extension_process_bindings.js b/chrome/renderer/resources/extension_process_bindings.js index dd01214..fb57923 100644 --- a/chrome/renderer/resources/extension_process_bindings.js +++ b/chrome/renderer/resources/extension_process_bindings.js @@ -171,32 +171,6 @@ var chrome = chrome || {}; } } - // Bookmarks custom parameter handling. - chrome.bookmarks.remove = function(id, callback) { - validate(arguments, arguments.callee.params); - sendRequest("bookmarks.remove", [id, false], callback); - }; - - chrome.bookmarks.remove.params = [ - { - choice : [ - {type: "integer", minimum: 0}, - {type: "array", item: {type: "integer", minimum: 0}, minItems: 1} - ] - }, - {type: "function", optional: true} - ]; - - chrome.bookmarks.removeTree = function(id, callback) { - validate(arguments, arguments.callee.params); - sendRequest("bookmarks.removeTree", [id, true], callback); - }; - - chrome.bookmarks.removeTree.params = [ - {type: "integer", minimum: 0}, - {type: "function", optional: true} - ]; - // Tabs connect() chrome.tabs.connect = function(tabId, opt_name) { validate(arguments, arguments.callee.params); |