| Index: chrome/browser/media/webrtc_browsertest_base.cc
|
| diff --git a/chrome/browser/media/webrtc_browsertest_base.cc b/chrome/browser/media/webrtc_browsertest_base.cc
|
| index 38b9b0e8461c0fc837872225c6508113ebc1ea9f..baac3945d89e7701b2f746e39b589f7ce10e76c9 100644
|
| --- a/chrome/browser/media/webrtc_browsertest_base.cc
|
| +++ b/chrome/browser/media/webrtc_browsertest_base.cc
|
| @@ -14,10 +14,12 @@
|
| #include "chrome/browser/ui/browser.h"
|
| #include "chrome/browser/ui/browser_tabstrip.h"
|
| #include "chrome/browser/ui/tabs/tab_strip_model.h"
|
| +#include "chrome/browser/ui/website_settings/permission_bubble_manager.h"
|
| #include "chrome/test/base/ui_test_utils.h"
|
| #include "components/infobars/core/infobar.h"
|
| #include "content/public/browser/notification_service.h"
|
| #include "content/public/test/browser_test_utils.h"
|
| +#include "content/public/test/test_utils.h"
|
| #include "net/test/embedded_test_server/embedded_test_server.h"
|
|
|
| #if defined(OS_WIN)
|
| @@ -103,15 +105,24 @@ void WebRtcTestBase::GetUserMediaAndAccept(
|
| void WebRtcTestBase::GetUserMediaWithSpecificConstraintsAndAccept(
|
| content::WebContents* tab_contents,
|
| const std::string& constraints) const {
|
| - infobars::InfoBar* infobar =
|
| - GetUserMediaAndWaitForInfoBar(tab_contents, constraints);
|
| - infobar->delegate()->AsConfirmInfoBarDelegate()->Accept();
|
| - CloseInfoBarInTab(tab_contents, infobar);
|
| + if (!PermissionBubbleManager::Enabled()) {
|
| + infobars::InfoBar* infobar =
|
| + GetUserMediaAndWaitForInfoBar(tab_contents, constraints);
|
| + infobar->delegate()->AsConfirmInfoBarDelegate()->Accept();
|
| + CloseInfoBarInTab(tab_contents, infobar);
|
| + } else {
|
| + GetUserMedia(tab_contents, constraints);
|
| +LOG(INFO) << "Accept bubble";
|
| + PermissionBubbleManager::FromWebContents(tab_contents)->Accept();
|
| + content::RunAllPendingInMessageLoop();
|
| + }
|
|
|
| +LOG(INFO) << "Wait until called";
|
| // Wait for WebRTC to call the success callback.
|
| const char kOkGotStream[] = "ok-got-stream";
|
| EXPECT_TRUE(test::PollingWaitUntil("obtainGetUserMediaResult()", kOkGotStream,
|
| tab_contents));
|
| +LOG(INFO) << "DONE!!!!!";
|
| }
|
|
|
| void WebRtcTestBase::GetUserMediaAndDeny(content::WebContents* tab_contents) {
|
| @@ -122,10 +133,15 @@ void WebRtcTestBase::GetUserMediaAndDeny(content::WebContents* tab_contents) {
|
| void WebRtcTestBase::GetUserMediaWithSpecificConstraintsAndDeny(
|
| content::WebContents* tab_contents,
|
| const std::string& constraints) const {
|
| - infobars::InfoBar* infobar =
|
| - GetUserMediaAndWaitForInfoBar(tab_contents, constraints);
|
| - infobar->delegate()->AsConfirmInfoBarDelegate()->Cancel();
|
| - CloseInfoBarInTab(tab_contents, infobar);
|
| + if (!PermissionBubbleManager::Enabled()) {
|
| + infobars::InfoBar* infobar =
|
| + GetUserMediaAndWaitForInfoBar(tab_contents, constraints);
|
| + infobar->delegate()->AsConfirmInfoBarDelegate()->Cancel();
|
| + CloseInfoBarInTab(tab_contents, infobar);
|
| + } else {
|
| + GetUserMedia(tab_contents, constraints);
|
| + PermissionBubbleManager::FromWebContents(tab_contents)->Deny();
|
| + }
|
|
|
| // Wait for WebRTC to call the fail callback.
|
| EXPECT_TRUE(test::PollingWaitUntil("obtainGetUserMediaResult()",
|
| @@ -135,10 +151,15 @@ void WebRtcTestBase::GetUserMediaWithSpecificConstraintsAndDeny(
|
|
|
| void WebRtcTestBase::GetUserMediaAndDismiss(
|
| content::WebContents* tab_contents) const {
|
| - infobars::InfoBar* infobar =
|
| - GetUserMediaAndWaitForInfoBar(tab_contents, kAudioVideoCallConstraints);
|
| - infobar->delegate()->InfoBarDismissed();
|
| - CloseInfoBarInTab(tab_contents, infobar);
|
| + if (!PermissionBubbleManager::Enabled()) {
|
| + infobars::InfoBar* infobar =
|
| + GetUserMediaAndWaitForInfoBar(tab_contents, kAudioVideoCallConstraints);
|
| + infobar->delegate()->InfoBarDismissed();
|
| + CloseInfoBarInTab(tab_contents, infobar);
|
| + } else {
|
| + GetUserMedia(tab_contents, kAudioVideoCallConstraints);
|
| + PermissionBubbleManager::FromWebContents(tab_contents)->Closing();
|
| + }
|
|
|
| // A dismiss should be treated like a deny.
|
| EXPECT_TRUE(test::PollingWaitUntil("obtainGetUserMediaResult()",
|
| @@ -203,23 +224,29 @@ content::WebContents* WebRtcTestBase::OpenTestPageAndGetUserMediaInNewTab(
|
|
|
| content::WebContents* WebRtcTestBase::OpenPageAndAcceptUserMedia(
|
| const GURL& url) const {
|
| - content::WindowedNotificationObserver infobar_added(
|
| + content::WindowedNotificationObserver nav(
|
| chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_ADDED,
|
| content::NotificationService::AllSources());
|
|
|
| ui_test_utils::NavigateToURL(browser(), url);
|
|
|
| - infobar_added.Wait();
|
| + nav.Wait();
|
|
|
| content::WebContents* tab_contents =
|
| browser()->tab_strip_model()->GetActiveWebContents();
|
| - content::Details<infobars::InfoBar::AddedDetails> details(
|
| - infobar_added.details());
|
| - infobars::InfoBar* infobar = details.ptr();
|
| - EXPECT_TRUE(infobar);
|
| - infobar->delegate()->AsMediaStreamInfoBarDelegate()->Accept();
|
| -
|
| - CloseInfoBarInTab(tab_contents, infobar);
|
| + if (!PermissionBubbleManager::Enabled()) {
|
| + content::Details<infobars::InfoBar::AddedDetails> details(
|
| + nav.details());
|
| + infobars::InfoBar* infobar = details.ptr();
|
| + EXPECT_TRUE(infobar);
|
| + infobar->delegate()->AsMediaStreamInfoBarDelegate()->Accept();
|
| +
|
| + CloseInfoBarInTab(tab_contents, infobar);
|
| + } else {
|
| + PermissionBubbleManager* mgr =
|
| + PermissionBubbleManager::FromWebContents(tab_contents);
|
| + mgr->Closing();
|
| + }
|
| return tab_contents;
|
| }
|
|
|
|
|