| 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/command_line.h" | 5 #include "base/command_line.h" |
| 6 #include "base/prefs/pref_service.h" | 6 #include "base/prefs/pref_service.h" |
| 7 #include "base/run_loop.h" | 7 #include "base/run_loop.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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 ConnectionType GetCurrentConnectionType() const override { | 42 ConnectionType GetCurrentConnectionType() const override { |
| 43 return NetworkChangeNotifier::CONNECTION_4G; | 43 return NetworkChangeNotifier::CONNECTION_4G; |
| 44 } | 44 } |
| 45 }; | 45 }; |
| 46 | 46 |
| 47 class PrefetchBrowserTestBase : public InProcessBrowserTest { | 47 class PrefetchBrowserTestBase : public InProcessBrowserTest { |
| 48 public: | 48 public: |
| 49 explicit PrefetchBrowserTestBase(bool disabled_via_field_trial) | 49 explicit PrefetchBrowserTestBase(bool disabled_via_field_trial) |
| 50 : disabled_via_field_trial_(disabled_via_field_trial) {} | 50 : disabled_via_field_trial_(disabled_via_field_trial) {} |
| 51 | 51 |
| 52 void SetUpCommandLine(CommandLine* command_line) override { | 52 void SetUpCommandLine(base::CommandLine* command_line) override { |
| 53 if (disabled_via_field_trial_) { | 53 if (disabled_via_field_trial_) { |
| 54 command_line->AppendSwitchASCII(switches::kForceFieldTrials, | 54 command_line->AppendSwitchASCII(switches::kForceFieldTrials, |
| 55 "Prefetch/ExperimentDisabled/"); | 55 "Prefetch/ExperimentDisabled/"); |
| 56 } | 56 } |
| 57 } | 57 } |
| 58 | 58 |
| 59 void SetPreference(NetworkPredictionOptions value) { | 59 void SetPreference(NetworkPredictionOptions value) { |
| 60 browser()->profile()->GetPrefs()->SetInteger( | 60 browser()->profile()->GetPrefs()->SetInteger( |
| 61 prefs::kNetworkPredictionOptions, value); | 61 prefs::kNetworkPredictionOptions, value); |
| 62 } | 62 } |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 kHangingUrl, | 210 kHangingUrl, |
| 211 loop_.QuitClosure())); | 211 loop_.QuitClosure())); |
| 212 ui_test_utils::NavigateToURL(browser(), GURL("about:blank")); | 212 ui_test_utils::NavigateToURL(browser(), GURL("about:blank")); |
| 213 content::RenderFrameHost* rfh = | 213 content::RenderFrameHost* rfh = |
| 214 browser()->tab_strip_model()->GetActiveWebContents()->GetMainFrame(); | 214 browser()->tab_strip_model()->GetActiveWebContents()->GetMainFrame(); |
| 215 rfh->Send(new PrefetchMsg_Prefetch(rfh->GetRoutingID(), kHangingUrl)); | 215 rfh->Send(new PrefetchMsg_Prefetch(rfh->GetRoutingID(), kHangingUrl)); |
| 216 loop_.Run(); | 216 loop_.Run(); |
| 217 } | 217 } |
| 218 | 218 |
| 219 } // namespace | 219 } // namespace |
| OLD | NEW |