Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1075)

Side by Side Diff: chrome/browser/ssl/ssl_browser_tests.cc

Issue 2910843002: [Cleanup] Move all browsertests to use ScopedFeatureList to modify features
Patch Set: Ilya comments addressed Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 2635 matching lines...) Expand 10 before | Expand all | Expand 10 after
2646 2646
2647 enum class OffMainThreadFetchMode { kEnabled, kDisabled }; 2647 enum class OffMainThreadFetchMode { kEnabled, kDisabled };
2648 enum class SSLUIWorkerFetchTestType { kUseFetch, kUseImportScripts }; 2648 enum class SSLUIWorkerFetchTestType { kUseFetch, kUseImportScripts };
2649 2649
2650 class SSLUIWorkerFetchTest 2650 class SSLUIWorkerFetchTest
2651 : public testing::WithParamInterface< 2651 : public testing::WithParamInterface<
2652 std::pair<OffMainThreadFetchMode, SSLUIWorkerFetchTestType>>, 2652 std::pair<OffMainThreadFetchMode, SSLUIWorkerFetchTestType>>,
2653 public SSLUITest { 2653 public SSLUITest {
2654 public: 2654 public:
2655 ~SSLUIWorkerFetchTest() override {} 2655 ~SSLUIWorkerFetchTest() override {}
2656 void SetUpCommandLine(base::CommandLine* command_line) override { 2656 void SetUp() override {
2657 SSLUITest::SetUpCommandLine(command_line);
2658 if (GetParam().first == OffMainThreadFetchMode::kEnabled) { 2657 if (GetParam().first == OffMainThreadFetchMode::kEnabled) {
2659 command_line->AppendSwitchASCII(switches::kEnableFeatures, 2658 scoped_feature_list_.InitAndEnableFeature(features::kOffMainThreadFetch);
2660 features::kOffMainThreadFetch.name);
2661 } else { 2659 } else {
2662 command_line->AppendSwitchASCII(switches::kDisableFeatures, 2660 scoped_feature_list_.InitAndDisableFeature(features::kOffMainThreadFetch);
2663 features::kOffMainThreadFetch.name);
2664 } 2661 }
2662 SSLUITest::SetUp();
2665 } 2663 }
2666 2664
2667 protected: 2665 protected:
2668 void GetTestWorkerPagePath(const net::EmbeddedTestServer& https_server, 2666 void GetTestWorkerPagePath(const net::EmbeddedTestServer& https_server,
2669 std::string* test_worker_page_path) { 2667 std::string* test_worker_page_path) {
2670 switch (GetParam().second) { 2668 switch (GetParam().second) {
2671 case SSLUIWorkerFetchTestType::kUseFetch: 2669 case SSLUIWorkerFetchTestType::kUseFetch:
2672 GetPageWithUnsafeFetchingWorkerPath(https_server, 2670 GetPageWithUnsafeFetchingWorkerPath(https_server,
2673 test_worker_page_path); 2671 test_worker_page_path);
2674 break; 2672 break;
2675 case SSLUIWorkerFetchTestType::kUseImportScripts: 2673 case SSLUIWorkerFetchTestType::kUseImportScripts:
2676 GetPageWithUnsafeImportingWorkerPath(https_server, 2674 GetPageWithUnsafeImportingWorkerPath(https_server,
2677 test_worker_page_path); 2675 test_worker_page_path);
2678 break; 2676 break;
2679 } 2677 }
2680 } 2678 }
2679
2680 private:
2681 base::test::ScopedFeatureList scoped_feature_list_;
2681 }; 2682 };
2682 2683
2683 IN_PROC_BROWSER_TEST_P(SSLUIWorkerFetchTest, 2684 IN_PROC_BROWSER_TEST_P(SSLUIWorkerFetchTest,
2684 TestUnsafeContentsInWorkerFiltered) { 2685 TestUnsafeContentsInWorkerFiltered) {
2685 ASSERT_TRUE(https_server_.Start()); 2686 ASSERT_TRUE(https_server_.Start());
2686 ASSERT_TRUE(https_server_expired_.Start()); 2687 ASSERT_TRUE(https_server_expired_.Start());
2687 2688
2688 // This page will spawn a Worker which will try to load content from 2689 // This page will spawn a Worker which will try to load content from
2689 // BadCertServer. 2690 // BadCertServer.
2690 std::string test_worker_page_path; 2691 std::string test_worker_page_path;
(...skipping 2342 matching lines...) Expand 10 before | Expand all | Expand 10 after
5033 5034
5034 // Visit a page over https that contains a frame with a redirect. 5035 // Visit a page over https that contains a frame with a redirect.
5035 5036
5036 // XMLHttpRequest insecure content in synchronous mode. 5037 // XMLHttpRequest insecure content in synchronous mode.
5037 5038
5038 // XMLHttpRequest insecure content in asynchronous mode. 5039 // XMLHttpRequest insecure content in asynchronous mode.
5039 5040
5040 // XMLHttpRequest over bad ssl in synchronous mode. 5041 // XMLHttpRequest over bad ssl in synchronous mode.
5041 5042
5042 // XMLHttpRequest over OK ssl in synchronous mode. 5043 // XMLHttpRequest over OK ssl in synchronous mode.
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698