Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 #!/usr/bin/env python | |
| 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 | |
| 4 # found in the LICENSE file. | |
|
Nirnimesh
2012/08/03 18:32:13
Leave a blank line after this
phoglund_chromium
2012/08/06 15:02:18
Done.
| |
| 5 import pyauto_functional | |
| 6 import webrtc_test_base | |
| 7 | |
|
Nirnimesh
2012/08/03 18:32:13
need another blank line here
phoglund_chromium
2012/08/06 15:02:18
Done.
| |
| 8 class WebrtcBrutalityTest(webrtc_test_base.WebrtcTestBase): | |
| 9 """This test class tests how WebRTC deals with inconvenient reloads, etc.""" | |
|
Nirnimesh
2012/08/03 18:32:13
Remove "This test class"
It's redundant
phoglund_chromium
2012/08/06 15:02:18
Done.
| |
| 10 | |
| 11 def testReloadsAfterGetUserMedia(self): | |
| 12 """Tests how we deal with reloads. | |
| 13 | |
| 14 This test will quickly reload the page after running getUserMedia, which | |
| 15 will remove the pending request. This crashed the browser before the fix | |
| 16 for crbug.com/135043. | |
| 17 | |
| 18 The test will make repeated getUserMedia requests with refreshes between | |
| 19 them. Sometimes it will click past the bar and then refresh. | |
| 20 """ | |
| 21 url = self.GetFileURLForDataPath('webrtc', 'webrtc_jsep_test.html') | |
| 22 self.NavigateToURL(url) | |
| 23 | |
| 24 tab = self.GetBrowserWindow(0).GetTab(0) | |
|
Nirnimesh
2012/08/03 18:32:13
This format has been deprecated. Use the ReloadTab
phoglund_chromium
2012/08/06 15:02:18
Done.
| |
| 25 for i in range(1, 100): | |
| 26 if i % 10 == 0: | |
| 27 self.GetUserMedia(tab_index=0, action='allow') | |
| 28 else: | |
| 29 self._GetUserMediaWithoutTakingAction(tab_index=0) | |
| 30 tab.Reload() | |
| 31 | |
| 32 def testRepeatedGetUserMediaRequests(self): | |
| 33 """Tests how we deal with lots of consecutive getUserMedia requests. | |
| 34 | |
| 35 The test will alternate unanswered requests with requests that get answered. | |
| 36 """ | |
| 37 url = self.GetFileURLForDataPath('webrtc', 'webrtc_jsep_test.html') | |
| 38 self.NavigateToURL(url) | |
| 39 | |
| 40 for i in range(1, 100): | |
| 41 if i % 10 == 0: | |
| 42 self.GetUserMedia(tab_index=0, action='allow') | |
| 43 else: | |
| 44 self._GetUserMediaWithoutTakingAction(tab_index=0) | |
| 45 | |
| 46 def testSuccessfulGetUserMediaAndThenReload(self): | |
| 47 """Waits for WebRTC to respond, and immediately reloads the tab.""" | |
| 48 url = self.GetFileURLForDataPath('webrtc', 'webrtc_jsep_test.html') | |
| 49 self.NavigateToURL(url) | |
| 50 | |
| 51 tab = self.GetBrowserWindow(0).GetTab(0) | |
| 52 self.GetUserMedia(tab_index=0, action='allow') | |
| 53 tab.Reload() | |
|
Nirnimesh
2012/08/03 18:32:13
ditto
phoglund_chromium
2012/08/06 15:02:18
Done.
| |
| 54 | |
| 55 def testClosingTabAfterGetUserMedia(self): | |
| 56 """Tests closing the tab right after a getUserMedia call.""" | |
| 57 url = self.GetFileURLForDataPath('webrtc', 'webrtc_jsep_test.html') | |
| 58 self.NavigateToURL(url) | |
| 59 | |
| 60 tab = self.GetBrowserWindow(0).GetTab(0) | |
|
phoglund_chromium
2012/08/06 15:02:18
I need to do this for Close() though, right?
Nirnimesh
2012/08/06 20:52:11
For now, yes. Craig is in the middle of replacing
| |
| 61 self.GetUserMedia(tab_index=0, action='allow') | |
| 62 tab.Close() | |
| 63 | |
| 64 def testSuccessfulGetUserMediaAndThenClose(self): | |
| 65 """Waits for WebRTC to respond, and closes the tab.""" | |
| 66 url = self.GetFileURLForDataPath('webrtc', 'webrtc_jsep_test.html') | |
| 67 self.NavigateToURL(url) | |
| 68 | |
| 69 tab = self.GetBrowserWindow(0).GetTab(0) | |
| 70 self.GetUserMedia(tab_index=0, action='allow') | |
| 71 tab.Close() | |
| 72 | |
| 73 def _GetUserMediaWithoutTakingAction(self, tab_index): | |
| 74 self.assertEquals('ok-requested', self.ExecuteJavascript( | |
| 75 'getUserMedia(true, true)', tab_index=0)) | |
|
Nirnimesh
2012/08/03 18:32:13
indent by 2 more spaces
| |
| 76 | |
| 77 | |
| 78 if __name__ == '__main__': | |
| 79 pyauto_functional.Main() | |
| OLD | NEW |