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

Unified Diff: chrome/test/functional/media/media_basic_playback.py

Issue 9233046: Bug fixes for basic playback test. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Code review fixes. Created 8 years, 11 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 | « chrome/test/data/media/html/media_basic_playback.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/functional/media/media_basic_playback.py
diff --git a/chrome/test/functional/media/media_basic_playback.py b/chrome/test/functional/media/media_basic_playback.py
index 120b51ed4493a25625181c69062d75fe8af976a8..ed0f1a0f86d77bc9bf0d469ec76410317829f7b2 100755
--- a/chrome/test/functional/media/media_basic_playback.py
+++ b/chrome/test/functional/media/media_basic_playback.py
@@ -25,32 +25,51 @@ _TEST_VIDEOS = [
'bear.mp4', 'bear.ogv', 'bear.webm', 'bear_silent.mp4', 'bear_silent.ogv',
'bear_silent.webm']
+# Expected events for the first iteration and every iteration thereafter.
+_EXPECTED_EVENTS_0 = [('ended', 2), ('playing', 2), ('seeked', 1)]
+_EXPECTED_EVENTS_n = [('abort', 1), ('emptied', 1)] + _EXPECTED_EVENTS_0
+
class MediaConstrainedNetworkPerfTest(pyauto.PyUITest):
"""PyAuto test container. See file doc string for more information."""
def testBasicPlaybackMatrix(self):
- """Launches HTML test which plays a video until end, seeks, and replays.
+ """Launches HTML test which plays each video until end, seeks, and replays.
Specifically ensures that after the above sequence of events, the following
- is true:
+ are true:
+
+ 1. The first video has only 2x playing, 2x ended, and 1x seeked events.
+ 2. Each subsequent video additionally has 1x abort and 1x emptied due to
+ switching of the src attribute.
+ 3. video.currentTime == video.duration for each video.
- 1. 2x playing, 2x ended, 1x seeked, 0x error, and 0x abort events.
- 2. video.currentTime == video.duration.
+ See the HTML file at _TEST_HTML_PATH for more information.
"""
- for media in _TEST_VIDEOS:
- logging.debug('Running basic playback test for %s', media)
+ self.NavigateToURL(self.GetFileURLForDataPath(_TEST_HTML_PATH))
- self.NavigateToURL('%s?media=%s' % (
- self.GetFileURLForDataPath(_TEST_HTML_PATH), media))
+ for i, media in enumerate(_TEST_VIDEOS):
+ logging.debug('Running basic playback test for %s', media)
# Block until the test finishes and notifies us. Upon return the value of
# video.currentTime == video.duration is provided.
- self.assertTrue(self.ExecuteJavascript('true;'))
-
- events = self.GetDOMValue('events').split(',')
- counts = [(item, events.count(item)) for item in sorted(set(events))]
- self.assertEqual(counts, [('ended', 2), ('playing', 2), ('seeked', 1)])
+ try:
+ self.assertTrue(self.ExecuteJavascript("startTest('%s');" % media))
+
+ # PyAuto has trouble with arrays, so convert to string prior to request.
+ events = self.GetDOMValue("events.join(',')").split(',')
+ counts = [(item, events.count(item)) for item in sorted(set(events))]
+
+ # The first loop will not have the abort and emptied events triggered by
+ # changing the video src.
+ if (i == 0):
+ self.assertEqual(counts, _EXPECTED_EVENTS_0)
+ else:
+ self.assertEqual(counts, _EXPECTED_EVENTS_n)
+ except:
+ logging.debug(
+ 'Test failed with events: %s', self.GetDOMValue("events.join(',')"))
+ raise
if __name__ == '__main__':
« no previous file with comments | « chrome/test/data/media/html/media_basic_playback.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698