Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1358)

Unified Diff: chrome/renderer/extensions/extension_api_client_unittest.cc

Issue 160064: Push bookmarks.remove/removeAll polymorphism into c++. fix bookmarks id schema issues (Closed)
Patch Set: presubmit Created 11 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/common/extensions/api/extension_api.json ('k') | chrome/renderer/renderer_resources.grd » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/renderer/extensions/extension_api_client_unittest.cc
diff --git a/chrome/renderer/extensions/extension_api_client_unittest.cc b/chrome/renderer/extensions/extension_api_client_unittest.cc
index 33fdbe15d72e24650c78b801995ca3171cd2fa1e..bd0ce092ba94523083260b780c9b403ca9799092 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/\"}]");
}
« no previous file with comments | « chrome/common/extensions/api/extension_api.json ('k') | chrome/renderer/renderer_resources.grd » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698