| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "base/base_switches.h" | 5 #include "base/base_switches.h" |
| 6 #include "base/command_line.h" | 6 #include "base/command_line.h" |
| 7 #include "base/prefs/pref_service.h" | 7 #include "base/prefs/pref_service.h" |
| 8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
| 9 #include "chrome/browser/net/prediction_options.h" | 9 #include "chrome/browser/net/prediction_options.h" |
| 10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 : disabled_via_field_trial_(disabled_via_field_trial) {} | 46 : disabled_via_field_trial_(disabled_via_field_trial) {} |
| 47 | 47 |
| 48 void SetUpCommandLine(base::CommandLine* command_line) override { | 48 void SetUpCommandLine(base::CommandLine* command_line) override { |
| 49 if (disabled_via_field_trial_) { | 49 if (disabled_via_field_trial_) { |
| 50 command_line->AppendSwitchASCII(switches::kForceFieldTrials, | 50 command_line->AppendSwitchASCII(switches::kForceFieldTrials, |
| 51 "Prefetch/ExperimentDisabled/"); | 51 "Prefetch/ExperimentDisabled/"); |
| 52 } | 52 } |
| 53 } | 53 } |
| 54 | 54 |
| 55 void SetUpOnMainThread() override { | 55 void SetUpOnMainThread() override { |
| 56 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); | 56 ASSERT_TRUE(embedded_test_server()->Start()); |
| 57 InProcessBrowserTest::SetUpOnMainThread(); | 57 InProcessBrowserTest::SetUpOnMainThread(); |
| 58 } | 58 } |
| 59 | 59 |
| 60 void SetPreference(NetworkPredictionOptions value) { | 60 void SetPreference(NetworkPredictionOptions value) { |
| 61 browser()->profile()->GetPrefs()->SetInteger( | 61 browser()->profile()->GetPrefs()->SetInteger( |
| 62 prefs::kNetworkPredictionOptions, value); | 62 prefs::kNetworkPredictionOptions, value); |
| 63 } | 63 } |
| 64 | 64 |
| 65 bool RunPrefetchExperiment(bool expect_success, Browser* browser) { | 65 bool RunPrefetchExperiment(bool expect_success, Browser* browser) { |
| 66 GURL url = embedded_test_server()->GetURL(kPrefetchPage); | 66 GURL url = embedded_test_server()->GetURL(kPrefetchPage); |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 Browser::CreateParams(incognito_profile, browser()->host_desktop_type())); | 144 Browser::CreateParams(incognito_profile, browser()->host_desktop_type())); |
| 145 | 145 |
| 146 // Navigate just to have a tab in this window, otherwise there is no | 146 // Navigate just to have a tab in this window, otherwise there is no |
| 147 // WebContents for the incognito browser. | 147 // WebContents for the incognito browser. |
| 148 OpenURLOffTheRecord(browser()->profile(), GURL("about:blank")); | 148 OpenURLOffTheRecord(browser()->profile(), GURL("about:blank")); |
| 149 | 149 |
| 150 EXPECT_TRUE(RunPrefetchExperiment(true, incognito_browser)); | 150 EXPECT_TRUE(RunPrefetchExperiment(true, incognito_browser)); |
| 151 } | 151 } |
| 152 | 152 |
| 153 } // namespace | 153 } // namespace |
| OLD | NEW |