Telemetry: Move TimeoutException from util module to exceptions module.
This change helps move the Telemetry framework towards saner exception handling. BUG=460625 Review URL: https://codereview.chromium.org/952693003 Cr-Commit-Position: refs/heads/master@{#318349}
This commit is contained in:
content/test/gpu/gpu_tests
tools
perf
measurements
metrics
profile_creators
telemetry
telemetry
core
backends
exceptions.pyforwarders
util.pyutil_unittest.pyweb_contents.pywebpagereplay.pypage
unittest_util
user_story
util
@@ -72,7 +72,7 @@ class _ContextLostValidator(page_test.PageTest):
|
|||||||
util.WaitFor(lambda: tab.EvaluateJavaScript(
|
util.WaitFor(lambda: tab.EvaluateJavaScript(
|
||||||
'window.domAutomationController._finished'), wait_timeout)
|
'window.domAutomationController._finished'), wait_timeout)
|
||||||
return True
|
return True
|
||||||
except util.TimeoutException:
|
except exceptions.TimeoutException:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
if page.kill_gpu_process:
|
if page.kill_gpu_process:
|
||||||
|
@@ -5,7 +5,7 @@
|
|||||||
import sys
|
import sys
|
||||||
import time
|
import time
|
||||||
|
|
||||||
from telemetry.core.util import TimeoutException
|
from telemetry.core import exceptions
|
||||||
from telemetry.page import page_test
|
from telemetry.page import page_test
|
||||||
from telemetry.value import scalar
|
from telemetry.value import scalar
|
||||||
|
|
||||||
@@ -31,7 +31,7 @@ class RasterizeAndRecordMicro(page_test.PageTest):
|
|||||||
def ValidateAndMeasurePage(self, page, tab, results):
|
def ValidateAndMeasurePage(self, page, tab, results):
|
||||||
try:
|
try:
|
||||||
tab.WaitForDocumentReadyStateToBeComplete()
|
tab.WaitForDocumentReadyStateToBeComplete()
|
||||||
except TimeoutException:
|
except exceptions.TimeoutException:
|
||||||
pass
|
pass
|
||||||
time.sleep(self._start_wait_time)
|
time.sleep(self._start_wait_time)
|
||||||
|
|
||||||
|
@@ -7,7 +7,7 @@ import logging
|
|||||||
|
|
||||||
from metrics import Metric
|
from metrics import Metric
|
||||||
|
|
||||||
from telemetry.core import util
|
from telemetry.core import exceptions
|
||||||
from telemetry.value import histogram_util
|
from telemetry.value import histogram_util
|
||||||
from telemetry.value import scalar
|
from telemetry.value import scalar
|
||||||
|
|
||||||
@@ -74,7 +74,7 @@ class StartupMetric(Metric):
|
|||||||
int(result['load_start_ms']),
|
int(result['load_start_ms']),
|
||||||
int(result['load_duration_ms']),
|
int(result['load_duration_ms']),
|
||||||
int(perf_timing['requestStart'])))
|
int(perf_timing['requestStart'])))
|
||||||
except util.TimeoutException:
|
except exceptions.TimeoutException:
|
||||||
# Low memory Android devices may not be able to load more than
|
# Low memory Android devices may not be able to load more than
|
||||||
# one tab at a time, so may timeout when the test attempts to
|
# one tab at a time, so may timeout when the test attempts to
|
||||||
# access a background tab. Ignore these tabs.
|
# access a background tab. Ignore these tabs.
|
||||||
|
@@ -7,7 +7,6 @@ from telemetry.core import browser_finder
|
|||||||
from telemetry.core import browser_finder_exceptions
|
from telemetry.core import browser_finder_exceptions
|
||||||
from telemetry.core import exceptions
|
from telemetry.core import exceptions
|
||||||
from telemetry.core import platform
|
from telemetry.core import platform
|
||||||
from telemetry.core import util
|
|
||||||
from telemetry.core.backends.chrome_inspector import devtools_http
|
from telemetry.core.backends.chrome_inspector import devtools_http
|
||||||
|
|
||||||
|
|
||||||
@@ -240,7 +239,7 @@ class FastNavigationProfileExtender(object):
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
tab.WaitForDocumentReadyStateToBeComplete(seconds_to_wait)
|
tab.WaitForDocumentReadyStateToBeComplete(seconds_to_wait)
|
||||||
except util.TimeoutException:
|
except exceptions.TimeoutException:
|
||||||
# Ignore time outs.
|
# Ignore time outs.
|
||||||
pass
|
pass
|
||||||
except (exceptions.DevtoolsTargetCrashException,
|
except (exceptions.DevtoolsTargetCrashException,
|
||||||
|
@@ -189,7 +189,7 @@ class ChromeBrowserBackend(browser_backend.BrowserBackend):
|
|||||||
""" Wait for browser to come up. """
|
""" Wait for browser to come up. """
|
||||||
try:
|
try:
|
||||||
util.WaitFor(self.HasBrowserFinishedLaunching, timeout=30)
|
util.WaitFor(self.HasBrowserFinishedLaunching, timeout=30)
|
||||||
except (util.TimeoutException, exceptions.ProcessGoneException) as e:
|
except (exceptions.TimeoutException, exceptions.ProcessGoneException) as e:
|
||||||
if not self.IsBrowserRunning():
|
if not self.IsBrowserRunning():
|
||||||
raise exceptions.BrowserGoneException(self.browser, e)
|
raise exceptions.BrowserGoneException(self.browser, e)
|
||||||
raise exceptions.BrowserConnectionGoneException(self.browser, e)
|
raise exceptions.BrowserConnectionGoneException(self.browser, e)
|
||||||
@@ -204,7 +204,7 @@ class ChromeBrowserBackend(browser_backend.BrowserBackend):
|
|||||||
'Waiting for extensions required devtool client to be initiated first')
|
'Waiting for extensions required devtool client to be initiated first')
|
||||||
try:
|
try:
|
||||||
util.WaitFor(self._AllExtensionsLoaded, timeout=60)
|
util.WaitFor(self._AllExtensionsLoaded, timeout=60)
|
||||||
except util.TimeoutException:
|
except exceptions.TimeoutException:
|
||||||
logging.error('ExtensionsToLoad: ' +
|
logging.error('ExtensionsToLoad: ' +
|
||||||
repr([e.extension_id for e in self._extensions_to_load]))
|
repr([e.extension_id for e in self._extensions_to_load]))
|
||||||
logging.error('Extension list: ' +
|
logging.error('Extension list: ' +
|
||||||
|
@@ -143,7 +143,7 @@ class CrOSBrowserBackend(chrome_browser_backend.ChromeBrowserBackend):
|
|||||||
else:
|
else:
|
||||||
self.oobe.NavigateFakeLogin(self._username, self._password)
|
self.oobe.NavigateFakeLogin(self._username, self._password)
|
||||||
self._WaitForLogin()
|
self._WaitForLogin()
|
||||||
except util.TimeoutException:
|
except exceptions.TimeoutException:
|
||||||
self._cri.TakeScreenShot('login-screen')
|
self._cri.TakeScreenShot('login-screen')
|
||||||
raise exceptions.LoginException('Timed out going through login screen')
|
raise exceptions.LoginException('Timed out going through login screen')
|
||||||
|
|
||||||
|
@@ -369,7 +369,7 @@ class DesktopBrowserBackend(chrome_browser_backend.ChromeBrowserBackend):
|
|||||||
try:
|
try:
|
||||||
util.WaitFor(lambda: not self.IsBrowserRunning(), timeout=5)
|
util.WaitFor(lambda: not self.IsBrowserRunning(), timeout=5)
|
||||||
logging.info('Successfully shut down browser cooperatively')
|
logging.info('Successfully shut down browser cooperatively')
|
||||||
except util.TimeoutException as e:
|
except exceptions.TimeoutException as e:
|
||||||
logging.warning('Failed to cooperatively shutdown. ' +
|
logging.warning('Failed to cooperatively shutdown. ' +
|
||||||
'Proceeding to terminate: ' + str(e))
|
'Proceeding to terminate: ' + str(e))
|
||||||
|
|
||||||
@@ -385,7 +385,7 @@ class DesktopBrowserBackend(chrome_browser_backend.ChromeBrowserBackend):
|
|||||||
try:
|
try:
|
||||||
util.WaitFor(lambda: not self.IsBrowserRunning(), timeout=5)
|
util.WaitFor(lambda: not self.IsBrowserRunning(), timeout=5)
|
||||||
self._proc = None
|
self._proc = None
|
||||||
except util.TimeoutException:
|
except exceptions.TimeoutException:
|
||||||
logging.warning('Failed to gracefully shutdown. Proceeding to kill.')
|
logging.warning('Failed to gracefully shutdown. Proceeding to kill.')
|
||||||
|
|
||||||
# Shutdown aggressively if the above failed or if the profile is temporary.
|
# Shutdown aggressively if the above failed or if the profile is temporary.
|
||||||
|
@@ -8,6 +8,7 @@ import logging
|
|||||||
import re
|
import re
|
||||||
import urllib2
|
import urllib2
|
||||||
|
|
||||||
|
from telemetry.core import exceptions
|
||||||
from telemetry.core import util
|
from telemetry.core import util
|
||||||
from telemetry.core.backends.chrome import chrome_browser_backend
|
from telemetry.core.backends.chrome import chrome_browser_backend
|
||||||
from telemetry.core.backends.chrome import system_info_backend
|
from telemetry.core.backends.chrome import system_info_backend
|
||||||
@@ -90,7 +91,7 @@ class IosBrowserBackend(chrome_browser_backend.ChromeBrowserBackend):
|
|||||||
# Retry a few times since it can take a few seconds for this API to be
|
# Retry a few times since it can take a few seconds for this API to be
|
||||||
# ready, if ios_webkit_debug_proxy is just launched.
|
# ready, if ios_webkit_debug_proxy is just launched.
|
||||||
data = util.WaitFor(GetData, 5)
|
data = util.WaitFor(GetData, 5)
|
||||||
except util.TimeoutException as e:
|
except exceptions.TimeoutException as e:
|
||||||
logging.debug('Timeout retrieving data from iOS device')
|
logging.debug('Timeout retrieving data from iOS device')
|
||||||
logging.debug(e)
|
logging.debug(e)
|
||||||
return []
|
return []
|
||||||
|
@@ -44,7 +44,7 @@ class InspectorBackend(object):
|
|||||||
logging.debug('InspectorBackend._Connect() to %s', self.debugger_url)
|
logging.debug('InspectorBackend._Connect() to %s', self.debugger_url)
|
||||||
try:
|
try:
|
||||||
self._websocket.Connect(self.debugger_url)
|
self._websocket.Connect(self.debugger_url)
|
||||||
except (websocket.WebSocketException, util.TimeoutException) as e:
|
except (websocket.WebSocketException, exceptions.TimeoutException) as e:
|
||||||
raise InspectorException(e.msg)
|
raise InspectorException(e.msg)
|
||||||
|
|
||||||
self._console = inspector_console.InspectorConsole(self._websocket)
|
self._console = inspector_console.InspectorConsole(self._websocket)
|
||||||
|
@@ -3,7 +3,7 @@
|
|||||||
# found in the LICENSE file.
|
# found in the LICENSE file.
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from telemetry.core import util
|
from telemetry.core import exceptions
|
||||||
|
|
||||||
|
|
||||||
class InspectorNetworkException(Exception):
|
class InspectorNetworkException(Exception):
|
||||||
@@ -188,7 +188,7 @@ class InspectorNetwork(object):
|
|||||||
'requestId': request_id,
|
'requestId': request_id,
|
||||||
}
|
}
|
||||||
}, timeout)
|
}, timeout)
|
||||||
except util.TimeoutException:
|
except exceptions.TimeoutException:
|
||||||
logging.warning('Timeout during fetching body for %s' % request_id)
|
logging.warning('Timeout during fetching body for %s' % request_id)
|
||||||
return None, False
|
return None, False
|
||||||
if 'error' in res:
|
if 'error' in res:
|
||||||
|
@@ -4,7 +4,6 @@
|
|||||||
import sys
|
import sys
|
||||||
import time
|
import time
|
||||||
|
|
||||||
from telemetry.core import util
|
|
||||||
from telemetry.image_processing import image_util
|
from telemetry.image_processing import image_util
|
||||||
|
|
||||||
|
|
||||||
|
@@ -3,7 +3,7 @@
|
|||||||
# found in the LICENSE file.
|
# found in the LICENSE file.
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from telemetry.core import util
|
from telemetry.core import exceptions
|
||||||
|
|
||||||
|
|
||||||
class FormBasedCredentialsBackend(object):
|
class FormBasedCredentialsBackend(object):
|
||||||
@@ -111,7 +111,7 @@ class FormBasedCredentialsBackend(object):
|
|||||||
|
|
||||||
self._logged_in = True
|
self._logged_in = True
|
||||||
return True
|
return True
|
||||||
except util.TimeoutException:
|
except exceptions.TimeoutException:
|
||||||
logging.warning('Timed out while loading: %s', url)
|
logging.warning('Timed out while loading: %s', url)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
@@ -7,6 +7,10 @@ class PlatformError(Exception):
|
|||||||
""" Represents an exception thrown when constructing platform. """
|
""" Represents an exception thrown when constructing platform. """
|
||||||
|
|
||||||
|
|
||||||
|
class TimeoutException(Exception):
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
class AppCrashException(Exception):
|
class AppCrashException(Exception):
|
||||||
def __init__(self, app=None, msg=''):
|
def __init__(self, app=None, msg=''):
|
||||||
super(AppCrashException, self).__init__(msg)
|
super(AppCrashException, self).__init__(msg)
|
||||||
|
@@ -6,6 +6,7 @@ import contextlib
|
|||||||
import logging
|
import logging
|
||||||
import socket
|
import socket
|
||||||
|
|
||||||
|
from telemetry.core import exceptions
|
||||||
from telemetry.core import forwarders
|
from telemetry.core import forwarders
|
||||||
from telemetry.core import util
|
from telemetry.core import util
|
||||||
|
|
||||||
@@ -63,7 +64,7 @@ class DoNothingForwarder(forwarders.Forwarder):
|
|||||||
logging.debug(
|
logging.debug(
|
||||||
'Connection test succeeded for %s: %s:%d',
|
'Connection test succeeded for %s: %s:%d',
|
||||||
protocol.upper(), self.host_ip, local_port)
|
protocol.upper(), self.host_ip, local_port)
|
||||||
except util.TimeoutException:
|
except exceptions.TimeoutException:
|
||||||
raise ConnectionError(
|
raise ConnectionError(
|
||||||
'Unable to connect to %s address: %s:%d',
|
'Unable to connect to %s address: %s:%d',
|
||||||
protocol.upper(), self.host_ip, local_port)
|
protocol.upper(), self.host_ip, local_port)
|
||||||
|
@@ -4,8 +4,8 @@
|
|||||||
|
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
|
from telemetry.core import exceptions
|
||||||
from telemetry.core import forwarders
|
from telemetry.core import forwarders
|
||||||
from telemetry.core import util
|
|
||||||
from telemetry.core.forwarders import do_nothing_forwarder
|
from telemetry.core.forwarders import do_nothing_forwarder
|
||||||
|
|
||||||
|
|
||||||
@@ -24,7 +24,7 @@ class TestErrorDoNothingForwarder(do_nothing_forwarder.DoNothingForwarder):
|
|||||||
"""Simulate a connection error."""
|
"""Simulate a connection error."""
|
||||||
|
|
||||||
def _WaitForConnectionEstablished(self, address, timeout):
|
def _WaitForConnectionEstablished(self, address, timeout):
|
||||||
raise util.TimeoutException
|
raise exceptions.TimeoutException
|
||||||
|
|
||||||
|
|
||||||
class CheckPortPairsTest(unittest.TestCase):
|
class CheckPortPairsTest(unittest.TestCase):
|
||||||
|
@@ -10,9 +10,7 @@ import socket
|
|||||||
import sys
|
import sys
|
||||||
import time
|
import time
|
||||||
|
|
||||||
|
from telemetry.core import exceptions
|
||||||
class TimeoutException(Exception):
|
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
def GetBaseDir():
|
def GetBaseDir():
|
||||||
@@ -80,8 +78,8 @@ def WaitFor(condition, timeout):
|
|||||||
elapsed_time = now - start_time
|
elapsed_time = now - start_time
|
||||||
last_output_elapsed_time = now - last_output_time
|
last_output_elapsed_time = now - last_output_time
|
||||||
if elapsed_time > timeout:
|
if elapsed_time > timeout:
|
||||||
raise TimeoutException('Timed out while waiting %ds for %s.' %
|
raise exceptions.TimeoutException('Timed out while waiting %ds for %s.' %
|
||||||
(timeout, GetConditionString()))
|
(timeout, GetConditionString()))
|
||||||
if last_output_elapsed_time > output_interval:
|
if last_output_elapsed_time > output_interval:
|
||||||
logging.info('Continuing to wait %ds for %s. Elapsed: %ds.',
|
logging.info('Continuing to wait %ds for %s. Elapsed: %ds.',
|
||||||
timeout, GetConditionString(), elapsed_time)
|
timeout, GetConditionString(), elapsed_time)
|
||||||
|
@@ -6,6 +6,7 @@ import shutil
|
|||||||
import tempfile
|
import tempfile
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
|
from telemetry.core import exceptions
|
||||||
from telemetry.core import util
|
from telemetry.core import util
|
||||||
|
|
||||||
|
|
||||||
@@ -18,7 +19,8 @@ class TestWait(unittest.TestCase):
|
|||||||
def testTimeout(self):
|
def testTimeout(self):
|
||||||
def test():
|
def test():
|
||||||
return False
|
return False
|
||||||
self.assertRaises(util.TimeoutException, lambda: util.WaitFor(test, 0.1))
|
self.assertRaises(exceptions.TimeoutException,
|
||||||
|
lambda: util.WaitFor(test, 0.1))
|
||||||
|
|
||||||
def testCallable(self):
|
def testCallable(self):
|
||||||
"""Test methods and anonymous functions, functions are tested elsewhere."""
|
"""Test methods and anonymous functions, functions are tested elsewhere."""
|
||||||
|
@@ -4,6 +4,7 @@
|
|||||||
|
|
||||||
import os
|
import os
|
||||||
|
|
||||||
|
from telemetry.core import exceptions
|
||||||
from telemetry.core import util
|
from telemetry.core import util
|
||||||
|
|
||||||
DEFAULT_WEB_CONTENTS_TIMEOUT = 90
|
DEFAULT_WEB_CONTENTS_TIMEOUT = 90
|
||||||
@@ -43,16 +44,16 @@ class WebContents(object):
|
|||||||
def IsJavaScriptExpressionTrue():
|
def IsJavaScriptExpressionTrue():
|
||||||
try:
|
try:
|
||||||
return bool(self.EvaluateJavaScript(expr))
|
return bool(self.EvaluateJavaScript(expr))
|
||||||
except util.TimeoutException:
|
except exceptions.TimeoutException:
|
||||||
# If the main thread is busy for longer than Evaluate's timeout, we
|
# 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
|
# may time out here early. Instead, we want to wait for the full
|
||||||
# timeout of this method.
|
# timeout of this method.
|
||||||
return False
|
return False
|
||||||
try:
|
try:
|
||||||
util.WaitFor(IsJavaScriptExpressionTrue, timeout)
|
util.WaitFor(IsJavaScriptExpressionTrue, timeout)
|
||||||
except util.TimeoutException as e:
|
except exceptions.TimeoutException as e:
|
||||||
# Try to make timeouts a little more actionable by dumping |this|.
|
# Try to make timeouts a little more actionable by dumping |this|.
|
||||||
raise util.TimeoutException(e.message + self.EvaluateJavaScript("""
|
raise exceptions.TimeoutException(e.message + self.EvaluateJavaScript("""
|
||||||
(function() {
|
(function() {
|
||||||
var error = '\\n\\nJavaScript |this|:\\n';
|
var error = '\\n\\nJavaScript |this|:\\n';
|
||||||
for (name in this) {
|
for (name in this) {
|
||||||
|
@@ -12,6 +12,7 @@ import subprocess
|
|||||||
import sys
|
import sys
|
||||||
import urllib
|
import urllib
|
||||||
|
|
||||||
|
from telemetry.core import exceptions
|
||||||
from telemetry.core import util
|
from telemetry.core import util
|
||||||
|
|
||||||
_REPLAY_DIR = os.path.join(
|
_REPLAY_DIR = os.path.join(
|
||||||
@@ -203,7 +204,7 @@ class ReplayServer(object):
|
|||||||
self._started_ports['https'],
|
self._started_ports['https'],
|
||||||
self._started_ports.get('dns'), # None if unused
|
self._started_ports.get('dns'), # None if unused
|
||||||
)
|
)
|
||||||
except util.TimeoutException:
|
except exceptions.TimeoutException:
|
||||||
raise ReplayNotStartedError(
|
raise ReplayNotStartedError(
|
||||||
'Web Page Replay failed to start. Log output:\n%s' %
|
'Web Page Replay failed to start. Log output:\n%s' %
|
||||||
''.join(self._LogLines()))
|
''.join(self._LogLines()))
|
||||||
@@ -223,7 +224,7 @@ class ReplayServer(object):
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
util.WaitFor(lambda: self.replay_process.poll() is not None, 10)
|
util.WaitFor(lambda: self.replay_process.poll() is not None, 10)
|
||||||
except util.TimeoutException:
|
except exceptions.TimeoutException:
|
||||||
try:
|
try:
|
||||||
# Use a SIGINT so that it can do graceful cleanup.
|
# Use a SIGINT so that it can do graceful cleanup.
|
||||||
self.replay_process.send_signal(signal.SIGINT)
|
self.replay_process.send_signal(signal.SIGINT)
|
||||||
|
@@ -4,7 +4,6 @@
|
|||||||
|
|
||||||
from telemetry import decorators
|
from telemetry import decorators
|
||||||
from telemetry.core import exceptions
|
from telemetry.core import exceptions
|
||||||
from telemetry.core import util
|
|
||||||
from telemetry.core.platform import tracing_category_filter
|
from telemetry.core.platform import tracing_category_filter
|
||||||
from telemetry.core.platform import tracing_options
|
from telemetry.core.platform import tracing_options
|
||||||
from telemetry.page.actions import action_runner as action_runner_module
|
from telemetry.page.actions import action_runner as action_runner_module
|
||||||
@@ -158,7 +157,7 @@ class ActionRunnerTest(tab_test_case.TabTestCase):
|
|||||||
action_runner.WaitForElement('#test1', timeout_in_seconds=0.2)
|
action_runner.WaitForElement('#test1', timeout_in_seconds=0.2)
|
||||||
def WaitForElement():
|
def WaitForElement():
|
||||||
action_runner.WaitForElement(text='oo', timeout_in_seconds=0.2)
|
action_runner.WaitForElement(text='oo', timeout_in_seconds=0.2)
|
||||||
self.assertRaises(util.TimeoutException, WaitForElement)
|
self.assertRaises(exceptions.TimeoutException, WaitForElement)
|
||||||
|
|
||||||
def testClickElement(self):
|
def testClickElement(self):
|
||||||
self.Navigate('page_with_clickables.html')
|
self.Navigate('page_with_clickables.html')
|
||||||
|
@@ -3,7 +3,7 @@
|
|||||||
# found in the LICENSE file.
|
# found in the LICENSE file.
|
||||||
|
|
||||||
from telemetry import decorators
|
from telemetry import decorators
|
||||||
from telemetry.core import util
|
from telemetry.core import exceptions
|
||||||
from telemetry.page.actions import loop
|
from telemetry.page.actions import loop
|
||||||
from telemetry.unittest_util import tab_test_case
|
from telemetry.unittest_util import tab_test_case
|
||||||
|
|
||||||
@@ -49,4 +49,4 @@ class LoopActionTest(tab_test_case.TabTestCase):
|
|||||||
timeout_in_seconds=1)
|
timeout_in_seconds=1)
|
||||||
action.WillRunAction(self._tab)
|
action.WillRunAction(self._tab)
|
||||||
self.assertFalse(self._tab.EvaluateJavaScript(VIDEO_1_LOOP_CHECK))
|
self.assertFalse(self._tab.EvaluateJavaScript(VIDEO_1_LOOP_CHECK))
|
||||||
self.assertRaises(util.TimeoutException, action.RunAction, self._tab)
|
self.assertRaises(exceptions.TimeoutException, action.RunAction, self._tab)
|
||||||
|
@@ -3,7 +3,7 @@
|
|||||||
# found in the LICENSE file.
|
# found in the LICENSE file.
|
||||||
|
|
||||||
from telemetry import decorators
|
from telemetry import decorators
|
||||||
from telemetry.core import util
|
from telemetry.core import exceptions
|
||||||
from telemetry.page.actions import play
|
from telemetry.page.actions import play
|
||||||
from telemetry.unittest_util import tab_test_case
|
from telemetry.unittest_util import tab_test_case
|
||||||
|
|
||||||
@@ -68,7 +68,7 @@ class PlayActionTest(tab_test_case.TabTestCase):
|
|||||||
action.WillRunAction(self._tab)
|
action.WillRunAction(self._tab)
|
||||||
self._tab.EvaluateJavaScript('document.getElementById("video_1").src = ""')
|
self._tab.EvaluateJavaScript('document.getElementById("video_1").src = ""')
|
||||||
self.assertFalse(self._tab.EvaluateJavaScript(VIDEO_1_PLAYING_CHECK))
|
self.assertFalse(self._tab.EvaluateJavaScript(VIDEO_1_PLAYING_CHECK))
|
||||||
self.assertRaises(util.TimeoutException, action.RunAction, self._tab)
|
self.assertRaises(exceptions.TimeoutException, action.RunAction, self._tab)
|
||||||
|
|
||||||
@decorators.Disabled('android', 'linux') # crbug.com/418577
|
@decorators.Disabled('android', 'linux') # crbug.com/418577
|
||||||
def testPlayWaitForEnded(self):
|
def testPlayWaitForEnded(self):
|
||||||
@@ -105,6 +105,6 @@ class PlayActionTest(tab_test_case.TabTestCase):
|
|||||||
# Assert video not playing before running action.
|
# Assert video not playing before running action.
|
||||||
self.assertFalse(self._tab.EvaluateJavaScript(VIDEO_1_PLAYING_CHECK))
|
self.assertFalse(self._tab.EvaluateJavaScript(VIDEO_1_PLAYING_CHECK))
|
||||||
self.assertFalse(self._tab.EvaluateJavaScript(VIDEO_1_ENDED_CHECK))
|
self.assertFalse(self._tab.EvaluateJavaScript(VIDEO_1_ENDED_CHECK))
|
||||||
self.assertRaises(util.TimeoutException, action.RunAction, self._tab)
|
self.assertRaises(exceptions.TimeoutException, action.RunAction, self._tab)
|
||||||
# Assert video did not end.
|
# Assert video did not end.
|
||||||
self.assertFalse(self._tab.EvaluateJavaScript(VIDEO_1_ENDED_CHECK))
|
self.assertFalse(self._tab.EvaluateJavaScript(VIDEO_1_ENDED_CHECK))
|
||||||
|
@@ -3,7 +3,7 @@
|
|||||||
# found in the LICENSE file.
|
# found in the LICENSE file.
|
||||||
|
|
||||||
from telemetry import decorators
|
from telemetry import decorators
|
||||||
from telemetry.core import util
|
from telemetry.core import exceptions
|
||||||
from telemetry.page.actions import seek
|
from telemetry.page.actions import seek
|
||||||
from telemetry.unittest_util import tab_test_case
|
from telemetry.unittest_util import tab_test_case
|
||||||
|
|
||||||
@@ -63,4 +63,4 @@ class SeekActionTest(tab_test_case.TabTestCase):
|
|||||||
action.WillRunAction(self._tab)
|
action.WillRunAction(self._tab)
|
||||||
self._tab.EvaluateJavaScript('document.getElementById("video_1").src = ""')
|
self._tab.EvaluateJavaScript('document.getElementById("video_1").src = ""')
|
||||||
self.assertFalse(self._tab.EvaluateJavaScript(VIDEO_1_SEEKED_CHECK))
|
self.assertFalse(self._tab.EvaluateJavaScript(VIDEO_1_SEEKED_CHECK))
|
||||||
self.assertRaises(util.TimeoutException, action.RunAction, self._tab)
|
self.assertRaises(exceptions.TimeoutException, action.RunAction, self._tab)
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
# Use of this source code is governed by a BSD-style license that can be
|
# Use of this source code is governed by a BSD-style license that can be
|
||||||
# found in the LICENSE file.
|
# found in the LICENSE file.
|
||||||
|
|
||||||
from telemetry.core import util
|
from telemetry.core import exceptions
|
||||||
from telemetry.unittest_util import browser_test_case
|
from telemetry.unittest_util import browser_test_case
|
||||||
|
|
||||||
|
|
||||||
@@ -19,7 +19,7 @@ class TabTestCase(browser_test_case.BrowserTestCase):
|
|||||||
self._tab = self._browser.tabs.New()
|
self._tab = self._browser.tabs.New()
|
||||||
while len(self._browser.tabs) > 1:
|
while len(self._browser.tabs) > 1:
|
||||||
self._browser.tabs[0].Close()
|
self._browser.tabs[0].Close()
|
||||||
except util.TimeoutException:
|
except exceptions.TimeoutException:
|
||||||
self._RestartBrowser()
|
self._RestartBrowser()
|
||||||
else:
|
else:
|
||||||
self._RestartBrowser()
|
self._RestartBrowser()
|
||||||
|
@@ -12,7 +12,6 @@ import time
|
|||||||
from telemetry import decorators
|
from telemetry import decorators
|
||||||
from telemetry import page as page_module
|
from telemetry import page as page_module
|
||||||
from telemetry.core import exceptions
|
from telemetry.core import exceptions
|
||||||
from telemetry.core import util
|
|
||||||
from telemetry.core import wpr_modes
|
from telemetry.core import wpr_modes
|
||||||
from telemetry.page import page_set as page_set_module
|
from telemetry.page import page_set as page_set_module
|
||||||
from telemetry.page import page_test
|
from telemetry.page import page_test
|
||||||
@@ -98,8 +97,8 @@ def _RunUserStoryAndProcessErrorIfNeeded(expectations, user_story, results,
|
|||||||
results.AddValue(skip_value)
|
results.AddValue(skip_value)
|
||||||
return
|
return
|
||||||
state.RunUserStory(results)
|
state.RunUserStory(results)
|
||||||
except (page_test.Failure, util.TimeoutException, exceptions.LoginException,
|
except (page_test.Failure, exceptions.TimeoutException,
|
||||||
exceptions.ProfilingException):
|
exceptions.LoginException, exceptions.ProfilingException):
|
||||||
ProcessError()
|
ProcessError()
|
||||||
except exceptions.AppCrashException:
|
except exceptions.AppCrashException:
|
||||||
ProcessError()
|
ProcessError()
|
||||||
|
@@ -61,7 +61,7 @@ class FindDependenciesTest(unittest.TestCase):
|
|||||||
# util.WaitFor(gsutil_process.poll, timeout=0.5)
|
# util.WaitFor(gsutil_process.poll, timeout=0.5)
|
||||||
# self.assertEqual(gsutil_process.returncode, 0,
|
# self.assertEqual(gsutil_process.returncode, 0,
|
||||||
# msg='gsutil config failed.')
|
# msg='gsutil config failed.')
|
||||||
#except util.TimeoutException:
|
#except exceptions.TimeoutException:
|
||||||
# gsutil_process.terminate()
|
# gsutil_process.terminate()
|
||||||
# gsutil_process.wait()
|
# gsutil_process.wait()
|
||||||
finally:
|
finally:
|
||||||
|
Reference in New Issue
Block a user