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

Unified Diff: tools/telemetry/telemetry/page/actions/play_unittest.py

Issue 346923003: Add ActionRunner wrapper for the remaining less used actions (try 2): (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update unit test to skip test if touch is not supported. Created 6 years, 5 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 | « tools/telemetry/telemetry/page/actions/play.py ('k') | tools/telemetry/telemetry/page/actions/reload.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/telemetry/telemetry/page/actions/play_unittest.py
diff --git a/tools/telemetry/telemetry/page/actions/play_unittest.py b/tools/telemetry/telemetry/page/actions/play_unittest.py
index ab1aae0e49f4a7ec9ffe7015b47573685df85c09..dc2052ad5c2245386ae1eb8361659463c259a096 100644
--- a/tools/telemetry/telemetry/page/actions/play_unittest.py
+++ b/tools/telemetry/telemetry/page/actions/play_unittest.py
@@ -22,8 +22,7 @@ class PlayActionTest(tab_test_case.TabTestCase):
@decorators.Disabled('android')
def testPlayWithNoSelector(self):
"""Tests that with no selector Play action plays first video element."""
- data = {'wait_for_playing': True}
- action = play.PlayAction(data)
+ action = play.PlayAction(playing_event_timeout_in_seconds=60)
action.WillRunAction(self._tab)
# Both videos not playing before running action.
self.assertFalse(self._tab.EvaluateJavaScript(VIDEO_1_PLAYING_CHECK))
@@ -36,8 +35,8 @@ class PlayActionTest(tab_test_case.TabTestCase):
@decorators.Disabled('android')
def testPlayWithVideoSelector(self):
"""Tests that Play action plays video element matching selector."""
- data = {'selector': '#video_1', 'wait_for_playing': True}
- action = play.PlayAction(data)
+ action = play.PlayAction(selector='#video_1',
+ playing_event_timeout_in_seconds=60)
action.WillRunAction(self._tab)
# Both videos not playing before running action.
self.assertFalse(self._tab.EvaluateJavaScript(VIDEO_1_PLAYING_CHECK))
@@ -50,8 +49,8 @@ class PlayActionTest(tab_test_case.TabTestCase):
@decorators.Disabled('android')
def testPlayWithAllSelector(self):
"""Tests that Play action plays all video elements with selector='all'."""
- data = {'selector': 'all', 'wait_for_playing': True}
- action = play.PlayAction(data)
+ action = play.PlayAction(selector='all',
+ playing_event_timeout_in_seconds=60)
action.WillRunAction(self._tab)
# Both videos not playing before running action.
self.assertFalse(self._tab.EvaluateJavaScript(VIDEO_1_PLAYING_CHECK))
@@ -64,10 +63,8 @@ class PlayActionTest(tab_test_case.TabTestCase):
# http://crbug.com/273887
def testPlayWaitForPlayTimeout(self):
"""Tests that wait_for_playing timeouts if video does not play."""
- data = {'selector': '#video_1',
- 'wait_for_playing': True,
- 'wait_timeout_in_seconds': 1}
- action = play.PlayAction(data)
+ action = play.PlayAction(selector='#video_1',
+ playing_event_timeout_in_seconds=1)
action.WillRunAction(self._tab)
self._tab.EvaluateJavaScript('document.getElementById("video_1").src = ""')
self.assertFalse(self._tab.EvaluateJavaScript(VIDEO_1_PLAYING_CHECK))
@@ -76,8 +73,8 @@ class PlayActionTest(tab_test_case.TabTestCase):
@decorators.Disabled('android')
def testPlayWaitForEnded(self):
"""Tests that wait_for_ended waits for video to end."""
- data = {'selector': '#video_1', 'wait_for_ended': True}
- action = play.PlayAction(data)
+ action = play.PlayAction(selector='#video_1',
+ ended_event_timeout_in_seconds=60)
action.WillRunAction(self._tab)
# Assert video not playing before running action.
self.assertFalse(self._tab.EvaluateJavaScript(VIDEO_1_PLAYING_CHECK))
@@ -88,8 +85,8 @@ class PlayActionTest(tab_test_case.TabTestCase):
def testPlayWithoutWaitForEnded(self):
"""Tests that wait_for_ended waits for video to end."""
- data = {'selector': '#video_1', 'wait_for_ended': False}
- action = play.PlayAction(data)
+ action = play.PlayAction(selector='#video_1',
+ ended_event_timeout_in_seconds=0)
action.WillRunAction(self._tab)
# Assert video not playing before running action.
self.assertFalse(self._tab.EvaluateJavaScript(VIDEO_1_PLAYING_CHECK))
@@ -100,9 +97,8 @@ class PlayActionTest(tab_test_case.TabTestCase):
def testPlayWaitForEndedTimeout(self):
"""Tests that action raises exception if timeout is reached."""
- data = {'selector': '#video_1', 'wait_for_ended': True,
- 'wait_timeout_in_seconds': 1}
- action = play.PlayAction(data)
+ action = play.PlayAction(selector='#video_1',
+ ended_event_timeout_in_seconds=1)
action.WillRunAction(self._tab)
# Assert video not playing before running action.
self.assertFalse(self._tab.EvaluateJavaScript(VIDEO_1_PLAYING_CHECK))
« no previous file with comments | « tools/telemetry/telemetry/page/actions/play.py ('k') | tools/telemetry/telemetry/page/actions/reload.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698