| 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 "base/command_line.h" | 5 #include "base/command_line.h" |
| 6 #include "base/strings/stringprintf.h" | 6 #include "base/strings/stringprintf.h" |
| 7 #include "build/build_config.h" | 7 #include "build/build_config.h" |
| 8 #include "chrome/browser/media/webrtc_browsertest_base.h" | 8 #include "chrome/browser/media/webrtc_browsertest_base.h" |
| 9 #include "chrome/browser/media/webrtc_browsertest_common.h" | 9 #include "chrome/browser/media/webrtc_browsertest_common.h" |
| 10 #include "chrome/browser/ui/browser.h" | 10 #include "chrome/browser/ui/browser.h" |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 void SetUpCommandLine(base::CommandLine* command_line) override { | 33 void SetUpCommandLine(base::CommandLine* command_line) override { |
| 34 // Ensure the infobar is enabled, since we expect that in this test. | 34 // Ensure the infobar is enabled, since we expect that in this test. |
| 35 EXPECT_FALSE(command_line->HasSwitch(switches::kUseFakeUIForMediaStream)); | 35 EXPECT_FALSE(command_line->HasSwitch(switches::kUseFakeUIForMediaStream)); |
| 36 | 36 |
| 37 // Always use fake devices. | 37 // Always use fake devices. |
| 38 command_line->AppendSwitch(switches::kUseFakeDeviceForMediaStream); | 38 command_line->AppendSwitch(switches::kUseFakeDeviceForMediaStream); |
| 39 | 39 |
| 40 // Flag used by TestWebAudioMediaStream to force garbage collection. | 40 // Flag used by TestWebAudioMediaStream to force garbage collection. |
| 41 command_line->AppendSwitchASCII(switches::kJavaScriptFlags, "--expose-gc"); | 41 command_line->AppendSwitchASCII(switches::kJavaScriptFlags, "--expose-gc"); |
| 42 } | 42 } |
| 43 |
| 44 void RunsAudioVideoWebRTCCallInTwoTabs(std::string video_codec) { |
| 45 if (OnWinXp()) return; |
| 46 |
| 47 ASSERT_TRUE(embedded_test_server()->Start()); |
| 48 |
| 49 content::WebContents* left_tab = |
| 50 OpenTestPageAndGetUserMediaInNewTab(kMainWebrtcTestHtmlPage); |
| 51 content::WebContents* right_tab = |
| 52 OpenTestPageAndGetUserMediaInNewTab(kMainWebrtcTestHtmlPage); |
| 53 |
| 54 SetupPeerconnectionWithLocalStream(left_tab); |
| 55 SetupPeerconnectionWithLocalStream(right_tab); |
| 56 |
| 57 NegotiateCall(left_tab, right_tab, video_codec); |
| 58 |
| 59 StartDetectingVideo(left_tab, "remote-view"); |
| 60 StartDetectingVideo(right_tab, "remote-view"); |
| 61 |
| 62 #if !defined(OS_MACOSX) |
| 63 // Video is choppy on Mac OS X. http://crbug.com/443542. |
| 64 WaitForVideoToPlay(left_tab); |
| 65 WaitForVideoToPlay(right_tab); |
| 66 #endif |
| 67 |
| 68 HangUp(left_tab); |
| 69 HangUp(right_tab); |
| 70 } |
| 43 }; | 71 }; |
| 44 | 72 |
| 45 IN_PROC_BROWSER_TEST_F(WebRtcBrowserTest, | 73 IN_PROC_BROWSER_TEST_F(WebRtcBrowserTest, |
| 46 RunsAudioVideoWebRTCCallInTwoTabs) { | 74 RunsAudioVideoWebRTCCallInTwoTabsVP8) { |
| 47 if (OnWinXp()) return; | 75 RunsAudioVideoWebRTCCallInTwoTabs("VP8"); |
| 76 } |
| 48 | 77 |
| 49 ASSERT_TRUE(embedded_test_server()->Start()); | 78 IN_PROC_BROWSER_TEST_F(WebRtcBrowserTest, |
| 50 | 79 RunsAudioVideoWebRTCCallInTwoTabsVP9) { |
| 51 content::WebContents* left_tab = | 80 RunsAudioVideoWebRTCCallInTwoTabs("VP9"); |
| 52 OpenTestPageAndGetUserMediaInNewTab(kMainWebrtcTestHtmlPage); | |
| 53 content::WebContents* right_tab = | |
| 54 OpenTestPageAndGetUserMediaInNewTab(kMainWebrtcTestHtmlPage); | |
| 55 | |
| 56 SetupPeerconnectionWithLocalStream(left_tab); | |
| 57 SetupPeerconnectionWithLocalStream(right_tab); | |
| 58 | |
| 59 NegotiateCall(left_tab, right_tab); | |
| 60 | |
| 61 StartDetectingVideo(left_tab, "remote-view"); | |
| 62 StartDetectingVideo(right_tab, "remote-view"); | |
| 63 | |
| 64 #if !defined(OS_MACOSX) | |
| 65 // Video is choppy on Mac OS X. http://crbug.com/443542. | |
| 66 WaitForVideoToPlay(left_tab); | |
| 67 WaitForVideoToPlay(right_tab); | |
| 68 #endif | |
| 69 | |
| 70 HangUp(left_tab); | |
| 71 HangUp(right_tab); | |
| 72 } | 81 } |
| 73 | 82 |
| 74 IN_PROC_BROWSER_TEST_F(WebRtcBrowserTest, TestWebAudioMediaStream) { | 83 IN_PROC_BROWSER_TEST_F(WebRtcBrowserTest, TestWebAudioMediaStream) { |
| 75 // This tests against crash regressions for the WebAudio-MediaStream | 84 // This tests against crash regressions for the WebAudio-MediaStream |
| 76 // integration. | 85 // integration. |
| 77 if (OnWinXp()) return; | 86 if (OnWinXp()) return; |
| 78 | 87 |
| 79 ASSERT_TRUE(embedded_test_server()->Start()); | 88 ASSERT_TRUE(embedded_test_server()->Start()); |
| 80 GURL url(embedded_test_server()->GetURL("/webrtc/webaudio_crash.html")); | 89 GURL url(embedded_test_server()->GetURL("/webrtc/webaudio_crash.html")); |
| 81 ui_test_utils::NavigateToURL(browser(), url); | 90 ui_test_utils::NavigateToURL(browser(), url); |
| 82 content::WebContents* tab = | 91 content::WebContents* tab = |
| 83 browser()->tab_strip_model()->GetActiveWebContents(); | 92 browser()->tab_strip_model()->GetActiveWebContents(); |
| 84 | 93 |
| 85 // A sleep is necessary to be able to detect the crash. | 94 // A sleep is necessary to be able to detect the crash. |
| 86 test::SleepInJavascript(tab, 1000); | 95 test::SleepInJavascript(tab, 1000); |
| 87 | 96 |
| 88 ASSERT_FALSE(tab->IsCrashed()); | 97 ASSERT_FALSE(tab->IsCrashed()); |
| 89 } | 98 } |
| OLD | NEW |