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 <utility> | 5 #include <utility> |
6 | 6 |
7 #include "base/base64.h" | 7 #include "base/base64.h" |
8 #include "base/base_switches.h" | 8 #include "base/base_switches.h" |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 2650 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2661 } | 2661 } |
2662 | 2662 |
2663 enum class OffMainThreadFetchMode { kEnabled, kDisabled }; | 2663 enum class OffMainThreadFetchMode { kEnabled, kDisabled }; |
2664 enum class SSLUIWorkerFetchTestType { kUseFetch, kUseImportScripts }; | 2664 enum class SSLUIWorkerFetchTestType { kUseFetch, kUseImportScripts }; |
2665 | 2665 |
2666 class SSLUIWorkerFetchTest | 2666 class SSLUIWorkerFetchTest |
2667 : public testing::WithParamInterface< | 2667 : public testing::WithParamInterface< |
2668 std::pair<OffMainThreadFetchMode, SSLUIWorkerFetchTestType>>, | 2668 std::pair<OffMainThreadFetchMode, SSLUIWorkerFetchTestType>>, |
2669 public SSLUITest { | 2669 public SSLUITest { |
2670 public: | 2670 public: |
2671 ~SSLUIWorkerFetchTest() override {} | 2671 SSLUIWorkerFetchTest() { |
2672 void SetUpCommandLine(base::CommandLine* command_line) override { | |
2673 SSLUITest::SetUpCommandLine(command_line); | |
2674 if (GetParam().first == OffMainThreadFetchMode::kEnabled) { | 2672 if (GetParam().first == OffMainThreadFetchMode::kEnabled) { |
2675 command_line->AppendSwitchASCII(switches::kEnableFeatures, | 2673 scoped_feature_list_.InitAndEnableFeature(features::kOffMainThreadFetch); |
2676 features::kOffMainThreadFetch.name); | |
2677 } else { | 2674 } else { |
2678 command_line->AppendSwitchASCII(switches::kDisableFeatures, | 2675 scoped_feature_list_.InitAndDisableFeature(features::kOffMainThreadFetch); |
2679 features::kOffMainThreadFetch.name); | |
2680 } | 2676 } |
2681 } | 2677 } |
2682 | 2678 |
| 2679 ~SSLUIWorkerFetchTest() override {} |
| 2680 |
2683 protected: | 2681 protected: |
2684 void GetTestWorkerPagePath(const net::EmbeddedTestServer& https_server, | 2682 void GetTestWorkerPagePath(const net::EmbeddedTestServer& https_server, |
2685 std::string* test_worker_page_path) { | 2683 std::string* test_worker_page_path) { |
2686 switch (GetParam().second) { | 2684 switch (GetParam().second) { |
2687 case SSLUIWorkerFetchTestType::kUseFetch: | 2685 case SSLUIWorkerFetchTestType::kUseFetch: |
2688 GetPageWithUnsafeFetchingWorkerPath(https_server, | 2686 GetPageWithUnsafeFetchingWorkerPath(https_server, |
2689 test_worker_page_path); | 2687 test_worker_page_path); |
2690 break; | 2688 break; |
2691 case SSLUIWorkerFetchTestType::kUseImportScripts: | 2689 case SSLUIWorkerFetchTestType::kUseImportScripts: |
2692 GetPageWithUnsafeImportingWorkerPath(https_server, | 2690 GetPageWithUnsafeImportingWorkerPath(https_server, |
2693 test_worker_page_path); | 2691 test_worker_page_path); |
2694 break; | 2692 break; |
2695 } | 2693 } |
2696 } | 2694 } |
| 2695 |
| 2696 private: |
| 2697 base::test::ScopedFeatureList scoped_feature_list_; |
2697 }; | 2698 }; |
2698 | 2699 |
2699 IN_PROC_BROWSER_TEST_P(SSLUIWorkerFetchTest, | 2700 IN_PROC_BROWSER_TEST_P(SSLUIWorkerFetchTest, |
2700 TestUnsafeContentsInWorkerFiltered) { | 2701 TestUnsafeContentsInWorkerFiltered) { |
2701 ASSERT_TRUE(https_server_.Start()); | 2702 ASSERT_TRUE(https_server_.Start()); |
2702 ASSERT_TRUE(https_server_expired_.Start()); | 2703 ASSERT_TRUE(https_server_expired_.Start()); |
2703 | 2704 |
2704 // This page will spawn a Worker which will try to load content from | 2705 // This page will spawn a Worker which will try to load content from |
2705 // BadCertServer. | 2706 // BadCertServer. |
2706 std::string test_worker_page_path; | 2707 std::string test_worker_page_path; |
(...skipping 2442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5149 | 5150 |
5150 // Visit a page over https that contains a frame with a redirect. | 5151 // Visit a page over https that contains a frame with a redirect. |
5151 | 5152 |
5152 // XMLHttpRequest insecure content in synchronous mode. | 5153 // XMLHttpRequest insecure content in synchronous mode. |
5153 | 5154 |
5154 // XMLHttpRequest insecure content in asynchronous mode. | 5155 // XMLHttpRequest insecure content in asynchronous mode. |
5155 | 5156 |
5156 // XMLHttpRequest over bad ssl in synchronous mode. | 5157 // XMLHttpRequest over bad ssl in synchronous mode. |
5157 | 5158 |
5158 // XMLHttpRequest over OK ssl in synchronous mode. | 5159 // XMLHttpRequest over OK ssl in synchronous mode. |
OLD | NEW |