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

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

Issue 2929713002: [Cleanup] Transition NetworkTime browser tests to use a ScopedFeatureList. (Closed)
Patch Set: Update SSLNetworkTimeBrowserTest as well Created 3 years, 6 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
« no previous file with comments | « chrome/browser/policy/policy_browsertest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 3260 matching lines...) Expand 10 before | Expand all | Expand 10 after
3271 // request, and it allows the user to configure the experimental 3271 // request, and it allows the user to configure the experimental
3272 // parameters of the NetworkTimeTracker. Expects only one network time 3272 // parameters of the NetworkTimeTracker. Expects only one network time
3273 // request to be issued during the test. 3273 // request to be issued during the test.
3274 class SSLNetworkTimeBrowserTest : public SSLUITest { 3274 class SSLNetworkTimeBrowserTest : public SSLUITest {
3275 public: 3275 public:
3276 SSLNetworkTimeBrowserTest() : SSLUITest(), interceptor_(nullptr) {} 3276 SSLNetworkTimeBrowserTest() : SSLUITest(), interceptor_(nullptr) {}
3277 ~SSLNetworkTimeBrowserTest() override {} 3277 ~SSLNetworkTimeBrowserTest() override {}
3278 3278
3279 void SetUpCommandLine(base::CommandLine* command_line) override { 3279 void SetUpCommandLine(base::CommandLine* command_line) override {
3280 command_line->AppendSwitchASCII( 3280 command_line->AppendSwitchASCII(
3281 switches::kEnableFeatures,
3282 std::string(network_time::kNetworkTimeServiceQuerying.name) +
3283 "<SSLNetworkTimeBrowserTestFieldTrial");
3284 command_line->AppendSwitchASCII(
3285 switches::kForceFieldTrials, 3281 switches::kForceFieldTrials,
3286 "SSLNetworkTimeBrowserTestFieldTrial/Enabled/"); 3282 "SSLNetworkTimeBrowserTestFieldTrial/Enabled/");
3287 command_line->AppendSwitchASCII( 3283 command_line->AppendSwitchASCII(
3288 variations::switches::kForceFieldTrialParams, 3284 variations::switches::kForceFieldTrialParams,
3289 "SSLNetworkTimeBrowserTestFieldTrial.Enabled:FetchBehavior/" 3285 "SSLNetworkTimeBrowserTestFieldTrial.Enabled:FetchBehavior/"
3290 "on-demand-only"); 3286 "on-demand-only");
3291 } 3287 }
3292 3288
3293 void SetUpOnMainThread() override { 3289 void SetUpOnMainThread() override {
3294 SSLUITest::SetUpOnMainThread(); 3290 SSLUITest::SetUpOnMainThread();
3291 scoped_feature_list_.InitFromCommandLine(
3292 std::string(network_time::kNetworkTimeServiceQuerying.name) +
3293 "<SSLNetworkTimeBrowserTestFieldTrial",
3294 std::string());
3295 SetUpNetworkTimeServer(); 3295 SetUpNetworkTimeServer();
3296 } 3296 }
3297 3297
3298 void TearDownOnMainThread() override { 3298 void TearDownOnMainThread() override {
3299 content::BrowserThread::PostTask(content::BrowserThread::IO, FROM_HERE, 3299 content::BrowserThread::PostTask(content::BrowserThread::IO, FROM_HERE,
3300 base::Bind(&CleanUpOnIOThread)); 3300 base::Bind(&CleanUpOnIOThread));
3301 } 3301 }
3302 3302
3303 protected: 3303 protected:
3304 void SetUpNetworkTimeServer() { 3304 void SetUpNetworkTimeServer() {
(...skipping 18 matching lines...) Expand all
3323 void CheckTimeQueryPending() { 3323 void CheckTimeQueryPending() {
3324 base::Time unused_time; 3324 base::Time unused_time;
3325 base::TimeDelta unused_uncertainty; 3325 base::TimeDelta unused_uncertainty;
3326 ASSERT_EQ(network_time::NetworkTimeTracker::NETWORK_TIME_FIRST_SYNC_PENDING, 3326 ASSERT_EQ(network_time::NetworkTimeTracker::NETWORK_TIME_FIRST_SYNC_PENDING,
3327 g_browser_process->network_time_tracker()->GetNetworkTime( 3327 g_browser_process->network_time_tracker()->GetNetworkTime(
3328 &unused_time, &unused_uncertainty)); 3328 &unused_time, &unused_uncertainty));
3329 } 3329 }
3330 3330
3331 private: 3331 private:
3332 DelayedNetworkTimeInterceptor* interceptor_; 3332 DelayedNetworkTimeInterceptor* interceptor_;
3333 base::test::ScopedFeatureList scoped_feature_list_;
3333 3334
3334 DISALLOW_COPY_AND_ASSIGN(SSLNetworkTimeBrowserTest); 3335 DISALLOW_COPY_AND_ASSIGN(SSLNetworkTimeBrowserTest);
3335 }; 3336 };
3336 3337
3337 // Tests that if an on-demand network time fetch returns that the clock 3338 // Tests that if an on-demand network time fetch returns that the clock
3338 // is okay, a normal SSL interstitial is shown. 3339 // is okay, a normal SSL interstitial is shown.
3339 IN_PROC_BROWSER_TEST_F(SSLNetworkTimeBrowserTest, OnDemandFetchClockOk) { 3340 IN_PROC_BROWSER_TEST_F(SSLNetworkTimeBrowserTest, OnDemandFetchClockOk) {
3340 ASSERT_TRUE(https_server_expired_.Start()); 3341 ASSERT_TRUE(https_server_expired_.Start());
3341 // Use a testing clock set to the time that GoodTimeResponseHandler 3342 // Use a testing clock set to the time that GoodTimeResponseHandler
3342 // returns, to simulate the system clock matching the network time. 3343 // returns, to simulate the system clock matching the network time.
(...skipping 1411 matching lines...) Expand 10 before | Expand all | Expand 10 after
4754 4755
4755 // Visit a page over https that contains a frame with a redirect. 4756 // Visit a page over https that contains a frame with a redirect.
4756 4757
4757 // XMLHttpRequest insecure content in synchronous mode. 4758 // XMLHttpRequest insecure content in synchronous mode.
4758 4759
4759 // XMLHttpRequest insecure content in asynchronous mode. 4760 // XMLHttpRequest insecure content in asynchronous mode.
4760 4761
4761 // XMLHttpRequest over bad ssl in synchronous mode. 4762 // XMLHttpRequest over bad ssl in synchronous mode.
4762 4763
4763 // XMLHttpRequest over OK ssl in synchronous mode. 4764 // XMLHttpRequest over OK ssl in synchronous mode.
OLDNEW
« no previous file with comments | « chrome/browser/policy/policy_browsertest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698