| Index: telemetry/telemetry/internal/browser/web_contents.py
|
| diff --git a/telemetry/telemetry/internal/browser/web_contents.py b/telemetry/telemetry/internal/browser/web_contents.py
|
| index 813234b1a08b142586b1ee19924e602fbfc99cc5..96170f54ddc3fe603f636cd0935656340b7dcb9d 100644
|
| --- a/telemetry/telemetry/internal/browser/web_contents.py
|
| +++ b/telemetry/telemetry/internal/browser/web_contents.py
|
| @@ -5,7 +5,8 @@
|
| import os
|
|
|
| from telemetry.core import exceptions
|
| -from telemetry.core import util
|
| +
|
| +import py_utils
|
|
|
| DEFAULT_WEB_CONTENTS_TIMEOUT = 90
|
|
|
| @@ -107,21 +108,21 @@ class WebContents(object):
|
| timeout: The number of seconds to wait for the expression to be True.
|
|
|
| Raises:
|
| - exceptions.TimeoutException: On a timeout.
|
| + py_utils.TimeoutException: On a timeout.
|
| exceptions.Error: See EvaluateJavaScript() for a detailed list of
|
| possible exceptions.
|
| """
|
| def IsJavaScriptExpressionTrue():
|
| try:
|
| return bool(self.EvaluateJavaScript(expr))
|
| - except exceptions.TimeoutException:
|
| + except py_utils.TimeoutException:
|
| # If the main thread is busy for longer than Evaluate's timeout, we
|
| # may time out here early. Instead, we want to wait for the full
|
| # timeout of this method.
|
| return False
|
| try:
|
| - util.WaitFor(IsJavaScriptExpressionTrue, timeout)
|
| - except exceptions.TimeoutException as e:
|
| + py_utils.WaitFor(IsJavaScriptExpressionTrue, timeout)
|
| + except py_utils.TimeoutException as e:
|
| # Try to make timeouts a little more actionable by dumping console output.
|
| debug_message = None
|
| try:
|
| @@ -132,7 +133,7 @@ class WebContents(object):
|
| debug_message = (
|
| 'Exception thrown when trying to capture console output: %s' %
|
| repr(e))
|
| - raise exceptions.TimeoutException(
|
| + raise py_utils.TimeoutException(
|
| e.message + '\n' + debug_message)
|
|
|
| def HasReachedQuiescence(self):
|
| @@ -194,7 +195,7 @@ class WebContents(object):
|
| Raises:
|
| exceptions.EvaluateException
|
| exceptions.WebSocketDisconnected
|
| - exceptions.TimeoutException
|
| + py_utils.TimeoutException
|
| exceptions.DevtoolsTargetCrashException
|
| """
|
| return self._inspector_backend.ExecuteJavaScript(
|
| @@ -208,7 +209,7 @@ class WebContents(object):
|
| Raises:
|
| exceptions.EvaluateException
|
| exceptions.WebSocketDisconnected
|
| - exceptions.TimeoutException
|
| + py_utils.TimeoutException
|
| exceptions.DevtoolsTargetCrashException
|
| """
|
| return self._inspector_backend.EvaluateJavaScript(
|
| @@ -219,7 +220,7 @@ class WebContents(object):
|
|
|
| Raises:
|
| exceptions.WebSocketDisconnected
|
| - exceptions.TimeoutException
|
| + py_utils.TimeoutException
|
| exceptions.DevtoolsTargetCrashException
|
| """
|
| return self._inspector_backend.EnableAllContexts()
|
| @@ -232,7 +233,7 @@ class WebContents(object):
|
| the timeout has been exceeded.
|
|
|
| Raises:
|
| - exceptions.TimeoutException
|
| + py_utils.TimeoutException
|
| exceptions.DevtoolsTargetCrashException
|
| """
|
| self._inspector_backend.WaitForNavigate(timeout)
|
| @@ -246,7 +247,7 @@ class WebContents(object):
|
| the page exists, but before any script on the page itself has executed.
|
|
|
| Raises:
|
| - exceptions.TimeoutException
|
| + py_utils.TimeoutException
|
| exceptions.DevtoolsTargetCrashException
|
| """
|
| self._inspector_backend.Navigate(url, script_to_evaluate_on_commit, timeout)
|
| @@ -296,7 +297,7 @@ class WebContents(object):
|
| interactionMarkerName: The name of the interaction markers to generate.
|
|
|
| Raises:
|
| - exceptions.TimeoutException
|
| + py_utils.TimeoutException
|
| exceptions.DevtoolsTargetCrashException
|
| """
|
| return self._inspector_backend.SynthesizeScrollGesture(
|
| @@ -338,7 +339,7 @@ class WebContents(object):
|
| isSystemKey: Whether the event was a system key event (default: False).
|
|
|
| Raises:
|
| - exceptions.TimeoutException
|
| + py_utils.TimeoutException
|
| exceptions.DevtoolsTargetCrashException
|
| """
|
| return self._inspector_backend.DispatchKeyEvent(
|
|
|