| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include <stddef.h> | 5 #include <stddef.h> |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| (...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 412 ContentScriptPolicy) { | 412 ContentScriptPolicy) { |
| 413 // Set enterprise policy to block injection to policy specified host. | 413 // Set enterprise policy to block injection to policy specified host. |
| 414 { | 414 { |
| 415 ExtensionManagementPolicyUpdater pref(&policy_provider_); | 415 ExtensionManagementPolicyUpdater pref(&policy_provider_); |
| 416 pref.AddRuntimeBlockedHost("*", "*://example.com"); | 416 pref.AddRuntimeBlockedHost("*", "*://example.com"); |
| 417 } | 417 } |
| 418 ASSERT_TRUE(StartEmbeddedTestServer()); | 418 ASSERT_TRUE(StartEmbeddedTestServer()); |
| 419 ASSERT_TRUE(RunExtensionTest("content_scripts/policy")) << message_; | 419 ASSERT_TRUE(RunExtensionTest("content_scripts/policy")) << message_; |
| 420 } | 420 } |
| 421 | 421 |
| 422 // Verifies wildcard can be used for effecitve TLD. |
| 423 IN_PROC_BROWSER_TEST_F(ExtensionApiTestWithManagementPolicy, |
| 424 ContentScriptPolicyWildcard) { |
| 425 // Set enterprise policy to block injection to policy specified hosts. |
| 426 { |
| 427 ExtensionManagementPolicyUpdater pref(&policy_provider_); |
| 428 pref.AddRuntimeBlockedHost("*", "*://example.*"); |
| 429 } |
| 430 ASSERT_TRUE(StartEmbeddedTestServer()); |
| 431 ASSERT_TRUE(RunExtensionTest("content_scripts/policy")) << message_; |
| 432 } |
| 433 |
| 422 IN_PROC_BROWSER_TEST_P(ContentScriptApiTest, ContentScriptBypassPageCSP) { | 434 IN_PROC_BROWSER_TEST_P(ContentScriptApiTest, ContentScriptBypassPageCSP) { |
| 423 ASSERT_TRUE(StartEmbeddedTestServer()); | 435 ASSERT_TRUE(StartEmbeddedTestServer()); |
| 424 ASSERT_TRUE(RunExtensionTest("content_scripts/bypass_page_csp")) << message_; | 436 ASSERT_TRUE(RunExtensionTest("content_scripts/bypass_page_csp")) << message_; |
| 425 } | 437 } |
| 426 | 438 |
| 427 // Test that when injecting a blocking content script, other scripts don't run | 439 // Test that when injecting a blocking content script, other scripts don't run |
| 428 // until the blocking script finishes. | 440 // until the blocking script finishes. |
| 429 IN_PROC_BROWSER_TEST_P(ContentScriptApiTest, ContentScriptBlockingScript) { | 441 IN_PROC_BROWSER_TEST_P(ContentScriptApiTest, ContentScriptBlockingScript) { |
| 430 ASSERT_TRUE(StartEmbeddedTestServer()); | 442 ASSERT_TRUE(StartEmbeddedTestServer()); |
| 431 | 443 |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 610 EXPECT_FALSE(content_script_listener.was_satisfied()); | 622 EXPECT_FALSE(content_script_listener.was_satisfied()); |
| 611 } | 623 } |
| 612 | 624 |
| 613 INSTANTIATE_TEST_CASE_P( | 625 INSTANTIATE_TEST_CASE_P( |
| 614 ContentScriptApiTests, | 626 ContentScriptApiTests, |
| 615 ContentScriptApiTest, | 627 ContentScriptApiTest, |
| 616 testing::Values(TestConfig::kDefault, | 628 testing::Values(TestConfig::kDefault, |
| 617 TestConfig::kYieldBetweenContentScriptRunsEnabled)); | 629 TestConfig::kYieldBetweenContentScriptRunsEnabled)); |
| 618 | 630 |
| 619 } // namespace extensions | 631 } // namespace extensions |
| OLD | NEW |