Chromium Code Reviews| Index: chrome/browser/extensions/content_script_apitest.cc |
| diff --git a/chrome/browser/extensions/content_script_apitest.cc b/chrome/browser/extensions/content_script_apitest.cc |
| index 37d131735f5f2eedeb285f4c895864f259e8fab8..b4570fceb77378d1d2115ad83f0d9a19445c6b61 100644 |
| --- a/chrome/browser/extensions/content_script_apitest.cc |
| +++ b/chrome/browser/extensions/content_script_apitest.cc |
| @@ -13,7 +13,9 @@ |
| #include "build/build_config.h" |
| #include "chrome/browser/extensions/api/permissions/permissions_api.h" |
| #include "chrome/browser/extensions/extension_apitest.h" |
| +#include "chrome/browser/extensions/extension_management_test_util.h" |
| #include "chrome/browser/extensions/extension_service.h" |
| +#include "chrome/browser/extensions/extension_with_management_policy_apitest.h" |
| #include "chrome/browser/extensions/test_extension_dir.h" |
| #include "chrome/browser/ui/browser.h" |
| #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| @@ -329,7 +331,7 @@ class ContentScriptCssInjectionTest : public ExtensionApiTest { |
| // can't use the real Webstore's URL. If this changes, we could clean this |
| // up. |
| command_line->AppendSwitchASCII( |
| - switches::kAppsGalleryURL, |
| + ::switches::kAppsGalleryURL, |
| base::StringPrintf("http://%s", kWebstoreDomain)); |
| } |
| }; |
| @@ -476,6 +478,20 @@ IN_PROC_BROWSER_TEST_F(ExtensionApiTest, MAYBE_ContentScriptPermissionsApi) { |
| ASSERT_TRUE(RunExtensionTest("content_scripts/permissions")) << message_; |
| } |
| +IN_PROC_BROWSER_TEST_F(ExtensionApiTestWithManagementPolicy, |
| + ContentScriptPolicy) { |
| + // Set enterprise policy to block injection to policy specified host. |
| + { |
| + ExtensionManagementPolicyUpdater pref(&policy_provider_); |
| + pref.AddRuntimeBlockedHost("*", "*://example.com/*"); |
| + } |
| + PermissionsRequestFunction::SetAutoConfirmForTests(true); |
|
Devlin
2017/04/07 00:40:26
needed?
nrpeter
2017/04/12 23:35:44
Done.
|
| + PermissionsRequestFunction::SetIgnoreUserGestureForTests(true); |
|
Devlin
2017/04/07 00:40:26
needed?
nrpeter
2017/04/12 23:35:44
Done.
|
| + host_resolver()->AddRule("*.com", "127.0.0.1"); |
| + ASSERT_TRUE(StartEmbeddedTestServer()); |
| + ASSERT_TRUE(RunExtensionTest("content_scripts/policy")) << message_; |
| +} |
| + |
| IN_PROC_BROWSER_TEST_F(ExtensionApiTest, ContentScriptBypassPageCSP) { |
| ASSERT_TRUE(StartEmbeddedTestServer()); |
| ASSERT_TRUE(RunExtensionTest("content_scripts/bypass_page_csp")) << message_; |