Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(50)

Side by Side Diff: tools/perf/profile_creators/fast_navigation_profile_extender.py

Issue 952693003: Telemetry: Move TimeoutException from util module to exceptions module. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 # Copyright 2015 The Chromium Authors. All rights reserved. 1 # Copyright 2015 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 import time 4 import time
5 5
6 from telemetry.core import browser_finder 6 from telemetry.core import browser_finder
7 from telemetry.core import browser_finder_exceptions 7 from telemetry.core import browser_finder_exceptions
8 from telemetry.core import exceptions 8 from telemetry.core import exceptions
9 from telemetry.core import platform 9 from telemetry.core import platform
10 from telemetry.core import util
11 from telemetry.core.backends.chrome_inspector import devtools_http 10 from telemetry.core.backends.chrome_inspector import devtools_http
12 11
13 12
14 class FastNavigationProfileExtender(object): 13 class FastNavigationProfileExtender(object):
15 """Extends a Chrome profile. 14 """Extends a Chrome profile.
16 15
17 This class creates or extends an existing profile by performing a set of tab 16 This class creates or extends an existing profile by performing a set of tab
18 navigations in large batches. This is accomplished by opening a large number 17 navigations in large batches. This is accomplished by opening a large number
19 of tabs, simultaneously navigating all the tabs, and then waiting for all the 18 of tabs, simultaneously navigating all the tabs, and then waiting for all the
20 tabs to load. This provides two benefits: 19 tabs to load. This provides two benefits:
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 232
234 # Since we don't wait any time for the tab url navigation to commit, it's 233 # Since we don't wait any time for the tab url navigation to commit, it's
235 # possible that the tab hasn't started navigating yet. 234 # possible that the tab hasn't started navigating yet.
236 self._WaitForUrlToChange(tab, initial_url, seconds_to_wait) 235 self._WaitForUrlToChange(tab, initial_url, seconds_to_wait)
237 236
238 seconds_to_wait = end_time - time.time() 237 seconds_to_wait = end_time - time.time()
239 seconds_to_wait = max(0, seconds_to_wait) 238 seconds_to_wait = max(0, seconds_to_wait)
240 239
241 try: 240 try:
242 tab.WaitForDocumentReadyStateToBeComplete(seconds_to_wait) 241 tab.WaitForDocumentReadyStateToBeComplete(seconds_to_wait)
243 except util.TimeoutException: 242 except exceptions.TimeoutException:
244 # Ignore time outs. 243 # Ignore time outs.
245 pass 244 pass
246 except (exceptions.DevtoolsTargetCrashException, 245 except (exceptions.DevtoolsTargetCrashException,
247 devtools_http.DevToolsClientConnectionError, 246 devtools_http.DevToolsClientConnectionError,
248 devtools_http.DevToolsClientUrlError): 247 devtools_http.DevToolsClientUrlError):
249 # If any error occurs, remove the tab. it's probably in an 248 # If any error occurs, remove the tab. it's probably in an
250 # unrecoverable state. 249 # unrecoverable state.
251 self._RemoveNavigationTab(tab) 250 self._RemoveNavigationTab(tab)
252 251
253 def _GetUrlsToNavigate(self, url_iterator): 252 def _GetUrlsToNavigate(self, url_iterator):
(...skipping 25 matching lines...) Expand all
279 tab = self._navigation_tabs[i] 278 tab = self._navigation_tabs[i]
280 batch.append((tab, url)) 279 batch.append((tab, url))
281 280
282 queued_tabs = self._BatchNavigateTabs(batch) 281 queued_tabs = self._BatchNavigateTabs(batch)
283 self._WaitForQueuedTabsToLoad(queued_tabs) 282 self._WaitForQueuedTabsToLoad(queued_tabs)
284 283
285 self.CleanUpAfterBatchNavigation() 284 self.CleanUpAfterBatchNavigation()
286 285
287 if self.ShouldExitAfterBatchNavigation(): 286 if self.ShouldExitAfterBatchNavigation():
288 break 287 break
OLDNEW
« no previous file with comments | « tools/perf/metrics/startup_metric.py ('k') | tools/telemetry/telemetry/core/backends/chrome/chrome_browser_backend.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698