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

Side by Side Diff: chrome/test/functional/webrtc_apprtc_call.py

Issue 11648013: Added tab-to-tab apprtc call. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Added clarifying comment. Created 7 years, 11 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 random
7
6 # Note: pyauto_functional must come before pyauto. 8 # Note: pyauto_functional must come before pyauto.
7 import pyauto_functional 9 import pyauto_functional
8 import pyauto 10 import pyauto
9 import webrtc_test_base 11 import webrtc_test_base
10 12
11 13
12 class WebrtcApprtcCallTest(webrtc_test_base.WebrtcTestBase): 14 class WebrtcApprtcCallTest(webrtc_test_base.WebrtcTestBase):
13 """Tests calling apprtc.appspot.com and setting up a call. 15 """Tests calling apprtc.appspot.com and setting up a call.
14 16
15 Prerequisites: This test case must run on a machine with a webcam, either 17 Prerequisites: This test case must run on a machine with a webcam, either
16 fake or real, and with some kind of audio device. The machine must have access 18 fake or real, and with some kind of audio device. The machine must have access
17 to the public Internet. 19 to the public Internet.
18 20
19 This should be considered an integration test: test failures could mean 21 This should be considered an integration test: test failures could mean
20 that the AppRTC reference is broken, that WebRTC is broken, or both. 22 that the AppRTC reference is broken, that WebRTC is broken, or both.
21 """ 23 """
22 24
23 def tearDown(self): 25 def tearDown(self):
24 pyauto.PyUITest.tearDown(self) 26 pyauto.PyUITest.tearDown(self)
25 self.assertEquals('', self.CheckErrorsAndCrashes(), 27 self.assertEquals('', self.CheckErrorsAndCrashes(),
26 'Chrome crashed or hit a critical error during test.') 28 'Chrome crashed or hit a critical error during test.')
27 29
28 def testApprtcLoopbackVideoAudioCall(self): 30 def testApprtcLoopbackCall(self):
29 self.NavigateToURL('http://apprtc.appspot.com/?debug=loopback') 31 self.NavigateToURL('http://apprtc.appspot.com/?debug=loopback')
30 self.WaitForInfobarCount(1, tab_index=0) 32 self.WaitForInfobarCount(1, tab_index=0)
31 self.PerformActionOnInfobar('accept', infobar_index=0, tab_index=0) 33 self.PerformActionOnInfobar('accept', infobar_index=0, tab_index=0)
32 34
33 self._WaitForCallEstablishment(tab_index=0) 35 self._WaitForCallEstablishment(tab_index=0)
34 36
37 def testApprtcTabToTabCall(self):
38 # Randomize the call session id. If we would use the same id we would risk
39 # getting problems with hung calls and lingering state in AppRTC.
40 random_call_id = 'pyauto%d' % random.randint(0, 65536)
41 apprtc_url = 'http://apprtc.appspot.com/?r=%s' % random_call_id
42
43 self.NavigateToURL(apprtc_url)
44 self.AppendTab(pyauto.GURL(apprtc_url))
45
46 self.WaitForInfobarCount(1, tab_index=0)
47 self.WaitForInfobarCount(1, tab_index=1)
48
49 self.PerformActionOnInfobar('accept', infobar_index=0, tab_index=0)
50 self.PerformActionOnInfobar('accept', infobar_index=0, tab_index=1)
51
52 self._WaitForCallEstablishment(tab_index=0)
53 self._WaitForCallEstablishment(tab_index=1)
54
35 def _WaitForCallEstablishment(self, tab_index): 55 def _WaitForCallEstablishment(self, tab_index):
36 # AppRTC will set opacity to 1 for remote video when the call is up. 56 # AppRTC will set opacity to 1 for remote video when the call is up.
37 video_playing = self.WaitUntil( 57 video_playing = self.WaitUntil(
38 function=lambda: self.GetDOMValue('remoteVideo.style.opacity', 58 function=lambda: self.GetDOMValue('remoteVideo.style.opacity',
39 tab_index=tab_index), 59 tab_index=tab_index),
40 expect_retval='1') 60 expect_retval='1')
41 self.assertTrue(video_playing, 61 self.assertTrue(video_playing,
42 msg=('Timed out while waiting for ' 62 msg=('Timed out while waiting for '
43 'remoteVideo.style.opacity to return 1.')) 63 'remoteVideo.style.opacity to return 1.'))
44 64
45 65
46 if __name__ == '__main__': 66 if __name__ == '__main__':
47 pyauto_functional.Main() 67 pyauto_functional.Main()
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698