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

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

Issue 1931553004: Stop the existing session if it exists before start a new session and add mirroring scenario for cp… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update media_router_perf_pages.py Created 4 years, 8 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 a7203bad3611d0fbd5e334b018747e026667ab4a..8c6555638a5aaf50dcbf85084c80252afe4d4084 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
@@ -10,6 +10,7 @@ from benchmarks.pagesets import media_router_page
from telemetry.core import exceptions
from telemetry.page import shared_page_state
+SESSION_TIME = 300 # 5 minutes
class SharedState(shared_page_state.SharedPageState):
"""Shared state that restarts the browser for every single story."""
@@ -59,7 +60,7 @@ class CastIdlePage(CastDialogPage):
action_runner.Wait(5)
with action_runner.CreateInteraction('Idle'):
action_runner.ExecuteJavaScript('collectPerfData();')
- action_runner.Wait(300)
+ action_runner.Wait(SESSION_TIME)
class CastFlingingPage(media_router_page.CastPage):
@@ -72,13 +73,17 @@ class CastFlingingPage(media_router_page.CastPage):
shared_page_state_class=SharedState)
def RunPageInteractions(self, action_runner):
- # Wait for 5s after Chrome is opened in order to get consistent results.
+ sink_name = self._GetDeviceName()
+ # Wait for 5s after Chrome is opened in order to get consistent results.
action_runner.Wait(5)
with action_runner.CreateInteraction('flinging'):
+
self._WaitForResult(
action_runner,
lambda: action_runner.EvaluateJavaScript('initialized'),
- 'Failed to initialize')
+ 'Failed to initialize',
+ timeout=30)
+ self.CloseExistingRoute(action_runner, sink_name)
# Start session
action_runner.TapElement(selector='#start_session_button')
@@ -92,7 +97,7 @@ class CastFlingingPage(media_router_page.CastPage):
for tab in action_runner.tab.browser.tabs:
# Choose sink
if tab.url == 'chrome://media-router/':
- self.ChooseSink(tab, self._GetDeviceName())
+ self.ChooseSink(tab, sink_name)
self._WaitForResult(
action_runner,
@@ -110,7 +115,7 @@ class CastFlingingPage(media_router_page.CastPage):
action_runner.Wait(5)
action_runner.ExecuteJavaScript('collectPerfData();')
- action_runner.Wait(300)
+ action_runner.Wait(SESSION_TIME)
# Stop session
self.ExecuteAsyncJavaScript(
action_runner,
@@ -119,6 +124,49 @@ class CastFlingingPage(media_router_page.CastPage):
'Failed to stop session')
+class CastMirroringPage(media_router_page.CastPage):
+ """Cast page to mirror a tab to Chromecast device."""
+
+ def __init__(self, page_set):
+ super(CastMirroringPage, self).__init__(
+ page_set=page_set,
+ url='file://mirroring.html',
+ shared_page_state_class=SharedState)
+
+ def RunPageInteractions(self, action_runner):
+ sink_name = self._GetDeviceName()
+ # Wait for 5s after Chrome is opened in order to get consistent results.
+ action_runner.Wait(5)
+ with action_runner.CreateInteraction('mirroring'):
+ self.CloseExistingRoute(action_runner, sink_name)
+
+ # Start session
+ action_runner.TapElement(selector='#start_session_button')
+ self._WaitForResult(
+ action_runner,
+ lambda: len(action_runner.tab.browser.tabs) >= 2,
+ 'MR dialog never showed up.')
+
+ # Wait for 2s to make sure the dialog is fully loaded.
+ action_runner.Wait(2)
+ for tab in action_runner.tab.browser.tabs:
+ # Choose sink
+ if tab.url == 'chrome://media-router/':
+ self.ChooseSink(tab, sink_name)
+
+ # Wait for 5s to make sure the route is created.
+ action_runner.Wait(5)
+ action_runner.TapElement(selector='#start_session_button')
+ action_runner.Wait(2)
+ for tab in action_runner.tab.browser.tabs:
+ if tab.url == 'chrome://media-router/':
+ if not self.CheckIfExistingRoute(tab, sink_name):
+ raise page.page_test.Failure('Failed to start mirroring session.')
+ action_runner.ExecuteJavaScript('collectPerfData();')
+ action_runner.Wait(SESSION_TIME)
+ self.CloseExistingRoute(action_runner, sink_name)
+
+
class MediaRouterDialogPageSet(story.StorySet):
"""Pageset for media router dialog latency tests."""
@@ -136,3 +184,4 @@ class MediaRouterCPUMemoryPageSet(story.StorySet):
cloud_storage_bucket=story.PARTNER_BUCKET)
self.AddStory(CastIdlePage(self))
self.AddStory(CastFlingingPage(self))
+ self.AddStory(CastMirroringPage(self))

Powered by Google App Engine
This is Rietveld 408576698