OLD | NEW |
1 #!/usr/bin/python | 1 #!/usr/bin/python |
2 # Copyright (c) 2011 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2011 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 """A framework to run PyAuto HTML media tests. | 6 """A framework to run PyAuto HTML media tests. |
7 | 7 |
8 This PyAuto powered script plays media (video or audio) files (using the HTML5 | 8 This PyAuto powered script plays media (video or audio) files (using the HTML5 |
9 tag embedded in an HTML file). The parameters needed to run this test are | 9 tag embedded in an HTML file). The parameters needed to run this test are |
10 passed in the form of environment variables (such as the number of runs). | 10 passed in the form of environment variables (such as the number of runs). |
11 media_test_runner.py is used for generating these variables | 11 media_test_runner.py is used for generating these variables |
12 (PyAuto does not support direct parameters). | 12 (PyAuto does not support direct parameters). |
13 """ | 13 """ |
14 | 14 |
15 import csv | 15 import csv |
| 16 import logging |
16 import os | 17 import os |
17 import time | 18 import time |
18 | 19 |
19 import pyauto_media | 20 import pyauto_media |
20 import pyauto | 21 import pyauto |
21 | 22 |
22 from media_test_env_names import MediaTestEnvNames | 23 from media_test_env_names import MediaTestEnvNames |
23 from ui_perf_test_utils import UIPerfTestUtils | 24 from ui_perf_test_utils import UIPerfTestUtils |
24 | 25 |
25 | 26 |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 self._test_scenarios = [test_scenario] * self.number_of_runs | 139 self._test_scenarios = [test_scenario] * self.number_of_runs |
139 if test_scenario_filename: | 140 if test_scenario_filename: |
140 self._test_scenarios = self.ReadTestScenarioFiles(test_scenario_filename) | 141 self._test_scenarios = self.ReadTestScenarioFiles(test_scenario_filename) |
141 # One run per test scenario. | 142 # One run per test scenario. |
142 self.number_of_runs = len(self._test_scenarios) | 143 self.number_of_runs = len(self._test_scenarios) |
143 for run_counter in range(self.number_of_runs): | 144 for run_counter in range(self.number_of_runs): |
144 self.PreEachRunProcess(run_counter) | 145 self.PreEachRunProcess(run_counter) |
145 url = self.url | 146 url = self.url |
146 if self._test_scenarios: | 147 if self._test_scenarios: |
147 url += '&actions=' + self.test_scenarios[run_counter] | 148 url += '&actions=' + self.test_scenarios[run_counter] |
| 149 logging.debug('Navigate to %s', url) |
148 self.NavigateToURL(url) | 150 self.NavigateToURL(url) |
149 self.WaitUntil(lambda: _VideoEnded(), | 151 self.WaitUntil(lambda: _VideoEnded(), |
150 self.TIMEOUT) | 152 self.TIMEOUT) |
151 self.PostEachRunProcess(run_counter) | 153 self.PostEachRunProcess(run_counter) |
152 | 154 |
153 self.PostAllRunsProcess() | 155 self.PostAllRunsProcess() |
154 | 156 |
155 # A list of methods that should be overridden in the subclass. | 157 # A list of methods that should be overridden in the subclass. |
156 # It is a good practice to call these methods even if these are | 158 # It is a good practice to call these methods even if these are |
157 # overridden. | 159 # overridden. |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 """ | 203 """ |
202 pass | 204 pass |
203 | 205 |
204 def GetPlayerHTMLFileName(self): | 206 def GetPlayerHTMLFileName(self): |
205 """A method to get the player HTML file name.""" | 207 """A method to get the player HTML file name.""" |
206 return 'media_playback.html' | 208 return 'media_playback.html' |
207 | 209 |
208 | 210 |
209 if __name__ == '__main__': | 211 if __name__ == '__main__': |
210 pyauto_media.Main() | 212 pyauto_media.Main() |
OLD | NEW |