| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "chrome/browser/media/webrtc_browsertest_base.h" | 5 #include "chrome/browser/media/webrtc_browsertest_base.h" |
| 6 | 6 |
| 7 #include "chrome/browser/chrome_notification_types.h" | 7 #include "chrome/browser/chrome_notification_types.h" |
| 8 #include "chrome/browser/infobars/infobar.h" | 8 #include "chrome/browser/infobars/infobar.h" |
| 9 #include "chrome/browser/infobars/infobar_service.h" | 9 #include "chrome/browser/infobars/infobar_service.h" |
| 10 #include "chrome/browser/media/media_stream_infobar_delegate.h" | 10 #include "chrome/browser/media/media_stream_infobar_delegate.h" |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 // A dismiss should be treated like a deny. | 74 // A dismiss should be treated like a deny. |
| 75 EXPECT_TRUE(PollingWaitUntil("obtainGetUserMediaResult()", | 75 EXPECT_TRUE(PollingWaitUntil("obtainGetUserMediaResult()", |
| 76 kFailedWithErrorPermissionDenied, tab_contents)); | 76 kFailedWithErrorPermissionDenied, tab_contents)); |
| 77 } | 77 } |
| 78 | 78 |
| 79 void WebRtcTestBase::GetUserMedia(content::WebContents* tab_contents, | 79 void WebRtcTestBase::GetUserMedia(content::WebContents* tab_contents, |
| 80 const std::string& constraints) { | 80 const std::string& constraints) { |
| 81 // Request user media: this will launch the media stream info bar. | 81 // Request user media: this will launch the media stream info bar. |
| 82 std::string result; | 82 std::string result; |
| 83 EXPECT_TRUE(content::ExecuteScriptAndExtractString( | 83 EXPECT_TRUE(content::ExecuteScriptAndExtractString( |
| 84 tab_contents, "getUserMedia(" + constraints + ");", &result)); | 84 tab_contents, "doGetUserMedia(" + constraints + ");", &result)); |
| 85 EXPECT_EQ("ok-requested", result); | 85 EXPECT_EQ("ok-requested", result); |
| 86 } | 86 } |
| 87 | 87 |
| 88 MediaStreamInfoBarDelegate* WebRtcTestBase::GetUserMediaAndWaitForInfoBar( | 88 MediaStreamInfoBarDelegate* WebRtcTestBase::GetUserMediaAndWaitForInfoBar( |
| 89 content::WebContents* tab_contents, | 89 content::WebContents* tab_contents, |
| 90 const std::string& constraints) { | 90 const std::string& constraints) { |
| 91 content::WindowedNotificationObserver infobar_added( | 91 content::WindowedNotificationObserver infobar_added( |
| 92 chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_ADDED, | 92 chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_ADDED, |
| 93 content::NotificationService::AllSources()); | 93 content::NotificationService::AllSources()); |
| 94 | 94 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 108 content::WindowedNotificationObserver infobar_removed( | 108 content::WindowedNotificationObserver infobar_removed( |
| 109 chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_REMOVED, | 109 chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_REMOVED, |
| 110 content::NotificationService::AllSources()); | 110 content::NotificationService::AllSources()); |
| 111 | 111 |
| 112 InfoBarService* infobar_service = | 112 InfoBarService* infobar_service = |
| 113 InfoBarService::FromWebContents(tab_contents); | 113 InfoBarService::FromWebContents(tab_contents); |
| 114 infobar_service->RemoveInfoBar(infobar); | 114 infobar_service->RemoveInfoBar(infobar); |
| 115 | 115 |
| 116 infobar_removed.Wait(); | 116 infobar_removed.Wait(); |
| 117 } | 117 } |
| OLD | NEW |