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

Unified Diff: chrome/test/functional/webrtc_test_base.py

Issue 10830159: Added a new test which aims to be really, really mean to WebRTC. Hopefully this will cover some cra… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Review updates. Created 8 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/test/functional/webrtc_call.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/functional/webrtc_test_base.py
diff --git a/chrome/test/functional/webrtc_test_base.py b/chrome/test/functional/webrtc_test_base.py
index 4623aa2308eff3908292d6e18e8d86e7cba56e76..999c821a44a6dad56fb4dcaa4b015bc48e5a9071 100755
--- a/chrome/test/functional/webrtc_test_base.py
+++ b/chrome/test/functional/webrtc_test_base.py
@@ -9,6 +9,28 @@ import pyauto
class WebrtcTestBase(pyauto.PyUITest):
"""This base class provides helpers for getUserMedia calls."""
+ def GetUserMedia(self, tab_index, action='allow'):
+ """Acquires webcam or mic for one tab and returns the result.
+
+ Args:
+ tab_index: The tab to request user media on.
+ action: The action to take on the info bar. Can be 'allow', 'deny' or
+ 'dismiss'.
+
+ Returns:
+ A string as specified by the getUserMedia javascript function.
+ """
+ self.assertEquals('ok-requested', self.ExecuteJavascript(
+ 'getUserMedia(true, true)', tab_index=tab_index))
+
+ self.WaitForInfobarCount(1, tab_index=tab_index)
+ self.PerformActionOnInfobar(action, infobar_index=0, tab_index=tab_index)
+ self.WaitForGetUserMediaResult(tab_index=0)
+
+ result = self.GetUserMediaResult(tab_index=0)
+ self.AssertNoFailures(tab_index)
+ return result
+
def WaitForGetUserMediaResult(self, tab_index):
"""Waits until WebRTC has responded to a getUserMedia query.
@@ -32,4 +54,13 @@ class WebrtcTestBase(pyauto.PyUITest):
Specified in obtainGetUserMediaResult() in getusermedia.js.
"""
return self.ExecuteJavascript(
- 'obtainGetUserMediaResult()', tab_index=tab_index)
+ 'obtainGetUserMediaResult()', tab_index=tab_index)
+
+ def AssertNoFailures(self, tab_index):
+ """Ensures the javascript hasn't registered any asynchronous errors.
+
+ Args:
+ tab_index: The tab to check.
+ """
+ self.assertEquals('ok-no-errors', self.ExecuteJavascript(
+ 'getAnyTestFailures()', tab_index=tab_index))
« no previous file with comments | « chrome/test/functional/webrtc_call.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698