Index: chrome/test/functional/webrtc_brutality_test.py |
diff --git a/chrome/test/functional/webrtc_brutality_test.py b/chrome/test/functional/webrtc_brutality_test.py |
new file mode 100755 |
index 0000000000000000000000000000000000000000..61b7a1716e07e1aebe2ee693b95a39b34377ee24 |
--- /dev/null |
+++ b/chrome/test/functional/webrtc_brutality_test.py |
@@ -0,0 +1,79 @@ |
+#!/usr/bin/env python |
+# Copyright (c) 2012 The Chromium Authors. All rights reserved. |
+# Use of this source code is governed by a BSD-style license that can be |
+# 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.
|
+import pyauto_functional |
+import webrtc_test_base |
+ |
Nirnimesh
2012/08/03 18:32:13
need another blank line here
phoglund_chromium
2012/08/06 15:02:18
Done.
|
+class WebrtcBrutalityTest(webrtc_test_base.WebrtcTestBase): |
+ """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.
|
+ |
+ def testReloadsAfterGetUserMedia(self): |
+ """Tests how we deal with reloads. |
+ |
+ This test will quickly reload the page after running getUserMedia, which |
+ will remove the pending request. This crashed the browser before the fix |
+ for crbug.com/135043. |
+ |
+ The test will make repeated getUserMedia requests with refreshes between |
+ them. Sometimes it will click past the bar and then refresh. |
+ """ |
+ url = self.GetFileURLForDataPath('webrtc', 'webrtc_jsep_test.html') |
+ self.NavigateToURL(url) |
+ |
+ 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.
|
+ for i in range(1, 100): |
+ if i % 10 == 0: |
+ self.GetUserMedia(tab_index=0, action='allow') |
+ else: |
+ self._GetUserMediaWithoutTakingAction(tab_index=0) |
+ tab.Reload() |
+ |
+ def testRepeatedGetUserMediaRequests(self): |
+ """Tests how we deal with lots of consecutive getUserMedia requests. |
+ |
+ The test will alternate unanswered requests with requests that get answered. |
+ """ |
+ url = self.GetFileURLForDataPath('webrtc', 'webrtc_jsep_test.html') |
+ self.NavigateToURL(url) |
+ |
+ for i in range(1, 100): |
+ if i % 10 == 0: |
+ self.GetUserMedia(tab_index=0, action='allow') |
+ else: |
+ self._GetUserMediaWithoutTakingAction(tab_index=0) |
+ |
+ def testSuccessfulGetUserMediaAndThenReload(self): |
+ """Waits for WebRTC to respond, and immediately reloads the tab.""" |
+ url = self.GetFileURLForDataPath('webrtc', 'webrtc_jsep_test.html') |
+ self.NavigateToURL(url) |
+ |
+ tab = self.GetBrowserWindow(0).GetTab(0) |
+ self.GetUserMedia(tab_index=0, action='allow') |
+ tab.Reload() |
Nirnimesh
2012/08/03 18:32:13
ditto
phoglund_chromium
2012/08/06 15:02:18
Done.
|
+ |
+ def testClosingTabAfterGetUserMedia(self): |
+ """Tests closing the tab right after a getUserMedia call.""" |
+ url = self.GetFileURLForDataPath('webrtc', 'webrtc_jsep_test.html') |
+ self.NavigateToURL(url) |
+ |
+ 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
|
+ self.GetUserMedia(tab_index=0, action='allow') |
+ tab.Close() |
+ |
+ def testSuccessfulGetUserMediaAndThenClose(self): |
+ """Waits for WebRTC to respond, and closes the tab.""" |
+ url = self.GetFileURLForDataPath('webrtc', 'webrtc_jsep_test.html') |
+ self.NavigateToURL(url) |
+ |
+ tab = self.GetBrowserWindow(0).GetTab(0) |
+ self.GetUserMedia(tab_index=0, action='allow') |
+ tab.Close() |
+ |
+ def _GetUserMediaWithoutTakingAction(self, tab_index): |
+ self.assertEquals('ok-requested', self.ExecuteJavascript( |
+ 'getUserMedia(true, true)', tab_index=0)) |
Nirnimesh
2012/08/03 18:32:13
indent by 2 more spaces
|
+ |
+ |
+if __name__ == '__main__': |
+ pyauto_functional.Main() |