Index: tools/telemetry/telemetry/core/backends/chrome_inspector/inspector_page.py |
diff --git a/tools/telemetry/telemetry/core/backends/chrome_inspector/inspector_page.py b/tools/telemetry/telemetry/core/backends/chrome_inspector/inspector_page.py |
index f56903cc16df1f8d9411cc6e6118f225a41a21e5..aa682fe39af86ff5f569854a444d6fba632b3598 100644 |
--- a/tools/telemetry/telemetry/core/backends/chrome_inspector/inspector_page.py |
+++ b/tools/telemetry/telemetry/core/backends/chrome_inspector/inspector_page.py |
@@ -9,12 +9,6 @@ |
class InspectorPage(object): |
- """Class that controls a page connected by an inspector_websocket. |
- |
- This class provides utility methods for controlling a page connected by an |
- inspector_websocket. It does not perform any exception handling. All |
- inspector_websocket exceptions must be handled by the caller. |
- """ |
def __init__(self, inspector_websocket, timeout=60): |
self._inspector_websocket = inspector_websocket |
self._inspector_websocket.RegisterDomain('Page', self._OnNotification) |
@@ -91,9 +85,15 @@ |
start_time = time.time() |
remaining_time = timeout |
self._navigation_pending = True |
- while self._navigation_pending and remaining_time > 0: |
- remaining_time = max(timeout - (time.time() - start_time), 0.0) |
- self._inspector_websocket.DispatchNotifications(remaining_time) |
+ try: |
+ while self._navigation_pending and remaining_time > 0: |
+ remaining_time = max(timeout - (time.time() - start_time), 0.0) |
+ self._inspector_websocket.DispatchNotifications(remaining_time) |
+ except util.TimeoutException: |
+ # Since we pass remaining_time to DispatchNotifications, we need to |
+ # list the full timeout time in this message. |
+ raise util.TimeoutException('Timed out while waiting %ds for navigation. ' |
+ 'Error=%s' % (timeout, sys.exc_info()[1])) |
def Navigate(self, url, script_to_evaluate_on_commit=None, timeout=60): |
"""Navigates to |url|. |