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 platform | 7 import platform |
8 import re | 8 import re |
9 import subprocess | 9 import subprocess |
10 | 10 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 'dismiss'. | 44 'dismiss'. |
45 request_video: Whether to request video. | 45 request_video: Whether to request video. |
46 request_audio: Whether to request audio. | 46 request_audio: Whether to request audio. |
47 | 47 |
48 Returns: | 48 Returns: |
49 A string as specified by the getUserMedia javascript function. | 49 A string as specified by the getUserMedia javascript function. |
50 """ | 50 """ |
51 constraints = '{ video: %s, audio: %s }' % (str(request_video).lower(), | 51 constraints = '{ video: %s, audio: %s }' % (str(request_video).lower(), |
52 str(request_audio).lower()) | 52 str(request_audio).lower()) |
53 self.assertEquals('ok-requested', self.ExecuteJavascript( | 53 self.assertEquals('ok-requested', self.ExecuteJavascript( |
54 'doGetUserMedia("%s")' % constraints, tab_index=tab_index)) | 54 'getUserMedia("%s")' % constraints, tab_index=tab_index)) |
55 | 55 |
56 self.WaitForInfobarCount(1, tab_index=tab_index) | 56 self.WaitForInfobarCount(1, tab_index=tab_index) |
57 self.PerformActionOnInfobar(action, infobar_index=0, tab_index=tab_index) | 57 self.PerformActionOnInfobar(action, infobar_index=0, tab_index=tab_index) |
58 self.WaitForGetUserMediaResult(tab_index=0) | 58 self.WaitForGetUserMediaResult(tab_index=0) |
59 | 59 |
60 result = self.GetUserMediaResult(tab_index=0) | 60 result = self.GetUserMediaResult(tab_index=0) |
61 self.AssertNoFailures(tab_index) | 61 self.AssertNoFailures(tab_index) |
62 return result | 62 return result |
63 | 63 |
64 def WaitForGetUserMediaResult(self, tab_index): | 64 def WaitForGetUserMediaResult(self, tab_index): |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 'Could not locate peerconnection_server. Have you built the ' | 206 'Could not locate peerconnection_server. Have you built the ' |
207 'peerconnection_server target? We expect to have a ' | 207 'peerconnection_server target? We expect to have a ' |
208 'peerconnection_server binary next to the chrome binary.') | 208 'peerconnection_server binary next to the chrome binary.') |
209 | 209 |
210 self._server_process = subprocess.Popen(binary_path) | 210 self._server_process = subprocess.Popen(binary_path) |
211 | 211 |
212 def StopPeerConnectionServer(self): | 212 def StopPeerConnectionServer(self): |
213 """Stops the peerconnection_server.""" | 213 """Stops the peerconnection_server.""" |
214 assert self._server_process | 214 assert self._server_process |
215 self._server_process.kill() | 215 self._server_process.kill() |
OLD | NEW |