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