#include "base/values.h"
#include "chrome/browser/extensions/active_script_controller.h"
#include "chrome/browser/extensions/active_tab_permission_granter.h"
+#include "chrome/browser/extensions/api/extension_action/extension_action_api.h"
#include "chrome/browser/extensions/extension_util.h"
#include "chrome/browser/extensions/permissions_updater.h"
#include "chrome/browser/extensions/tab_helper.h"
class ActiveScriptControllerUnitTest : public ChromeRenderViewHostTestHarness {
protected:
ActiveScriptControllerUnitTest();
- virtual ~ActiveScriptControllerUnitTest();
+ ~ActiveScriptControllerUnitTest() override;
// Creates an extension with all hosts permission and adds it to the registry.
const Extension* AddExtension();
// Increment the number of executions for the given |extension_id|.
void IncrementExecutionCount(const std::string& extension_id);
- virtual void SetUp() OVERRIDE;
+ void SetUp() override;
// Since ActiveScriptController's behavior is behind a flag, override the
// feature switch.
ASSERT_EQ(0u, GetExecutionCountForExtension(extension->id()));
ASSERT_FALSE(controller()->WantsToRun(extension));
+ ExtensionActionAPI* extension_action_api =
+ ExtensionActionAPI::Get(profile());
+ ASSERT_FALSE(extension_action_api->ExtensionWantsToRun(extension,
+ web_contents()));
+
// Since the extension requests all_hosts, we should require user consent.
EXPECT_TRUE(RequiresUserConsent(extension));
// executed.
RequestInjection(extension);
EXPECT_TRUE(controller()->WantsToRun(extension));
+ EXPECT_TRUE(extension_action_api->ExtensionWantsToRun(extension,
+ web_contents()));
EXPECT_EQ(0u, GetExecutionCountForExtension(extension->id()));
// Click to accept the extension executing.
// The extension should execute, and the extension shouldn't want to run.
EXPECT_EQ(1u, GetExecutionCountForExtension(extension->id()));
EXPECT_FALSE(controller()->WantsToRun(extension));
+ EXPECT_FALSE(extension_action_api->ExtensionWantsToRun(extension,
+ web_contents()));
// Since we already executed on the given page, we shouldn't need permission
// for a second time.