OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 """Seek performance testing for <video>. | 6 """Seek performance testing for <video>. |
7 | 7 |
8 Calculates the short and long seek times for different video formats on | 8 Calculates the short and long seek times for different video formats on |
9 different network constraints. | 9 different network constraints. |
10 """ | 10 """ |
11 | 11 |
12 import logging | 12 import logging |
13 import os | 13 import os |
| 14 import posixpath |
14 | 15 |
15 import pyauto_media | 16 import pyauto_media |
16 import pyauto_utils | 17 import pyauto_utils |
17 | 18 |
18 import cns_test_base | 19 import cns_test_base |
19 import worker_thread | 20 import worker_thread |
20 | 21 |
21 # Number of threads to use during testing. | 22 # Number of threads to use during testing. |
22 _TEST_THREADS = 3 | 23 _TEST_THREADS = 3 |
23 | 24 |
24 # HTML test path; relative to src/chrome/test/data. | 25 # HTML test path; relative to src/chrome/test/data. |
25 _TEST_HTML_PATH = os.path.join('media', 'html', 'media_seek.html') | 26 _TEST_HTML_PATH = os.path.join('media', 'html', 'media_seek.html') |
26 | 27 |
27 # The media files used for testing. | 28 # The media files used for testing. |
28 # Path under CNS root folder (pyauto_private/media). | 29 # Path under CNS root folder (pyauto_private/media). |
29 _TEST_VIDEOS = [os.path.join('dartmoor', name) for name in | 30 _TEST_VIDEOS = [posixpath.join('dartmoor', name) for name in |
30 ['dartmoor2.ogg', 'dartmoor2.m4a', 'dartmoor2.mp3', | 31 ['dartmoor2.ogg', 'dartmoor2.m4a', 'dartmoor2.mp3', |
31 'dartmoor2.wav']] | 32 'dartmoor2.wav']] |
32 _TEST_VIDEOS.extend(os.path.join('crowd', name) for name in | 33 _TEST_VIDEOS.extend(posixpath.join('crowd', name) for name in |
33 ['crowd1080.webm', 'crowd1080.ogv', 'crowd1080.mp4', | 34 ['crowd1080.webm', 'crowd1080.ogv', 'crowd1080.mp4', |
34 'crowd360.webm', 'crowd360.ogv', 'crowd360.mp4']) | 35 'crowd360.webm', 'crowd360.ogv', 'crowd360.mp4']) |
35 | 36 |
36 # Constraints to run tests on. | 37 # Constraints to run tests on. |
37 _TESTS_TO_RUN = [ | 38 _TESTS_TO_RUN = [ |
38 cns_test_base.Cable, | 39 cns_test_base.Cable, |
39 cns_test_base.Wifi, | 40 cns_test_base.Wifi, |
40 cns_test_base.NoConstraints] | 41 cns_test_base.NoConstraints] |
41 | 42 |
42 | 43 |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 def testMediaSeekPerformance(self): | 109 def testMediaSeekPerformance(self): |
109 """Launches HTML test which plays each video and records seek stats.""" | 110 """Launches HTML test which plays each video and records seek stats.""" |
110 tasks = cns_test_base.CreateCNSPerfTasks(_TESTS_TO_RUN, _TEST_VIDEOS) | 111 tasks = cns_test_base.CreateCNSPerfTasks(_TESTS_TO_RUN, _TEST_VIDEOS) |
111 if worker_thread.RunWorkerThreads(self, SeekWorkerThread, tasks, | 112 if worker_thread.RunWorkerThreads(self, SeekWorkerThread, tasks, |
112 _TEST_THREADS, _TEST_HTML_PATH): | 113 _TEST_THREADS, _TEST_HTML_PATH): |
113 self.fail('Some tests failed to run as expected.') | 114 self.fail('Some tests failed to run as expected.') |
114 | 115 |
115 | 116 |
116 if __name__ == '__main__': | 117 if __name__ == '__main__': |
117 pyauto_media.Main() | 118 pyauto_media.Main() |
OLD | NEW |