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

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

Issue 2672803002: [Telemetry refactor] Migrate clients to new JavaScript API (batch 3) (Closed)
Patch Set: add comment on tools/android 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
Index: chrome/test/media_router/telemetry/benchmarks/pagesets/media_router_perf_pages.py
diff --git a/chrome/test/media_router/telemetry/benchmarks/pagesets/media_router_perf_pages.py b/chrome/test/media_router/telemetry/benchmarks/pagesets/media_router_perf_pages.py
index fdef353b7e72a55018d346885b106181f4f8c11d..5faec39f0d50147c1fab56236b596281b0475fe0 100644
--- a/chrome/test/media_router/telemetry/benchmarks/pagesets/media_router_perf_pages.py
+++ b/chrome/test/media_router/telemetry/benchmarks/pagesets/media_router_perf_pages.py
@@ -9,9 +9,12 @@ from telemetry import story
from benchmarks.pagesets import media_router_page
from telemetry.core import exceptions
from telemetry.page import shared_page_state
+from telemetry.util import js_template
+
SESSION_TIME = 300 # 5 minutes
+
class SharedState(shared_page_state.SharedPageState):
"""Shared state that restarts the browser for every single story."""
@@ -59,7 +62,7 @@ class CastIdlePage(CastDialogPage):
# Wait for 5s after Chrome is opened in order to get consistent results.
action_runner.Wait(5)
with action_runner.CreateInteraction('Idle'):
- action_runner.ExecuteJavaScript('collectPerfData();')
+ action_runner.ExecuteJavaScript2('collectPerfData();')
action_runner.Wait(SESSION_TIME)
@@ -80,7 +83,7 @@ class CastFlingingPage(media_router_page.CastPage):
self._WaitForResult(
action_runner,
- lambda: action_runner.EvaluateJavaScript('initialized'),
+ lambda: action_runner.EvaluateJavaScript2('initialized'),
'Failed to initialize',
timeout=30)
self.CloseExistingRoute(action_runner, sink_name)
@@ -100,26 +103,27 @@ class CastFlingingPage(media_router_page.CastPage):
self._WaitForResult(
action_runner,
- lambda: action_runner.EvaluateJavaScript('currentSession'),
+ lambda: action_runner.EvaluateJavaScript2('currentSession'),
'Failed to start session',
timeout=10)
# Load Media
- self.ExecuteAsyncJavaScript(
+ self.ExecuteAsyncJavaScript2(
action_runner,
- 'loadMedia("%s");' % utils.GetInternalVideoURL(),
- lambda: action_runner.EvaluateJavaScript('currentMedia'),
+ js_template.Render(
+ 'loadMedia({{ url }});', url=utils.GetInternalVideoURL()),
+ lambda: action_runner.EvaluateJavaScript2('currentMedia'),
'Failed to load media',
timeout=120)
action_runner.Wait(5)
- action_runner.ExecuteJavaScript('collectPerfData();')
+ action_runner.ExecuteJavaScript2('collectPerfData();')
action_runner.Wait(SESSION_TIME)
# Stop session
- self.ExecuteAsyncJavaScript(
+ self.ExecuteAsyncJavaScript2(
action_runner,
'stopSession();',
- lambda: not action_runner.EvaluateJavaScript('currentSession'),
+ lambda: not action_runner.EvaluateJavaScript2('currentSession'),
'Failed to stop session',
timeout=30)
@@ -166,7 +170,7 @@ class CastMirroringPage(media_router_page.CastPage):
self.WaitUntilDialogLoaded(action_runner, tab)
if not self.CheckIfExistingRoute(tab, sink_name):
raise page.page_test.Failure('Failed to start mirroring session.')
- action_runner.ExecuteJavaScript('collectPerfData();')
+ action_runner.ExecuteJavaScript2('collectPerfData();')
action_runner.Wait(SESSION_TIME)
self.CloseExistingRoute(action_runner, sink_name)

Powered by Google App Engine
This is Rietveld 408576698