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 | 8 |
9 import pyauto | 9 import pyauto |
10 | 10 |
(...skipping 15 matching lines...) Expand all Loading... |
26 | 26 |
27 Args: | 27 Args: |
28 tab_index: The tab to request user media on. | 28 tab_index: The tab to request user media on. |
29 action: The action to take on the info bar. Can be 'allow', 'deny' or | 29 action: The action to take on the info bar. Can be 'allow', 'deny' or |
30 'dismiss'. | 30 'dismiss'. |
31 | 31 |
32 Returns: | 32 Returns: |
33 A string as specified by the getUserMedia javascript function. | 33 A string as specified by the getUserMedia javascript function. |
34 """ | 34 """ |
35 self.assertEquals('ok-requested', self.ExecuteJavascript( | 35 self.assertEquals('ok-requested', self.ExecuteJavascript( |
36 'getUserMedia(true, true, {})', tab_index=tab_index)) | 36 'getUserMedia(true, true, "{}")', tab_index=tab_index)) |
37 | 37 |
38 self.WaitForInfobarCount(1, tab_index=tab_index) | 38 self.WaitForInfobarCount(1, tab_index=tab_index) |
39 self.PerformActionOnInfobar(action, infobar_index=0, tab_index=tab_index) | 39 self.PerformActionOnInfobar(action, infobar_index=0, tab_index=tab_index) |
40 self.WaitForGetUserMediaResult(tab_index=0) | 40 self.WaitForGetUserMediaResult(tab_index=0) |
41 | 41 |
42 result = self.GetUserMediaResult(tab_index=0) | 42 result = self.GetUserMediaResult(tab_index=0) |
43 self.AssertNoFailures(tab_index) | 43 self.AssertNoFailures(tab_index) |
44 return result | 44 return result |
45 | 45 |
46 def WaitForGetUserMediaResult(self, tab_index): | 46 def WaitForGetUserMediaResult(self, tab_index): |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 'Could not locate peerconnection_server. Have you built the ' | 143 'Could not locate peerconnection_server. Have you built the ' |
144 'peerconnection_server target? We expect to have a ' | 144 'peerconnection_server target? We expect to have a ' |
145 'peerconnection_server binary next to the chrome binary.') | 145 'peerconnection_server binary next to the chrome binary.') |
146 | 146 |
147 self._server_process = subprocess.Popen(binary_path) | 147 self._server_process = subprocess.Popen(binary_path) |
148 | 148 |
149 def StopPeerConnectionServer(self): | 149 def StopPeerConnectionServer(self): |
150 """Stops the peerconnection_server.""" | 150 """Stops the peerconnection_server.""" |
151 assert self._server_process | 151 assert self._server_process |
152 self._server_process.kill() | 152 self._server_process.kill() |
OLD | NEW |