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

Side by Side Diff: chrome/test/functional/media/media_basic_playback.py

Issue 9290008: Introduce new basic playback test. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove test matrix for now. 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 #!/usr/bin/env python
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file.
5
6 """Basic playback test. Checks playback, seek, and replay based on events.
7
8 This test uses the bear videos from the test matrix in h264, vp8, and theora
9 formats.
10 """
11 import logging
12 import os
13
14 import pyauto_media
15 import pyauto
16
17
18 # HTML test path; relative to src/chrome/test/data.
19 _TEST_HTML_PATH = os.path.join('media', 'html', 'media_basic_playback.html')
20
21 # Test videos to play. TODO(dalecurtis): Convert to text matrix parser when we
22 # have more test videos in the matrix. Code already written, ping for details.
Ami GONE FROM CHROMIUM 2012/01/26 21:40:05 ...or you could point to the PS#3 of this CR :)
DaleCurtis 2012/01/26 22:11:36 Done.
23 _TEST_VIDEOS = [
24 'bear.mp4', 'bear.ogv', 'bear.webm', 'bear_silent.mp4', 'bear_silent.ogv',
25 'bear_silent.webm']
26
27
28 class MediaConstrainedNetworkPerfTest(pyauto.PyUITest):
29 """PyAuto test container. See file doc string for more information."""
30
31 def testBasicPlaybackMatrix(self):
32 """Launches HTML test which plays a video until end, seeks, and replays.
33
34 Specifically ensures that after the above sequence of events, the following
35 is true:
36
37 1. 2x playing, 2x ended, 1x seeked, 0x error, and 0x abort events.
38 2. video.currentTime == video.duration.
39 """
40 for media in _TEST_VIDEOS:
41 logging.debug('Running basic playback test for %s', media)
42
43 self.NavigateToURL('%s?media=%s' % (
44 self.GetFileURLForDataPath(_TEST_HTML_PATH), media))
45
46 # Block until the test finishes and notifies us. Upon return the value of
47 # video.currentTime == video.duration is provided.
48 self.assertTrue(self.ExecuteJavascript('true;'))
49
50 events = self.GetDOMValue('events').split(',')
51 counts = [(item, events.count(item)) for item in sorted(set(events))]
52 self.assertEqual(counts, [('ended', 2), ('playing', 2), ('seeked', 1)])
53
54
55 if __name__ == '__main__':
56 pyauto_media.Main()
OLDNEW
« chrome/test/data/media/html/utils.js ('K') | « chrome/test/data/media/html/utils.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698