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

Side by Side Diff: chrome/renderer/extensions/extension_api_client_unittest.cc

Issue 151181: Add a few more unit tests for page actions (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/file_util.h" 5 #include "base/file_util.h"
6 #include "base/path_service.h" 6 #include "base/path_service.h"
7 #include "base/string_util.h" 7 #include "base/string_util.h"
8 #include "chrome/common/chrome_paths.h" 8 #include "chrome/common/chrome_paths.h"
9 #include "chrome/common/render_messages.h" 9 #include "chrome/common/render_messages.h"
10 #include "chrome/renderer/extensions/event_bindings.h" 10 #include "chrome/renderer/extensions/event_bindings.h"
(...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after
473 "[42,{\"parentId\":1,\"index\":0}]"); 473 "[42,{\"parentId\":1,\"index\":0}]");
474 } 474 }
475 475
476 TEST_F(ExtensionAPIClientTest, SetBookmarkTitle) { 476 TEST_F(ExtensionAPIClientTest, SetBookmarkTitle) {
477 ExpectJsPass("chrome.bookmarks.update(42,{title:'x'});", 477 ExpectJsPass("chrome.bookmarks.update(42,{title:'x'});",
478 "SetBookmarkTitle", 478 "SetBookmarkTitle",
479 "[42,{\"title\":\"x\"}]"); 479 "[42,{\"title\":\"x\"}]");
480 } 480 }
481 481
482 TEST_F(ExtensionAPIClientTest, EnablePageAction) { 482 TEST_F(ExtensionAPIClientTest, EnablePageAction) {
483 // Basic old-school enablePageAction call.
483 ExpectJsPass("chrome.pageActions.enableForTab(" 484 ExpectJsPass("chrome.pageActions.enableForTab("
484 "\"dummy\", {tabId: 0, url: \"http://foo/\"});", 485 "\"dummy\", {tabId: 0, url: \"http://foo/\"});",
485 "EnablePageAction", 486 "EnablePageAction",
486 "[\"dummy\",{\"tabId\":0,\"url\":\"http://foo/\"}]"); 487 "[\"dummy\",{\"tabId\":0,\"url\":\"http://foo/\"}]");
488 // Try both optional parameters (title and iconId).
489 ExpectJsPass("chrome.pageActions.enableForTab("
490 "\"dummy\", {tabId: 0, url: \"http://foo/\","
491 "title: \"a\", iconId: 0});",
492 "EnablePageAction",
493 "[\"dummy\",{\"tabId\":0,\"url\":\"http://foo/\","
494 "\"title\":\"a\",\"iconId\":0}]");
487 495
496 // Now try disablePageAction.
488 ExpectJsPass("chrome.pageActions.disableForTab(" 497 ExpectJsPass("chrome.pageActions.disableForTab("
489 "\"dummy\", {tabId: 0, url: \"http://foo/\"});", 498 "\"dummy\", {tabId: 0, url: \"http://foo/\"});",
490 "DisablePageAction", 499 "DisablePageAction",
491 "[\"dummy\",{\"tabId\":0,\"url\":\"http://foo/\"}]"); 500 "[\"dummy\",{\"tabId\":0,\"url\":\"http://foo/\"}]");
492 } 501 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698