| Index: chrome/browser/extensions/active_script_controller_unittest.cc
|
| diff --git a/chrome/browser/extensions/active_script_controller_unittest.cc b/chrome/browser/extensions/active_script_controller_unittest.cc
|
| index ef3dda80769ce98a252e20dc12d1638d0ede49bd..7b5a36dc568c78282d603e855df26d0674d5c3a1 100644
|
| --- a/chrome/browser/extensions/active_script_controller_unittest.cc
|
| +++ b/chrome/browser/extensions/active_script_controller_unittest.cc
|
| @@ -276,11 +276,27 @@ TEST_F(ActiveScriptControllerUnitTest, ActiveScriptsUseActiveTabPermissions) {
|
|
|
| // Since we have active tab permissions, we shouldn't need user consent
|
| // anymore.
|
| - EXPECT_FALSE(
|
| - controller()->RequiresUserConsentForScriptInjection(extension));
|
| + EXPECT_FALSE(controller()->RequiresUserConsentForScriptInjection(extension));
|
| +
|
| + // Also test that granting active tab runs any pending tasks.
|
| + NavigateAndCommit(GURL("https://www.google.com"));
|
| + // Navigating should mean we need permission again.
|
| + EXPECT_TRUE(controller()->RequiresUserConsentForScriptInjection(extension));
|
|
|
| - // TODO(rdevlin.cronin): We should also implement/test that granting active
|
| - // tab permissions automatically runs any pending injections.
|
| + controller()->RequestScriptInjection(
|
| + extension,
|
| + GetPageId(),
|
| + GetExecutionCallbackForExtension(extension->id()));
|
| + EXPECT_TRUE(controller()->GetActionForExtension(extension));
|
| + EXPECT_EQ(0u, GetExecutionCountForExtension(extension->id()));
|
| +
|
| + // Grant active tab.
|
| + active_tab_permission_granter->GrantIfRequested(extension);
|
| +
|
| + // The pending injections should have run since active tab permission was
|
| + // granted.
|
| + EXPECT_EQ(1u, GetExecutionCountForExtension(extension->id()));
|
| + EXPECT_FALSE(controller()->GetActionForExtension(extension));
|
| }
|
|
|
| } // namespace extensions
|
|
|