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

Unified Diff: tools/perf/page_sets/system_health/media_stories.py

Issue 2787103003: Add System health stories for Emerging market (Closed)
Patch Set: fixes. Created 3 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: tools/perf/page_sets/system_health/media_stories.py
diff --git a/tools/perf/page_sets/system_health/media_stories.py b/tools/perf/page_sets/system_health/media_stories.py
index ad079e8d4b515282fcec217d1b9a326dc0bcc3a8..01800d454ab91c04f8fe3353958e6bc76b555e31 100644
--- a/tools/perf/page_sets/system_health/media_stories.py
+++ b/tools/perf/page_sets/system_health/media_stories.py
@@ -3,6 +3,7 @@
# found in the LICENSE file.
from page_sets.system_health import platforms
+from page_sets.system_health import story_tags
from page_sets.system_health import system_health_story
from page_sets.login_helpers import google_login
@@ -12,7 +13,7 @@ from telemetry import benchmark
from telemetry import decorators
-class _MediaStory(system_health_story.SystemHealthStory):
+class _PlayMediaStory(system_health_story.SystemHealthStory):
"""Abstract base class for media System Health user stories."""
ABSTRACT_STORY = True
@@ -52,12 +53,12 @@ class _MediaStory(system_health_story.SystemHealthStory):
################################################################################
-# Audio stories.
+# Audio and video stories.
################################################################################
@benchmark.Disabled('all') # crbug.com/649392
-class GooglePlayMusicDesktopStory(_MediaStory):
+class GooglePlayMusicDesktopStory(_PlayMediaStory):
NAME = 'play:media:google_play_music'
URL = 'https://music.google.com'
@@ -82,7 +83,7 @@ class GooglePlayMusicDesktopStory(_MediaStory):
@benchmark.Disabled('win') # crbug.com/649392
-class SoundCloudDesktopStory(_MediaStory):
+class SoundCloudDesktopStory(_PlayMediaStory):
NAME = 'play:media:soundcloud'
URL = 'https://soundcloud.com'
@@ -100,7 +101,7 @@ class SoundCloudDesktopStory(_MediaStory):
@decorators.Disabled('all') # crbug.com/649392
-class PandoraDesktopStory(_MediaStory):
+class PandoraDesktopStory(_PlayMediaStory):
NAME = 'play:media:pandora'
URL = 'https://pandora.com'
@@ -114,3 +115,38 @@ class PandoraDesktopStory(_MediaStory):
def _NavigateToMedia(self, action_runner):
pass # Audio autoplays on Pandora, no need to search.
+
+
+class YoutubeMobileStory(_PlayMediaStory):
nednguyen 2017/04/11 22:24:10 Also add docstring describe what this story is doi
ssid 2017/04/13 21:08:53 removed this story for now.
+ NAME = 'browse:media:youtube'
+ URL = 'https://m.youtube.in/watch?v=OnhXkCPMeMc'
+ SUPPORTED_PLATFORMS = platforms.MOBILE_ONLY
+ TAGS = [story_tags.EMERGING_MARKET]
+
+ PLAYER_FUNCTION = 'document.getElementById("player")'
+ STOP_FUNCTION = 'document.getElementsByTagName("video")[0].pause()'
+ TIME_FUNCTION = 'document.getElementsByTagName("video")[0].currentTime'
+
+ def RunPageInteractions(self, action_runner):
+ app_ui = action_runner.tab.browser.app_ui
+ action_runner.WaitForElement(element_function=self.PLAYER_FUNCTION)
+
+ # Simulate user click in system ui since youtube play can be initialied only
+ # by user gesture.
+ renderer_view_id = 'compositor_view_holder'
+ app_ui.WaitForUiNode(resource_id=renderer_view_id)
+ renderer_view = app_ui.GetUiNode(resource_id=renderer_view_id)
+ # Click on the top half of the renderer view to start video.
+ shifted_center = 0.5 * (
+ renderer_view.bounds.center + renderer_view.bounds.top_left)
+ renderer_view.Tap(point=shifted_center)
+
+ self._WaitForPlayTime(action_runner)
+ action_runner.EvaluateJavaScript(self.STOP_FUNCTION)
+ self._Measure(action_runner)
+
+ def _GetTimeInSeconds(self, action_runner):
+ return int(action_runner.EvaluateJavaScript(self.TIME_FUNCTION))
+
+ def _NavigateToMedia(self, action_runner):
+ pass # Users usually open youtube links directly, skip searching.

Powered by Google App Engine
This is Rietveld 408576698