| 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/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
| 8 #include "chrome/browser/net/prediction_options.h" | 8 #include "chrome/browser/net/prediction_options.h" |
| 9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
| 10 #include "chrome/browser/ui/browser.h" | 10 #include "chrome/browser/ui/browser.h" |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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()->Start()); | 56 ASSERT_TRUE(embedded_test_server()->Start()); |
| 57 InProcessBrowserTest::SetUpOnMainThread(); | |
| 58 } | 57 } |
| 59 | 58 |
| 60 void SetPreference(NetworkPredictionOptions value) { | 59 void SetPreference(NetworkPredictionOptions value) { |
| 61 browser()->profile()->GetPrefs()->SetInteger( | 60 browser()->profile()->GetPrefs()->SetInteger( |
| 62 prefs::kNetworkPredictionOptions, value); | 61 prefs::kNetworkPredictionOptions, value); |
| 63 } | 62 } |
| 64 | 63 |
| 65 bool RunPrefetchExperiment(bool expect_success, Browser* browser) { | 64 bool RunPrefetchExperiment(bool expect_success, Browser* browser) { |
| 66 GURL url = embedded_test_server()->GetURL(kPrefetchPage); | 65 GURL url = embedded_test_server()->GetURL(kPrefetchPage); |
| 67 | 66 |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 new Browser(Browser::CreateParams(incognito_profile, true)); | 137 new Browser(Browser::CreateParams(incognito_profile, true)); |
| 139 | 138 |
| 140 // Navigate just to have a tab in this window, otherwise there is no | 139 // Navigate just to have a tab in this window, otherwise there is no |
| 141 // WebContents for the incognito browser. | 140 // WebContents for the incognito browser. |
| 142 OpenURLOffTheRecord(browser()->profile(), GURL("about:blank")); | 141 OpenURLOffTheRecord(browser()->profile(), GURL("about:blank")); |
| 143 | 142 |
| 144 EXPECT_TRUE(RunPrefetchExperiment(true, incognito_browser)); | 143 EXPECT_TRUE(RunPrefetchExperiment(true, incognito_browser)); |
| 145 } | 144 } |
| 146 | 145 |
| 147 } // namespace | 146 } // namespace |
| OLD | NEW |