OLD | NEW |
---|---|
1 #!/usr/bin/env python | 1 #!/usr/bin/env 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 import re | 6 import re |
7 import time | 7 import time |
8 | 8 |
9 import pyauto_functional | 9 import pyauto_functional |
10 import pyauto | 10 import pyauto |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
114 ytplayer.pauseVideo(); | 114 ytplayer.pauseVideo(); |
115 window.domAutomationController.send(''); | 115 window.domAutomationController.send(''); |
116 """) | 116 """) |
117 | 117 |
118 def AssertPlayingState(self): | 118 def AssertPlayingState(self): |
119 """Assert player's playing state.""" | 119 """Assert player's playing state.""" |
120 self._pyauto.assertTrue(self._pyauto.WaitUntil(self._pyauto.GetPlayerState, | 120 self._pyauto.assertTrue(self._pyauto.WaitUntil(self._pyauto.GetPlayerState, |
121 expect_retval=self._pyauto.is_playing), | 121 expect_retval=self._pyauto.is_playing), |
122 msg='Player did not enter the playing state') | 122 msg='Player did not enter the playing state') |
123 | 123 |
124 def PlayVideoAndAssert(self): | 124 def PlayVideoAndAssert(self, youtube_video='zuzaxlddWbk'): |
125 """Start video and assert the playing state.""" | 125 """Start video and assert the playing state. |
126 | |
127 By default test uses http://www.youtube.com/watch?v=zuzaxlddWbki . | |
dennis_jeffrey
2011/12/01 02:44:56
remove the space right before the '.' at the end o
rohitbm
2011/12/03 02:20:58
Done.
| |
128 """ | |
dennis_jeffrey
2011/12/01 02:44:56
Add an "Args:" section to this docstring:
Args:
rohitbm
2011/12/03 02:20:58
Done.
| |
126 self._pyauto.assertTrue(self._pyauto.IsFlashPluginEnabled(), | 129 self._pyauto.assertTrue(self._pyauto.IsFlashPluginEnabled(), |
127 msg='From here Flash plugin is disabled or not available') | 130 msg='From here Flash plugin is disabled or not available') |
128 url = self._pyauto.GetHttpURLForDataPath('media', 'youtube.html') | 131 url = self._pyauto.GetHttpURLForDataPath('media', |
132 'youtube.html?video=' + youtube_video) | |
dennis_jeffrey
2011/12/01 02:44:56
move both parameters to the second line:
url = se
rohitbm
2011/12/03 02:20:58
Done.
| |
129 self._pyauto.NavigateToURL(url) | 133 self._pyauto.NavigateToURL(url) |
130 self._pyauto.assertTrue(self._pyauto.WaitUntilPlayerReady(), | 134 self._pyauto.assertTrue(self._pyauto.WaitUntilPlayerReady(), |
131 msg='Failed to load YouTube player') | 135 msg='Failed to load YouTube player') |
132 self._pyauto.PlayVideo() | 136 self._pyauto.PlayVideo() |
133 self._pyauto.AssertPlayingState() | 137 self._pyauto.AssertPlayingState() |
134 | 138 |
135 | 139 |
136 class YoutubeTest(pyauto.PyUITest, YoutubeTestHelper): | 140 class YoutubeTest(pyauto.PyUITest, YoutubeTestHelper): |
137 """Test case for Youtube videos.""" | 141 """Test case for Youtube videos.""" |
138 | 142 |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
198 break | 202 break |
199 loaded_bytes = self.GetVideoLoadedBytes() | 203 loaded_bytes = self.GetVideoLoadedBytes() |
200 self.assertTrue(prev_loaded_bytes <= loaded_bytes) | 204 self.assertTrue(prev_loaded_bytes <= loaded_bytes) |
201 prev_loaded_bytes = loaded_bytes | 205 prev_loaded_bytes = loaded_bytes |
202 # Give some time to load a video | 206 # Give some time to load a video |
203 time.sleep(1) | 207 time.sleep(1) |
204 | 208 |
205 | 209 |
206 if __name__ == '__main__': | 210 if __name__ == '__main__': |
207 pyauto_functional.Main() | 211 pyauto_functional.Main() |
OLD | NEW |