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

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

Issue 7322015: Add another test terminate condition in media perf test. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Minor doc change. Created 9 years, 5 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 """ 119 """
120 test_scenarios = [] 120 test_scenarios = []
121 rows = csv.reader(open(test_scenario_filename)) 121 rows = csv.reader(open(test_scenario_filename))
122 for row in rows: 122 for row in rows:
123 test_scenarios.append('|'.join(row)) 123 test_scenarios.append('|'.join(row))
124 return test_scenarios 124 return test_scenarios
125 125
126 def ExecuteTest(self): 126 def ExecuteTest(self):
127 """Test HTML5 Media Tag.""" 127 """Test HTML5 Media Tag."""
128 128
129 def _VideoEnded(): 129 def _VideoEndedOrErrorOut():
130 """Determine if the video ended. 130 """Determine if the video ended.
dennis_jeffrey 2011/07/07 19:45:21 add something like this: '...or there was an error
imasaki1 2011/07/07 20:42:05 Done.
131 131
132 When the video has finished playing, its title is updated by player.html. 132 When the video has finished playing or there is error in playing the
133 video (e.g, the video cannot be found), its title is updated by
134 player.html.
133 135
134 Returns: 136 Returns:
135 True if the video has ended. 137 True if the video has ended or error out.
dennis_jeffrey 2011/07/07 19:45:21 'error out' --> 'an error occurred'
imasaki1 2011/07/07 20:42:05 Done.
136 """ 138 """
137 return self.GetDOMValue('document.title').strip() == 'END' 139 return self.GetDOMValue('document.title').strip() == 'END' or (
140 'ERROR' in self.GetDOMValue('document.title'))
dennis_jeffrey 2011/07/07 19:45:21 Recommend using parens like this: return (self.Ge
imasaki1 2011/07/07 20:42:05 Done.
138 141
139 self.PreAllRunsProcess() 142 self.PreAllRunsProcess()
140 for run_counter in range(self.number_of_runs): 143 for run_counter in range(self.number_of_runs):
141 self.run_counter = run_counter 144 self.run_counter = run_counter
142 self.PreEachRunProcess(run_counter) 145 self.PreEachRunProcess(run_counter)
143 url = self.url 146 url = self.url
144 if self.whole_test_scenarios: 147 if self.whole_test_scenarios:
145 url += '&actions=' + self.whole_test_scenarios[run_counter] 148 url += '&actions=' + self.whole_test_scenarios[run_counter]
146 logging.debug('Navigate to %s', url) 149 logging.debug('Navigate to %s', url)
147 self.NavigateToURL(url) 150 self.NavigateToURL(url)
148 self.WaitUntil(lambda: _VideoEnded(), 151 self.WaitUntil(lambda: _VideoEndedOrErrorOut(),
149 self.TIMEOUT) 152 self.TIMEOUT)
150 self.PostEachRunProcess(run_counter) 153 self.PostEachRunProcess(run_counter)
151 154
152 self.PostAllRunsProcess() 155 self.PostAllRunsProcess()
153 156
154 # A list of methods that should be overridden in the subclass. 157 # A list of methods that should be overridden in the subclass.
155 # 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
156 # overridden. 159 # overridden.
157 160
158 def PreAllRunsProcess(self): 161 def PreAllRunsProcess(self):
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 """ 218 """
216 pass 219 pass
217 220
218 def GetPlayerHTMLFileName(self): 221 def GetPlayerHTMLFileName(self):
219 """A method to get the player HTML file name.""" 222 """A method to get the player HTML file name."""
220 return 'media_playback.html' 223 return 'media_playback.html'
221 224
222 225
223 if __name__ == '__main__': 226 if __name__ == '__main__':
224 pyauto_media.Main() 227 pyauto_media.Main()
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698