OLD | NEW |
1 # Copyright 2016 The Chromium Authors. All rights reserved. | 1 # Copyright 2016 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 import collections | 5 import collections |
6 import logging | 6 import logging |
7 import re | 7 import re |
8 import sys | 8 import sys |
9 import urllib | 9 import urllib |
10 | 10 |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 | 129 |
130 Returns: | 130 Returns: |
131 The possible browser if found, or None otherwise. | 131 The possible browser if found, or None otherwise. |
132 """ | 132 """ |
133 possible_browser = browser_finder.FindBrowser(options) | 133 possible_browser = browser_finder.FindBrowser(options) |
134 if possible_browser is None: | 134 if possible_browser is None: |
135 return None | 135 return None |
136 | 136 |
137 if self._platform is None: | 137 if self._platform is None: |
138 self._platform = possible_browser.platform | 138 self._platform = possible_browser.platform |
| 139 # TODO(nedn): Remove the if condition once |
| 140 # https://codereview.chromium.org/2265593003/ is rolled to Chromium tree. |
| 141 if hasattr(self._platform.network_controller, 'InitializeIfNeeded'): |
| 142 self._platform.network_controller.InitializeIfNeeded() |
139 else: | 143 else: |
140 assert self._platform is possible_browser.platform | 144 assert self._platform is possible_browser.platform |
141 self._possible_browsers[browser_type] = (possible_browser, options) | 145 self._possible_browsers[browser_type] = (possible_browser, options) |
142 return possible_browser | 146 return possible_browser |
143 | 147 |
144 def _CreateAllBrowsersIfNeeeded(self): | 148 def _CreateAllBrowsersIfNeeeded(self): |
145 """Launch all browsers needed for the story set, if not already done. | 149 """Launch all browsers needed for the story set, if not already done. |
146 | 150 |
147 This ensures that all browsers are alive during the whole duration of the | 151 This ensures that all browsers are alive during the whole duration of the |
148 benchmark and, therefore, e.g. memory dumps are always provided for all | 152 benchmark and, therefore, e.g. memory dumps are always provided for all |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
258 url=GOOGLE_SEARCH + urllib.urlencode({'q': query}), | 262 url=GOOGLE_SEARCH + urllib.urlencode({'q': query}), |
259 browser_type='android-webview', | 263 browser_type='android-webview', |
260 phase='on_webview')) | 264 phase='on_webview')) |
261 | 265 |
262 # Stories that run on the browser selected by command line options. | 266 # Stories that run on the browser selected by command line options. |
263 self.AddStory(SinglePage( | 267 self.AddStory(SinglePage( |
264 name=re.sub(r'\W+', '_', url), | 268 name=re.sub(r'\W+', '_', url), |
265 url=url, | 269 url=url, |
266 browser_type='default', | 270 browser_type='default', |
267 phase='on_chrome')) | 271 phase='on_chrome')) |
OLD | NEW |