Chromium Code Reviews| 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 ad073adf680e737633db6e86f43d355e6da85c75..f99375c58056e548cad53da86721b37ba53deb73 100644 |
| --- a/chrome/browser/media/webrtc_browsertest_base.cc |
| +++ b/chrome/browser/media/webrtc_browsertest_base.cc |
| @@ -11,6 +11,7 @@ |
| #include "chrome/browser/media/media_stream_infobar_delegate.h" |
| #include "chrome/browser/media/webrtc_browsertest_common.h" |
| #include "chrome/browser/ui/browser.h" |
| +#include "chrome/browser/ui/browser_tabstrip.h" |
| #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| #include "chrome/test/base/ui_test_utils.h" |
| #include "content/public/browser/notification_service.h" |
| @@ -81,21 +82,10 @@ void WebRtcTestBase::GetUserMediaAndDismiss( |
| void WebRtcTestBase::GetUserMedia(content::WebContents* tab_contents, |
| const std::string& constraints) const { |
| - // TODO(phoglund): temporary debugging measure for crbug.com/281268. |
| - std::string javascript = |
| - "if (typeof(doGetUserMedia) != typeof(Function)) {\n" |
| - " console.log('hitting weird js load bug: diagnosing...');\n" |
| - " for (var v in window) {\n" |
| - " if (window.hasOwnProperty(v)) console.log(v);\n" |
| - " }\n" |
| - " window.domAutomationController.send('failed!');\n" |
| - "}\n" |
| - "else\n" |
| - " doGetUserMedia(" + constraints + ");"; |
| // Request user media: this will launch the media stream info bar. |
| std::string result; |
| EXPECT_TRUE(content::ExecuteScriptAndExtractString( |
| - tab_contents, javascript, &result)); |
| + tab_contents, "doGetUserMedia(" + constraints + ");", &result)); |
| EXPECT_EQ("ok-requested", result); |
| } |
| @@ -117,6 +107,20 @@ MediaStreamInfoBarDelegate* WebRtcTestBase::GetUserMediaAndWaitForInfoBar( |
| return infobar; |
| } |
| +content::WebContents* WebRtcTestBase::OpenPageAndGetUserMediaInNewTab( |
| + const GURL& url) const { |
| + chrome::AddTabAt(browser(), GURL(), -1, true); |
| + ui_test_utils::NavigateToURL(browser(), url); |
| +#if defined (OS_LINUX) |
| + // Load the page again on Linux to work around crbug.com/281268. |
| + ui_test_utils::NavigateToURL(browser(), url); |
|
Ami GONE FROM CHROMIUM
2013/12/05 19:35:24
Shot in the dark: is it possible that NavigateToUR
tommi (sloooow) - chröme
2013/12/09 15:30:53
Is it possible to hook up to the onload event inst
|
| +#endif |
| + content::WebContents* new_tab = |
| + browser()->tab_strip_model()->GetActiveWebContents(); |
| + GetUserMediaAndAccept(new_tab); |
| + return new_tab; |
| +} |
| + |
| content::WebContents* WebRtcTestBase::OpenPageAndAcceptUserMedia( |
| const GURL& url) const { |
| content::WindowedNotificationObserver infobar_added( |