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 os | 6 import os |
7 import subprocess | 7 import subprocess |
8 import time | 8 import time |
9 import unittest | 9 import unittest |
10 | 10 |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 | 51 |
52 self._server_process = subprocess.Popen(binary_path) | 52 self._server_process = subprocess.Popen(binary_path) |
53 | 53 |
54 def tearDown(self): | 54 def tearDown(self): |
55 self._server_process.kill() | 55 self._server_process.kill() |
56 | 56 |
57 pyauto.PyUITest.tearDown(self) | 57 pyauto.PyUITest.tearDown(self) |
58 self.assertEquals('', self.CheckErrorsAndCrashes()) | 58 self.assertEquals('', self.CheckErrorsAndCrashes()) |
59 | 59 |
60 def _SimpleWebRtcCall(self, test_page): | 60 def _SimpleWebRtcCall(self, test_page): |
61 """Tests we can call and hang up with WebRTC using ROAP/JSEP. | 61 """Tests we can call and hang up with WebRTC. |
62 | 62 |
63 This test exercises pretty much the whole happy-case for the WebRTC | 63 This test exercises pretty much the whole happy-case for the WebRTC |
64 JavaScript API. Currently, it exercises a normal call setup using the API | 64 JavaScript API. Currently, it exercises a normal call setup using the API |
65 defined at http://dev.w3.org/2011/webrtc/editor/webrtc.html. The API is | 65 defined at http://dev.w3.org/2011/webrtc/editor/webrtc.html. The API is |
66 still evolving. | 66 still evolving. |
67 | 67 |
68 The test will load the supplied HTML file, which in turn will load different | 68 The test will load the supplied HTML file, which in turn will load different |
69 javascript files depending on if we are running ROAP or JSEP. | 69 javascript files depending on which version of the signaling protocol |
| 70 we are running. |
70 The supplied HTML file will be loaded in two tabs and tell the web | 71 The supplied HTML file will be loaded in two tabs and tell the web |
71 pages to start up WebRTC, which will acquire video and audio devices on the | 72 pages to start up WebRTC, which will acquire video and audio devices on the |
72 system. This will launch a dialog in Chrome which we click past using the | 73 system. This will launch a dialog in Chrome which we click past using the |
73 automation controller. Then, we will order both tabs to connect the server, | 74 automation controller. Then, we will order both tabs to connect the server, |
74 which will make the two tabs aware of each other. Once that is done we order | 75 which will make the two tabs aware of each other. Once that is done we order |
75 one tab to call the other. | 76 one tab to call the other. |
76 | 77 |
77 We make sure that the javascript tells us that the call succeeded, lets it | 78 We make sure that the javascript tells us that the call succeeded, lets it |
78 run for a while and try to hang up the call after that. We verify video is | 79 run for a while and try to hang up the call after that. We verify video is |
79 playing by using the video detector. | 80 playing by using the video detector. |
(...skipping 17 matching lines...) Expand all Loading... |
97 self._HangUp(from_tab_with_index=0) | 98 self._HangUp(from_tab_with_index=0) |
98 self._VerifyHungUp(tab_index=1) | 99 self._VerifyHungUp(tab_index=1) |
99 | 100 |
100 self._Disconnect(tab_index=0) | 101 self._Disconnect(tab_index=0) |
101 self._Disconnect(tab_index=1) | 102 self._Disconnect(tab_index=1) |
102 | 103 |
103 # Ensure we didn't miss any errors. | 104 # Ensure we didn't miss any errors. |
104 self._AssertNoFailures(tab_index=0) | 105 self._AssertNoFailures(tab_index=0) |
105 self._AssertNoFailures(tab_index=1) | 106 self._AssertNoFailures(tab_index=1) |
106 | 107 |
107 def testSimpleWebRtcRoapCall(self): | |
108 self._SimpleWebRtcCall('webrtc_roap_test.html') | |
109 | |
110 def testSimpleWebRtcJsepCall(self): | 108 def testSimpleWebRtcJsepCall(self): |
111 self._SimpleWebRtcCall('webrtc_jsep_test.html') | 109 self._SimpleWebRtcCall('webrtc_jsep_test.html') |
112 | 110 |
113 def testLocalPreview(self): | 111 def testLocalPreview(self): |
114 """Brings up a local preview and ensures video is playing. | 112 """Brings up a local preview and ensures video is playing. |
115 | 113 |
116 This test will launch a window with a single tab and run a getUserMedia call | 114 This test will launch a window with a single tab and run a getUserMedia call |
117 which will give us access to the webcam and microphone. Then the javascript | 115 which will give us access to the webcam and microphone. Then the javascript |
118 code will hook up the webcam data to the local_view video tag. We will | 116 code will hook up the webcam data to the local_view video tag. We will |
119 detect video in that tag using the video detector, and if we see video | 117 detect video in that tag using the video detector, and if we see video |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
208 self.assertTrue(video_playing, | 206 self.assertTrue(video_playing, |
209 msg='Timed out while trying to detect video.') | 207 msg='Timed out while trying to detect video.') |
210 | 208 |
211 def _AssertNoFailures(self, tab_index): | 209 def _AssertNoFailures(self, tab_index): |
212 self.assertEquals('ok-no-errors', self.ExecuteJavascript( | 210 self.assertEquals('ok-no-errors', self.ExecuteJavascript( |
213 'getAnyTestFailures()', tab_index=tab_index)) | 211 'getAnyTestFailures()', tab_index=tab_index)) |
214 | 212 |
215 | 213 |
216 if __name__ == '__main__': | 214 if __name__ == '__main__': |
217 pyauto_functional.Main() | 215 pyauto_functional.Main() |
OLD | NEW |