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 import logging | 6 import logging |
7 import os | 7 import os |
8 import time | 8 import time |
9 | 9 |
10 import pyauto_functional | 10 import pyauto_functional |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 windex=windex)) | 75 windex=windex)) |
76 | 76 |
77 def _HandleInfobars(self): | 77 def _HandleInfobars(self): |
78 """Manage infobars that come up during the test.""" | 78 """Manage infobars that come up during the test.""" |
79 def _HandleNetflixInfobar(): | 79 def _HandleNetflixInfobar(): |
80 tab_info = self._pyauto.GetBrowserInfo()['windows'][0]['tabs'][0] | 80 tab_info = self._pyauto.GetBrowserInfo()['windows'][0]['tabs'][0] |
81 infobars = tab_info['infobars'] | 81 infobars = tab_info['infobars'] |
82 index = 0 | 82 index = 0 |
83 for infobar in infobars: | 83 for infobar in infobars: |
84 if 'netflix' in infobar['text']: | 84 if 'netflix' in infobar['text']: |
| 85 # After storage infobar pops up, clicking the Ok button immediately |
| 86 # returns the Storage error on faster machines like Stumpy/Lumpy so |
| 87 # adding a delay of 1 second here. |
| 88 time.sleep(1) |
85 self._pyauto.PerformActionOnInfobar('accept', infobar_index=index) | 89 self._pyauto.PerformActionOnInfobar('accept', infobar_index=index) |
86 return True | 90 return True |
87 index = index + 1 | 91 index = index + 1 |
88 return False | 92 return False |
89 self._pyauto.assertTrue(self._pyauto.WaitUntil(_HandleNetflixInfobar), | 93 self._pyauto.assertTrue(self._pyauto.WaitUntil(_HandleNetflixInfobar), |
90 msg='Netflix infobar did not show up') | 94 msg='Netflix infobar did not show up') |
91 | 95 |
92 def CurrentPlaybackTime(self): | 96 def CurrentPlaybackTime(self): |
93 """Returns the current playback time in seconds.""" | 97 """Returns the current playback time in seconds.""" |
94 time = self._pyauto.ExecuteJavascript(""" | 98 time = self._pyauto.ExecuteJavascript(""" |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 self.SignOut() | 222 self.SignOut() |
219 self.Logout() | 223 self.Logout() |
220 pyauto.PyUITest.tearDown(self) | 224 pyauto.PyUITest.tearDown(self) |
221 | 225 |
222 def testGuestMode(self): | 226 def testGuestMode(self): |
223 """Test that Netflix doesn't play in guest mode login.""" | 227 """Test that Netflix doesn't play in guest mode login.""" |
224 self.LoginAndStartPlaying() | 228 self.LoginAndStartPlaying() |
225 self.CheckNetflixPlaying( | 229 self.CheckNetflixPlaying( |
226 self.IS_GUEST_MODE_ERROR, | 230 self.IS_GUEST_MODE_ERROR, |
227 'Netflix player did not return a Guest mode error.') | 231 'Netflix player did not return a Guest mode error.') |
228 # Page contents parsing doesn't work : crosbug.com/27977 | 232 self.assertTrue('Guest Mode Unsupported' in self.GetTabContents(), |
229 # Uncomment the following line when that bug is fixed. | 233 msg='Guest Mode error is not found on the page.') |
230 # self.assertTrue('Guest Mode Unsupported' in self.GetTabContents()) | |
231 | 234 |
232 | 235 |
233 if __name__ == '__main__': | 236 if __name__ == '__main__': |
234 pyauto_functional.Main() | 237 pyauto_functional.Main() |
OLD | NEW |