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

Unified Diff: chrome/browser/extensions/api/extension_action/page_action_apitest.cc

Issue 496863003: Consolidate ExtensionAction execution code (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 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
Index: chrome/browser/extensions/api/extension_action/page_action_apitest.cc
diff --git a/chrome/browser/extensions/api/extension_action/page_action_apitest.cc b/chrome/browser/extensions/api/extension_action/page_action_apitest.cc
index 2cdd9f631db5cd7295b743da3215207b1364f1d3..62bf48f981b40f63c617ebf3232d9af2cc3cb3a8 100644
--- a/chrome/browser/extensions/api/extension_action/page_action_apitest.cc
+++ b/chrome/browser/extensions/api/extension_action/page_action_apitest.cc
@@ -58,10 +58,8 @@ IN_PROC_BROWSER_TEST_F(PageActionApiTest, Basic) {
{
// Simulate the page action being clicked.
ResultCatcher catcher;
- int tab_id = ExtensionTabUtil::GetTabId(
- browser()->tab_strip_model()->GetActiveWebContents());
- ExtensionActionAPI::PageActionExecuted(
- browser()->profile(), *action, tab_id, std::string(), 0);
+ ExtensionActionAPI::Get(browser()->profile())->ExecuteExtensionAction(
+ extension, browser(), true);
EXPECT_TRUE(catcher.GetNextResult());
}
@@ -103,8 +101,8 @@ IN_PROC_BROWSER_TEST_F(PageActionApiTest, AddPopup) {
// install a page action popup.
{
ResultCatcher catcher;
- ExtensionActionAPI::PageActionExecuted(
- browser()->profile(), *page_action, tab_id, std::string(), 1);
+ ExtensionActionAPI::Get(browser()->profile())->ExecuteExtensionAction(
+ extension, browser(), true);
ASSERT_TRUE(catcher.GetNextResult());
}
@@ -215,23 +213,26 @@ IN_PROC_BROWSER_TEST_F(PageActionApiTest, TestTriggerPageAction) {
chrome::NewTab(browser());
browser()->tab_strip_model()->ActivateTabAt(0, true);
+ // Give the extension time to show the page action on the tab.
+ WaitForPageActionVisibilityChangeTo(1);
+
ExtensionAction* page_action = GetPageAction(*extension);
ASSERT_TRUE(page_action);
+ WebContents* tab =
+ browser()->tab_strip_model()->GetActiveWebContents();
+ ASSERT_TRUE(tab);
+
+ EXPECT_TRUE(page_action->GetIsVisible(ExtensionTabUtil::GetTabId(tab)));
+
{
// Simulate the page action being clicked.
ResultCatcher catcher;
- int tab_id = ExtensionTabUtil::GetTabId(
- browser()->tab_strip_model()->GetActiveWebContents());
- ExtensionActionAPI::PageActionExecuted(
- browser()->profile(), *page_action, tab_id, std::string(), 0);
+ ExtensionActionAPI::Get(browser()->profile())->ExecuteExtensionAction(
+ extension, browser(), true);
EXPECT_TRUE(catcher.GetNextResult());
}
- WebContents* tab =
- browser()->tab_strip_model()->GetActiveWebContents();
- EXPECT_TRUE(tab != NULL);
-
// Verify that the browser action turned the background color red.
const std::string script =
"window.domAutomationController.send(document.body.style."

Powered by Google App Engine
This is Rietveld 408576698