| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "base/file_util.h" | 5 #include "base/file_util.h" |
| 6 #include "base/path_service.h" | 6 #include "base/path_service.h" |
| 7 #include "base/process_util.h" | 7 #include "base/process_util.h" |
| 8 #include "base/stringprintf.h" | 8 #include "base/stringprintf.h" |
| 9 #include "base/time.h" | 9 #include "base/time.h" |
| 10 #include "chrome/browser/infobars/infobar.h" | 10 #include "chrome/browser/infobars/infobar.h" |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 return result; | 94 return result; |
| 95 } | 95 } |
| 96 | 96 |
| 97 void GetUserMedia(content::WebContents* tab_contents) { | 97 void GetUserMedia(content::WebContents* tab_contents) { |
| 98 content::WindowedNotificationObserver infobar_added( | 98 content::WindowedNotificationObserver infobar_added( |
| 99 chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_ADDED, | 99 chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_ADDED, |
| 100 content::NotificationService::AllSources()); | 100 content::NotificationService::AllSources()); |
| 101 | 101 |
| 102 // Request user media: this will launch the media stream info bar. | 102 // Request user media: this will launch the media stream info bar. |
| 103 EXPECT_EQ("ok-requested", ExecuteJavascript( | 103 EXPECT_EQ("ok-requested", ExecuteJavascript( |
| 104 "getUserMedia('{video: true, audio: true}');", tab_contents)); | 104 "doGetUserMedia('{video: true, audio: true}');", tab_contents)); |
| 105 | 105 |
| 106 // Wait for the bar to pop up, then accept. | 106 // Wait for the bar to pop up, then accept. |
| 107 infobar_added.Wait(); | 107 infobar_added.Wait(); |
| 108 content::Details<InfoBarAddedDetails> details(infobar_added.details()); | 108 content::Details<InfoBarAddedDetails> details(infobar_added.details()); |
| 109 MediaStreamInfoBarDelegate* media_infobar = | 109 MediaStreamInfoBarDelegate* media_infobar = |
| 110 details.ptr()->AsMediaStreamInfoBarDelegate(); | 110 details.ptr()->AsMediaStreamInfoBarDelegate(); |
| 111 media_infobar->Accept(); | 111 media_infobar->Accept(); |
| 112 | 112 |
| 113 // Wait for WebRTC to call the success callback. | 113 // Wait for WebRTC to call the success callback. |
| 114 EXPECT_TRUE(UglyPollingWaitUntil("obtainGetUserMediaResult();", | 114 EXPECT_TRUE(UglyPollingWaitUntil("obtainGetUserMediaResult();", |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 226 WaitForVideo(left_tab); | 226 WaitForVideo(left_tab); |
| 227 WaitForVideo(right_tab); | 227 WaitForVideo(right_tab); |
| 228 | 228 |
| 229 HangUp(left_tab); | 229 HangUp(left_tab); |
| 230 WaitUntilHangupVerified(left_tab); | 230 WaitUntilHangupVerified(left_tab); |
| 231 WaitUntilHangupVerified(right_tab); | 231 WaitUntilHangupVerified(right_tab); |
| 232 | 232 |
| 233 AssertNoAsynchronousErrors(left_tab); | 233 AssertNoAsynchronousErrors(left_tab); |
| 234 AssertNoAsynchronousErrors(right_tab); | 234 AssertNoAsynchronousErrors(right_tab); |
| 235 } | 235 } |
| OLD | NEW |