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 <string> |
| 6 |
5 #include "base/command_line.h" | 7 #include "base/command_line.h" |
6 #include "base/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
7 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
8 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
9 #include "chrome/browser/net/prediction_options.h" | 11 #include "chrome/browser/net/prediction_options.h" |
10 #include "chrome/browser/profiles/profile.h" | 12 #include "chrome/browser/profiles/profile.h" |
11 #include "chrome/browser/ui/browser.h" | 13 #include "chrome/browser/ui/browser.h" |
12 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 14 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
13 #include "chrome/common/chrome_switches.h" | 15 #include "chrome/common/chrome_switches.h" |
14 #include "chrome/common/pref_names.h" | 16 #include "chrome/common/pref_names.h" |
(...skipping 13 matching lines...) Expand all Loading... |
28 | 30 |
29 namespace { | 31 namespace { |
30 | 32 |
31 const char kPrefetchPage[] = "files/prerender/simple_prefetch.html"; | 33 const char kPrefetchPage[] = "files/prerender/simple_prefetch.html"; |
32 | 34 |
33 class MockNetworkChangeNotifierWIFI : public NetworkChangeNotifier { | 35 class MockNetworkChangeNotifierWIFI : public NetworkChangeNotifier { |
34 public: | 36 public: |
35 ConnectionType GetCurrentConnectionType() const override { | 37 ConnectionType GetCurrentConnectionType() const override { |
36 return NetworkChangeNotifier::CONNECTION_WIFI; | 38 return NetworkChangeNotifier::CONNECTION_WIFI; |
37 } | 39 } |
| 40 std::string GetCurrentWiFiSSID() const override { return ""; } |
38 }; | 41 }; |
39 | 42 |
40 class MockNetworkChangeNotifier4G : public NetworkChangeNotifier { | 43 class MockNetworkChangeNotifier4G : public NetworkChangeNotifier { |
41 public: | 44 public: |
42 ConnectionType GetCurrentConnectionType() const override { | 45 ConnectionType GetCurrentConnectionType() const override { |
43 return NetworkChangeNotifier::CONNECTION_4G; | 46 return NetworkChangeNotifier::CONNECTION_4G; |
44 } | 47 } |
| 48 std::string GetCurrentWiFiSSID() const override { return ""; } |
45 }; | 49 }; |
46 | 50 |
47 class PrefetchBrowserTestBase : public InProcessBrowserTest { | 51 class PrefetchBrowserTestBase : public InProcessBrowserTest { |
48 public: | 52 public: |
49 explicit PrefetchBrowserTestBase(bool disabled_via_field_trial) | 53 explicit PrefetchBrowserTestBase(bool disabled_via_field_trial) |
50 : disabled_via_field_trial_(disabled_via_field_trial) {} | 54 : disabled_via_field_trial_(disabled_via_field_trial) {} |
51 | 55 |
52 void SetUpCommandLine(base::CommandLine* command_line) override { | 56 void SetUpCommandLine(base::CommandLine* command_line) override { |
53 if (disabled_via_field_trial_) { | 57 if (disabled_via_field_trial_) { |
54 command_line->AppendSwitchASCII(switches::kForceFieldTrials, | 58 command_line->AppendSwitchASCII(switches::kForceFieldTrials, |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 kHangingUrl, | 214 kHangingUrl, |
211 loop_.QuitClosure())); | 215 loop_.QuitClosure())); |
212 ui_test_utils::NavigateToURL(browser(), GURL("about:blank")); | 216 ui_test_utils::NavigateToURL(browser(), GURL("about:blank")); |
213 content::RenderFrameHost* rfh = | 217 content::RenderFrameHost* rfh = |
214 browser()->tab_strip_model()->GetActiveWebContents()->GetMainFrame(); | 218 browser()->tab_strip_model()->GetActiveWebContents()->GetMainFrame(); |
215 rfh->Send(new PrefetchMsg_Prefetch(rfh->GetRoutingID(), kHangingUrl)); | 219 rfh->Send(new PrefetchMsg_Prefetch(rfh->GetRoutingID(), kHangingUrl)); |
216 loop_.Run(); | 220 loop_.Run(); |
217 } | 221 } |
218 | 222 |
219 } // namespace | 223 } // namespace |
OLD | NEW |