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

Unified Diff: chrome/test/media_router/telemetry/benchmarks/pagesets/media_router_page.py

Issue 2724903005: Updates exception and adds rety to ExecuteAsyncJavaScript (Closed)
Patch Set: Created 3 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/test/media_router/telemetry/benchmarks/pagesets/media_router_perf_pages.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/media_router/telemetry/benchmarks/pagesets/media_router_page.py
diff --git a/chrome/test/media_router/telemetry/benchmarks/pagesets/media_router_page.py b/chrome/test/media_router/telemetry/benchmarks/pagesets/media_router_page.py
index 5fc9ff9236fcbf36362ef9062ff378b4ab80dadb..23381ce63eba8410a580994440e52112848c8104 100644
--- a/chrome/test/media_router/telemetry/benchmarks/pagesets/media_router_page.py
+++ b/chrome/test/media_router/telemetry/benchmarks/pagesets/media_router_page.py
@@ -87,12 +87,20 @@ class CastPage(page.Page):
return route
def ExecuteAsyncJavaScript(self, action_runner, script, verify_func,
- error_message, timeout=5):
+ error_message, timeout=5, retry=1):
"""Executes async javascript function and waits until it finishes."""
-
- action_runner.ExecuteJavaScript(script)
- self._WaitForResult(action_runner, verify_func, error_message,
- timeout=timeout)
+ exception = None
+ for _ in xrange(retry):
+ try:
+ action_runner.ExecuteJavaScript(script)
+ self._WaitForResult(
+ action_runner, verify_func, error_message, timeout=timeout)
+ exception = None
+ break
+ except RuntimeError as e:
+ exception = e
+ if exception:
+ raise exception
def WaitUntilDialogLoaded(self, action_runner, tab):
"""Waits until dialog is fully loaded."""
@@ -118,13 +126,13 @@ class CastPage(page.Page):
time.time() - start_time < timeout):
action_runner.Wait(1)
if not verify_func():
- raise page.page_test.Failure(error_message)
+ raise RuntimeError(error_message)
def _GetDeviceName(self):
"""Gets device name from environment variable RECEIVER_NAME."""
if 'RECEIVER_IP' not in os.environ or not os.environ.get('RECEIVER_IP'):
- raise page.page_test.Failure(
+ raise RuntimeError(
'Your test machine is not set up correctly, '
'RECEIVER_IP enviroment variable is missing.')
return utils.GetDeviceName(os.environ.get('RECEIVER_IP'))
« no previous file with comments | « no previous file | chrome/test/media_router/telemetry/benchmarks/pagesets/media_router_perf_pages.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698