summaryrefslogtreecommitdiffstats
path: root/chrome/browser/extensions/page_action_apitest.cc
diff options
context:
space:
mode:
authorasargent@chromium.org <asargent@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-29 19:58:47 +0000
committerasargent@chromium.org <asargent@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-29 19:58:47 +0000
commitffae8831cb1c0b281914b032617f7bbd7d86bcea (patch)
treedb3e44ae7ab368ec2c6cdcd6bb376cf9bac4d004 /chrome/browser/extensions/page_action_apitest.cc
parent1d99bfac92febc985149d026563e53a0888f76af (diff)
downloadchromium_src-ffae8831cb1c0b281914b032617f7bbd7d86bcea.zip
chromium_src-ffae8831cb1c0b281914b032617f7bbd7d86bcea.tar.gz
chromium_src-ffae8831cb1c0b281914b032617f7bbd7d86bcea.tar.bz2
New event style for pageAction API.
This makes us fire both the old deprecated style of pageActions click handler and the new pageAction style. BUG=25833 TEST=none Review URL: http://codereview.chromium.org/346006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@30499 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/extensions/page_action_apitest.cc')
-rw-r--r--chrome/browser/extensions/page_action_apitest.cc34
1 files changed, 33 insertions, 1 deletions
diff --git a/chrome/browser/extensions/page_action_apitest.cc b/chrome/browser/extensions/page_action_apitest.cc
index f3376d8..a0d6074 100644
--- a/chrome/browser/extensions/page_action_apitest.cc
+++ b/chrome/browser/extensions/page_action_apitest.cc
@@ -42,7 +42,8 @@ IN_PROC_BROWSER_TEST_F(ExtensionApiTest, PageAction) {
{
// Simulate the page action being clicked.
ResultCatcher catcher;
- int tab_id = ExtensionTabUtil::GetTabId(browser()->GetSelectedTabContents());
+ int tab_id =
+ ExtensionTabUtil::GetTabId(browser()->GetSelectedTabContents());
ExtensionBrowserEventRouter::GetInstance()->PageActionExecuted(
browser()->profile(), extension->id(), "", tab_id, "", 0);
EXPECT_TRUE(catcher.GetNextResult());
@@ -60,3 +61,34 @@ IN_PROC_BROWSER_TEST_F(ExtensionApiTest, PageAction) {
tab_id = browser()->GetSelectedTabContents()->controller().session_id().id();
EXPECT_FALSE(action->GetIcon(tab_id).isNull());
}
+
+
+// Tests old-style pageActions API that is deprecated but we don't want to
+// break.
+IN_PROC_BROWSER_TEST_F(ExtensionApiTest, OldPageActions) {
+ ASSERT_TRUE(RunExtensionTest("old_page_actions")) << message_;
+
+ ExtensionsService* service = browser()->profile()->GetExtensionsService();
+ ASSERT_EQ(1u, service->extensions()->size());
+ Extension* extension = service->extensions()->at(0);
+ ASSERT_TRUE(extension);
+
+ // Have the extension enable the page action.
+ {
+ ResultCatcher catcher;
+ ui_test_utils::NavigateToURL(browser(),
+ GURL(extension->GetResourceURL("page.html")));
+ ASSERT_TRUE(catcher.GetNextResult());
+ }
+
+ // Simulate the page action being clicked.
+ {
+ ResultCatcher catcher;
+ int tab_id =
+ ExtensionTabUtil::GetTabId(browser()->GetSelectedTabContents());
+ ExtensionBrowserEventRouter::GetInstance()->PageActionExecuted(
+ browser()->profile(), extension->id(), "action", tab_id, "", 1);
+ EXPECT_TRUE(catcher.GetNextResult());
+ }
+}
+