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

Unified Diff: chrome/browser/extensions/location_bar_controller_unittest.cc

Issue 597413003: Introduce an "ExtensionWantsToAct" method (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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/browser/extensions/api/extension_action/extension_action_api.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/location_bar_controller_unittest.cc
diff --git a/chrome/browser/extensions/location_bar_controller_unittest.cc b/chrome/browser/extensions/location_bar_controller_unittest.cc
index 2cbc4da515fb82221f7479930dac508438894fa6..b7da8b0294e497da9580c974c95fd6cc73d66c19 100644
--- a/chrome/browser/extensions/location_bar_controller_unittest.cc
+++ b/chrome/browser/extensions/location_bar_controller_unittest.cc
@@ -8,6 +8,7 @@
#include "base/memory/scoped_ptr.h"
#include "base/message_loop/message_loop.h"
#include "chrome/browser/extensions/active_script_controller.h"
+#include "chrome/browser/extensions/api/extension_action/extension_action_api.h"
#include "chrome/browser/extensions/extension_action.h"
#include "chrome/browser/extensions/extension_action_manager.h"
#include "chrome/browser/extensions/extension_service.h"
@@ -159,6 +160,16 @@ TEST_F(LocationBarControllerUnitTest, NavigationClearsState) {
page_action.SetTitle(tab_id(), "Goodbye");
page_action.SetPopupUrl(tab_id(), extension->GetResourceURL("popup.html"));
+ ExtensionActionAPI* extension_action_api =
+ ExtensionActionAPI::Get(profile());
+ // By default, extensions shouldn't want to act on a page.
+ extension_action_api->ExtensionWantsToRun(extension, web_contents());
Finnur 2014/09/26 09:53:33 EXPECT_FALSE?
Devlin 2014/09/29 22:56:51 Done.
+ // Showing the page action should indicate that an extension *does* want to
+ // run on the page.
+ page_action.SetIsVisible(tab_id(), true);
+ EXPECT_TRUE(extension_action_api->ExtensionWantsToRun(extension,
+ web_contents()));
+
EXPECT_EQ("Goodbye", page_action.GetTitle(tab_id()));
EXPECT_EQ(extension->GetResourceURL("popup.html"),
page_action.GetPopupUrl(tab_id()));
@@ -169,12 +180,16 @@ TEST_F(LocationBarControllerUnitTest, NavigationClearsState) {
EXPECT_EQ("Goodbye", page_action.GetTitle(tab_id()));
EXPECT_EQ(extension->GetResourceURL("popup.html"),
page_action.GetPopupUrl(tab_id()));
+ EXPECT_TRUE(extension_action_api->ExtensionWantsToRun(extension,
+ web_contents()));
// Should discard the settings, and go back to the defaults.
NavigateAndCommit(GURL("http://www.yahoo.com"));
EXPECT_EQ("Hello", page_action.GetTitle(tab_id()));
EXPECT_EQ(GURL(), page_action.GetPopupUrl(tab_id()));
+ EXPECT_FALSE(extension_action_api->ExtensionWantsToRun(extension,
+ web_contents()));
}
} // namespace
« no previous file with comments | « chrome/browser/extensions/api/extension_action/extension_action_api.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698