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). |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 | 74 |
75 tag = os.getenv(MediaTestEnvNames.MEDIA_TAG_ENV_NAME, | 75 tag = os.getenv(MediaTestEnvNames.MEDIA_TAG_ENV_NAME, |
76 self.DEFAULT_MEDIA_TAG_NAME) | 76 self.DEFAULT_MEDIA_TAG_NAME) |
77 query_dictionary = {'tag': tag, 'media': media_filename} | 77 query_dictionary = {'tag': tag, 'media': media_filename} |
78 # This parameter tricks the media cache into thinking | 78 # This parameter tricks the media cache into thinking |
79 # it's a new file every time. | 79 # it's a new file every time. |
80 # However, it looks like does not make much difference in | 80 # However, it looks like does not make much difference in |
81 # performance. | 81 # performance. |
82 if os.getenv(MediaTestEnvNames.ADD_T_PARAMETER_ENV_NAME): | 82 if os.getenv(MediaTestEnvNames.ADD_T_PARAMETER_ENV_NAME): |
83 query_dictionary['t'] = 'dummy' | 83 query_dictionary['t'] = 'dummy' |
| 84 track_file = os.getenv(MediaTestEnvNames.TRACK_FILE_ENV_NAME) |
| 85 if track_file: |
| 86 query_dictionary['track'] = track_file |
84 query_str = '&'.join( | 87 query_str = '&'.join( |
85 [k + '=' + str(v) for (k, v) in query_dictionary.items()]) | 88 [k + '=' + str(v) for (k, v) in query_dictionary.items()]) |
86 if player_html_url_nickname == self.DEFAULT_PLAYER_HTML_URL_NICKNAME: | 89 if player_html_url_nickname == self.DEFAULT_PLAYER_HTML_URL_NICKNAME: |
87 # Default is local file under DataDir(). | 90 # Default is local file under DataDir(). |
88 file_url = self.GetFileURLForDataPath( | 91 file_url = self.GetFileURLForDataPath( |
89 os.path.join('media', 'html', self.GetPlayerHTMLFileName())) | 92 os.path.join('media', 'html', self.GetPlayerHTMLFileName())) |
90 url = file_url + '?' + query_str | 93 url = file_url + '?' + query_str |
91 else: | 94 else: |
92 url = player_html_url + '?' + query_str | 95 url = player_html_url + '?' + query_str |
93 parameter_str = '%s_%s_%s' % ( | 96 parameter_str = '%s_%s_%s' % ( |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 """ | 201 """ |
199 pass | 202 pass |
200 | 203 |
201 def GetPlayerHTMLFileName(self): | 204 def GetPlayerHTMLFileName(self): |
202 """A method to get the player HTML file name.""" | 205 """A method to get the player HTML file name.""" |
203 return 'media_playback.html' | 206 return 'media_playback.html' |
204 | 207 |
205 | 208 |
206 if __name__ == '__main__': | 209 if __name__ == '__main__': |
207 pyauto_media.Main() | 210 pyauto_media.Main() |
OLD | NEW |