from telemetry.page.actions import play
from telemetry.unittest import tab_test_case
-
AUDIO_1_PLAYING_CHECK = 'window.__hasEventCompleted("#audio_1", "playing");'
VIDEO_1_PLAYING_CHECK = 'window.__hasEventCompleted("#video_1", "playing");'
VIDEO_1_ENDED_CHECK = 'window.__hasEventCompleted("#video_1", "ended");'
tab_test_case.TabTestCase.setUp(self)
self.Navigate('video_test.html')
- @decorators.Disabled('android')
+ @decorators.Disabled('android', 'linux') # crbug.com/418577
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=5)
action.WillRunAction(self._tab)
# Both videos not playing before running action.
self.assertFalse(self._tab.EvaluateJavaScript(VIDEO_1_PLAYING_CHECK))
self.assertTrue(self._tab.EvaluateJavaScript(VIDEO_1_PLAYING_CHECK))
self.assertFalse(self._tab.EvaluateJavaScript(AUDIO_1_PLAYING_CHECK))
- @decorators.Disabled('android')
+ @decorators.Disabled('android', 'linux') # crbug.com/418577
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=5)
action.WillRunAction(self._tab)
# Both videos not playing before running action.
self.assertFalse(self._tab.EvaluateJavaScript(VIDEO_1_PLAYING_CHECK))
self.assertTrue(self._tab.EvaluateJavaScript(VIDEO_1_PLAYING_CHECK))
self.assertFalse(self._tab.EvaluateJavaScript(AUDIO_1_PLAYING_CHECK))
- @decorators.Disabled('android')
+ @decorators.Disabled('android', 'linux') # crbug.com/418577
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=5)
action.WillRunAction(self._tab)
# Both videos not playing before running action.
self.assertFalse(self._tab.EvaluateJavaScript(VIDEO_1_PLAYING_CHECK))
self.assertTrue(self._tab.EvaluateJavaScript(AUDIO_1_PLAYING_CHECK))
# http://crbug.com/273887
+ @decorators.Disabled('linux') # crbug.com/418577
def testPlayWaitForPlayTimeout(self):
"""Tests that wait_for_playing timeouts if video does not play."""
- data = {'selector': '#video_1',
- 'wait_for_playing': True,
- 'wait_timeout': 1}
- action = play.PlayAction(data)
+ action = play.PlayAction(selector='#video_1',
+ playing_event_timeout_in_seconds=5)
action.WillRunAction(self._tab)
self._tab.EvaluateJavaScript('document.getElementById("video_1").src = ""')
self.assertFalse(self._tab.EvaluateJavaScript(VIDEO_1_PLAYING_CHECK))
self.assertRaises(util.TimeoutException, action.RunAction, self._tab)
- @decorators.Disabled('android')
+ @decorators.Disabled('android', 'linux') # crbug.com/418577
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=5)
action.WillRunAction(self._tab)
# Assert video not playing before running action.
self.assertFalse(self._tab.EvaluateJavaScript(VIDEO_1_PLAYING_CHECK))
# Assert video ended.
self.assertTrue(self._tab.EvaluateJavaScript(VIDEO_1_ENDED_CHECK))
+ @decorators.Disabled('linux') # crbug.com/418577
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))
# Assert video did not end.
self.assertFalse(self._tab.EvaluateJavaScript(VIDEO_1_ENDED_CHECK))
+ @decorators.Disabled('linux') # crbug.com/418577
def testPlayWaitForEndedTimeout(self):
"""Tests that action raises exception if timeout is reached."""
- data = {'selector': '#video_1', 'wait_for_ended': True, 'wait_timeout': 1}
- action = play.PlayAction(data)
+ action = play.PlayAction(selector='#video_1',
+ ended_event_timeout_in_seconds=0.1)
action.WillRunAction(self._tab)
# Assert video not playing before running action.
self.assertFalse(self._tab.EvaluateJavaScript(VIDEO_1_PLAYING_CHECK))