Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(30)

Side by Side Diff: chrome/browser/media/chrome_webrtc_browsertest.cc

Issue 1762413002: Cleanup: remove prefix chrome_ of chrome/browser/media/chrome* files (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: reran the commands Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "base/command_line.h"
6 #include "base/strings/stringprintf.h"
7 #include "build/build_config.h"
8 #include "chrome/browser/media/webrtc_browsertest_base.h"
9 #include "chrome/browser/media/webrtc_browsertest_common.h"
10 #include "chrome/browser/ui/browser.h"
11 #include "chrome/browser/ui/browser_tabstrip.h"
12 #include "chrome/browser/ui/tabs/tab_strip_model.h"
13 #include "chrome/common/chrome_switches.h"
14 #include "chrome/test/base/in_process_browser_test.h"
15 #include "chrome/test/base/ui_test_utils.h"
16 #include "content/public/common/content_switches.h"
17 #include "content/public/common/feature_h264_with_openh264_ffmpeg.h"
18 #include "content/public/common/features.h"
19 #include "content/public/test/browser_test_utils.h"
20 #include "media/base/media_switches.h"
21 #include "net/test/embedded_test_server/embedded_test_server.h"
22
23 static const char kMainWebrtcTestHtmlPage[] =
24 "/webrtc/webrtc_jsep01_test.html";
25
26 // Top-level integration test for WebRTC. It always uses fake devices; see
27 // WebRtcWebcamBrowserTest for a test that acquires any real webcam on the
28 // system.
29 class WebRtcBrowserTest : public WebRtcTestBase {
30 public:
31 void SetUpInProcessBrowserTestFixture() override {
32 DetectErrorsInJavaScript(); // Look for errors in our rather complex js.
33 }
34
35 void SetUpCommandLine(base::CommandLine* command_line) override {
36 // Ensure the infobar is enabled, since we expect that in this test.
37 EXPECT_FALSE(command_line->HasSwitch(switches::kUseFakeUIForMediaStream));
38
39 // Always use fake devices.
40 command_line->AppendSwitch(switches::kUseFakeDeviceForMediaStream);
41
42 // Flag used by TestWebAudioMediaStream to force garbage collection.
43 command_line->AppendSwitchASCII(switches::kJavaScriptFlags, "--expose-gc");
44 }
45
46 void RunsAudioVideoWebRTCCallInTwoTabs(std::string video_codec) {
47 if (OnWinXp()) return;
48
49 ASSERT_TRUE(embedded_test_server()->Start());
50
51 content::WebContents* left_tab =
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, video_codec);
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 }
73 };
74
75 IN_PROC_BROWSER_TEST_F(WebRtcBrowserTest,
76 RunsAudioVideoWebRTCCallInTwoTabsVP8) {
77 RunsAudioVideoWebRTCCallInTwoTabs("VP8");
78 }
79
80 IN_PROC_BROWSER_TEST_F(WebRtcBrowserTest,
81 RunsAudioVideoWebRTCCallInTwoTabsVP9) {
82 RunsAudioVideoWebRTCCallInTwoTabs("VP9");
83 }
84
85 #if BUILDFLAG(RTC_USE_H264)
86
87 IN_PROC_BROWSER_TEST_F(WebRtcBrowserTest,
88 RunsAudioVideoWebRTCCallInTwoTabsH264) {
89 // Only run test if run-time feature corresponding to |rtc_use_h264| is on.
90 if (!base::FeatureList::IsEnabled(content::kWebRtcH264WithOpenH264FFmpeg)) {
91 LOG(WARNING) << "Run-time feature WebRTC-H264WithOpenH264FFmpeg disabled. "
92 "Skipping WebRtcBrowserTest.RunsAudioVideoWebRTCCallInTwoTabsH264 "
93 "(test \"OK\")";
94 return;
95 }
96 RunsAudioVideoWebRTCCallInTwoTabs("H264");
97 }
98
99 #endif // BUILDFLAG(RTC_USE_H264)
100
101 IN_PROC_BROWSER_TEST_F(WebRtcBrowserTest, TestWebAudioMediaStream) {
102 // This tests against crash regressions for the WebAudio-MediaStream
103 // integration.
104 if (OnWinXp()) return;
105
106 ASSERT_TRUE(embedded_test_server()->Start());
107 GURL url(embedded_test_server()->GetURL("/webrtc/webaudio_crash.html"));
108 ui_test_utils::NavigateToURL(browser(), url);
109 content::WebContents* tab =
110 browser()->tab_strip_model()->GetActiveWebContents();
111
112 // A sleep is necessary to be able to detect the crash.
113 test::SleepInJavascript(tab, 1000);
114
115 ASSERT_FALSE(tab->IsCrashed());
116 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698