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 pyauto_functional | 6 import pyauto_functional |
7 import pyauto | 7 import pyauto |
| 8 import webrtc_test_base |
8 | 9 |
9 | 10 |
10 class MediaStreamInfobarTest(pyauto.PyUITest): | 11 class MediaStreamInfobarTest(webrtc_test_base.WebrtcTestBase): |
11 """Performs basic tests on the media stream infobar. | 12 """Performs basic tests on the media stream infobar. |
12 | 13 |
13 This infobar is used to grant or deny access to WebRTC capabilities for a | 14 This infobar is used to grant or deny access to WebRTC capabilities for a |
14 webpage. If a page calls the getUserMedia function the infobar will ask the | 15 webpage. If a page calls the getUserMedia function the infobar will ask the |
15 user if it is OK for the webpage to use the webcam or microphone on the user's | 16 user if it is OK for the webpage to use the webcam or microphone on the user's |
16 machine. These tests ensure that the infobar works as intended. | 17 machine. These tests ensure that the infobar works as intended. |
17 """ | 18 """ |
18 | 19 |
19 def ExtraChromeFlags(self): | 20 def ExtraChromeFlags(self): |
20 """Adds flags to the Chrome command line.""" | 21 """Adds flags to the Chrome command line.""" |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 def _TestGetUserMedia(self, with_action): | 67 def _TestGetUserMedia(self, with_action): |
67 """Runs getUserMedia in the test page and returns the result.""" | 68 """Runs getUserMedia in the test page and returns the result.""" |
68 url = self.GetFileURLForDataPath('webrtc', 'webrtc_jsep_test.html') | 69 url = self.GetFileURLForDataPath('webrtc', 'webrtc_jsep_test.html') |
69 self.NavigateToURL(url) | 70 self.NavigateToURL(url) |
70 | 71 |
71 self.assertEquals('ok-requested', self.ExecuteJavascript( | 72 self.assertEquals('ok-requested', self.ExecuteJavascript( |
72 'getUserMedia(true, true)')) | 73 'getUserMedia(true, true)')) |
73 | 74 |
74 self.WaitForInfobarCount(1) | 75 self.WaitForInfobarCount(1) |
75 self.PerformActionOnInfobar(with_action, infobar_index=0) | 76 self.PerformActionOnInfobar(with_action, infobar_index=0) |
| 77 self.WaitForGetUserMediaResult(tab_index=0) |
76 | 78 |
77 return self.ExecuteJavascript('obtainGetUserMediaResult()') | 79 return self.GetUserMediaResult(tab_index=0) |
78 | 80 |
79 | 81 |
80 if __name__ == '__main__': | 82 if __name__ == '__main__': |
81 pyauto_functional.Main() | 83 pyauto_functional.Main() |
OLD | NEW |