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 2645 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2656 | 2656 |
2657 enum class OffMainThreadFetchMode { kEnabled, kDisabled }; | 2657 enum class OffMainThreadFetchMode { kEnabled, kDisabled }; |
2658 enum class SSLUIWorkerFetchTestType { kUseFetch, kUseImportScripts }; | 2658 enum class SSLUIWorkerFetchTestType { kUseFetch, kUseImportScripts }; |
2659 | 2659 |
2660 class SSLUIWorkerFetchTest | 2660 class SSLUIWorkerFetchTest |
2661 : public testing::WithParamInterface< | 2661 : public testing::WithParamInterface< |
2662 std::pair<OffMainThreadFetchMode, SSLUIWorkerFetchTestType>>, | 2662 std::pair<OffMainThreadFetchMode, SSLUIWorkerFetchTestType>>, |
2663 public SSLUITest { | 2663 public SSLUITest { |
2664 public: | 2664 public: |
2665 ~SSLUIWorkerFetchTest() override {} | 2665 ~SSLUIWorkerFetchTest() override {} |
2666 void SetUpCommandLine(base::CommandLine* command_line) override { | 2666 void SetUp() override { |
2667 SSLUITest::SetUpCommandLine(command_line); | |
2668 if (GetParam().first == OffMainThreadFetchMode::kEnabled) { | 2667 if (GetParam().first == OffMainThreadFetchMode::kEnabled) { |
2669 command_line->AppendSwitchASCII(switches::kEnableFeatures, | 2668 scoped_feature_list_.InitAndEnableFeature(features::kOffMainThreadFetch); |
2670 features::kOffMainThreadFetch.name); | |
2671 } else { | 2669 } else { |
2672 command_line->AppendSwitchASCII(switches::kDisableFeatures, | 2670 scoped_feature_list_.InitAndDisableFeature(features::kOffMainThreadFetch); |
2673 features::kOffMainThreadFetch.name); | |
2674 } | 2671 } |
| 2672 SSLUITest::SetUp(); |
2675 } | 2673 } |
2676 | 2674 |
2677 protected: | 2675 protected: |
2678 void GetTestWorkerPagePath(const net::EmbeddedTestServer& https_server, | 2676 void GetTestWorkerPagePath(const net::EmbeddedTestServer& https_server, |
2679 std::string* test_worker_page_path) { | 2677 std::string* test_worker_page_path) { |
2680 switch (GetParam().second) { | 2678 switch (GetParam().second) { |
2681 case SSLUIWorkerFetchTestType::kUseFetch: | 2679 case SSLUIWorkerFetchTestType::kUseFetch: |
2682 GetPageWithUnsafeFetchingWorkerPath(https_server, | 2680 GetPageWithUnsafeFetchingWorkerPath(https_server, |
2683 test_worker_page_path); | 2681 test_worker_page_path); |
2684 break; | 2682 break; |
2685 case SSLUIWorkerFetchTestType::kUseImportScripts: | 2683 case SSLUIWorkerFetchTestType::kUseImportScripts: |
2686 GetPageWithUnsafeImportingWorkerPath(https_server, | 2684 GetPageWithUnsafeImportingWorkerPath(https_server, |
2687 test_worker_page_path); | 2685 test_worker_page_path); |
2688 break; | 2686 break; |
2689 } | 2687 } |
2690 } | 2688 } |
| 2689 |
| 2690 private: |
| 2691 base::test::ScopedFeatureList scoped_feature_list_; |
2691 }; | 2692 }; |
2692 | 2693 |
2693 IN_PROC_BROWSER_TEST_P(SSLUIWorkerFetchTest, | 2694 IN_PROC_BROWSER_TEST_P(SSLUIWorkerFetchTest, |
2694 TestUnsafeContentsInWorkerFiltered) { | 2695 TestUnsafeContentsInWorkerFiltered) { |
2695 ASSERT_TRUE(https_server_.Start()); | 2696 ASSERT_TRUE(https_server_.Start()); |
2696 ASSERT_TRUE(https_server_expired_.Start()); | 2697 ASSERT_TRUE(https_server_expired_.Start()); |
2697 | 2698 |
2698 // This page will spawn a Worker which will try to load content from | 2699 // This page will spawn a Worker which will try to load content from |
2699 // BadCertServer. | 2700 // BadCertServer. |
2700 std::string test_worker_page_path; | 2701 std::string test_worker_page_path; |
(...skipping 2400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5101 | 5102 |
5102 // Visit a page over https that contains a frame with a redirect. | 5103 // Visit a page over https that contains a frame with a redirect. |
5103 | 5104 |
5104 // XMLHttpRequest insecure content in synchronous mode. | 5105 // XMLHttpRequest insecure content in synchronous mode. |
5105 | 5106 |
5106 // XMLHttpRequest insecure content in asynchronous mode. | 5107 // XMLHttpRequest insecure content in asynchronous mode. |
5107 | 5108 |
5108 // XMLHttpRequest over bad ssl in synchronous mode. | 5109 // XMLHttpRequest over bad ssl in synchronous mode. |
5109 | 5110 |
5110 // XMLHttpRequest over OK ssl in synchronous mode. | 5111 // XMLHttpRequest over OK ssl in synchronous mode. |
OLD | NEW |