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/file_util.h" | 6 #include "base/file_util.h" |
7 #include "base/json/json_reader.h" | 7 #include "base/json/json_reader.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
10 #include "base/process/launch.h" | 10 #include "base/process/launch.h" |
(...skipping 20 matching lines...) Expand all Loading... | |
31 #include "media/base/media_switches.h" | 31 #include "media/base/media_switches.h" |
32 #include "net/test/embedded_test_server/embedded_test_server.h" | 32 #include "net/test/embedded_test_server/embedded_test_server.h" |
33 #include "testing/perf/perf_test.h" | 33 #include "testing/perf/perf_test.h" |
34 | 34 |
35 static const char kMainWebrtcTestHtmlPage[] = | 35 static const char kMainWebrtcTestHtmlPage[] = |
36 "/webrtc/webrtc_jsep01_test.html"; | 36 "/webrtc/webrtc_jsep01_test.html"; |
37 | 37 |
38 // Top-level integration test for WebRTC. The test methods here must run | 38 // Top-level integration test for WebRTC. The test methods here must run |
39 // sequentially since they use a server binary on the system (hence they are | 39 // sequentially since they use a server binary on the system (hence they are |
40 // tagged as MANUAL). | 40 // tagged as MANUAL). |
41 class WebRtcBrowserTest : public WebRtcTestBase { | 41 class WebRtcBrowserTest : public WebRtcTestBase, |
42 public testing::WithParamInterface<bool> { | |
42 public: | 43 public: |
44 WebRtcBrowserTest() { | |
45 if (GetParam()) { | |
46 CommandLine::ForCurrentProcess()->AppendSwitch( | |
phoglund_chromium
2014/03/12 17:27:18
Same here.
no longer working on chromium
2014/03/12 18:06:08
ditto
| |
47 switches::kEnableAudioTrackProcessing); | |
48 } | |
49 } | |
43 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { | 50 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { |
44 PeerConnectionServerRunner::KillAllPeerConnectionServersOnCurrentSystem(); | 51 PeerConnectionServerRunner::KillAllPeerConnectionServersOnCurrentSystem(); |
45 DetectErrorsInJavaScript(); // Look for errors in our rather complex js. | 52 DetectErrorsInJavaScript(); // Look for errors in our rather complex js. |
46 } | 53 } |
47 | 54 |
48 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { | 55 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { |
49 // Ensure the infobar is enabled, since we expect that in this test. | 56 // Ensure the infobar is enabled, since we expect that in this test. |
50 EXPECT_FALSE(command_line->HasSwitch(switches::kUseFakeUIForMediaStream)); | 57 EXPECT_FALSE(command_line->HasSwitch(switches::kUseFakeUIForMediaStream)); |
51 | 58 |
52 // TODO(phoglund): allow this test to also run with real devices once we | 59 // TODO(phoglund): allow this test to also run with real devices once we |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
103 const base::DictionaryValue* result; | 110 const base::DictionaryValue* result; |
104 if (!iterator.IsAtEnd() && iterator.value().GetAsDictionary(&result)) | 111 if (!iterator.IsAtEnd() && iterator.value().GetAsDictionary(&result)) |
105 return result; | 112 return result; |
106 | 113 |
107 return NULL; | 114 return NULL; |
108 } | 115 } |
109 | 116 |
110 PeerConnectionServerRunner peerconnection_server_; | 117 PeerConnectionServerRunner peerconnection_server_; |
111 }; | 118 }; |
112 | 119 |
113 IN_PROC_BROWSER_TEST_F(WebRtcBrowserTest, | 120 static const bool kRunTestsWithFlag[] = { false, true }; |
121 INSTANTIATE_TEST_CASE_P(WebRtcBrowserTests, | |
122 WebRtcBrowserTest, | |
123 testing::ValuesIn(kRunTestsWithFlag)); | |
124 | |
125 IN_PROC_BROWSER_TEST_P(WebRtcBrowserTest, | |
114 MANUAL_RunsAudioVideoWebRTCCallInTwoTabs) { | 126 MANUAL_RunsAudioVideoWebRTCCallInTwoTabs) { |
115 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); | 127 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); |
116 ASSERT_TRUE(peerconnection_server_.Start()); | 128 ASSERT_TRUE(peerconnection_server_.Start()); |
117 | 129 |
118 content::WebContents* left_tab = | 130 content::WebContents* left_tab = |
119 OpenTestPageAndGetUserMediaInNewTab(kMainWebrtcTestHtmlPage); | 131 OpenTestPageAndGetUserMediaInNewTab(kMainWebrtcTestHtmlPage); |
120 content::WebContents* right_tab = | 132 content::WebContents* right_tab = |
121 OpenTestPageAndGetUserMediaInNewTab(kMainWebrtcTestHtmlPage); | 133 OpenTestPageAndGetUserMediaInNewTab(kMainWebrtcTestHtmlPage); |
122 | 134 |
123 EstablishCall(left_tab, right_tab); | 135 EstablishCall(left_tab, right_tab); |
124 | 136 |
125 StartDetectingVideo(left_tab, "remote-view"); | 137 StartDetectingVideo(left_tab, "remote-view"); |
126 StartDetectingVideo(right_tab, "remote-view"); | 138 StartDetectingVideo(right_tab, "remote-view"); |
127 | 139 |
128 WaitForVideoToPlay(left_tab); | 140 WaitForVideoToPlay(left_tab); |
129 WaitForVideoToPlay(right_tab); | 141 WaitForVideoToPlay(right_tab); |
130 | 142 |
131 HangUp(left_tab); | 143 HangUp(left_tab); |
132 WaitUntilHangupVerified(left_tab); | 144 WaitUntilHangupVerified(left_tab); |
133 WaitUntilHangupVerified(right_tab); | 145 WaitUntilHangupVerified(right_tab); |
134 | 146 |
135 ASSERT_TRUE(peerconnection_server_.Stop()); | 147 ASSERT_TRUE(peerconnection_server_.Stop()); |
136 } | 148 } |
137 | 149 |
138 IN_PROC_BROWSER_TEST_F(WebRtcBrowserTest, MANUAL_CpuUsage15Seconds) { | 150 IN_PROC_BROWSER_TEST_P(WebRtcBrowserTest, MANUAL_CpuUsage15Seconds) { |
139 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); | 151 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); |
140 ASSERT_TRUE(peerconnection_server_.Start()); | 152 ASSERT_TRUE(peerconnection_server_.Start()); |
141 | 153 |
142 base::FilePath results_file; | 154 base::FilePath results_file; |
143 ASSERT_TRUE(base::CreateTemporaryFile(&results_file)); | 155 ASSERT_TRUE(base::CreateTemporaryFile(&results_file)); |
144 | 156 |
145 content::WebContents* left_tab = | 157 content::WebContents* left_tab = |
146 OpenTestPageAndGetUserMediaInNewTab(kMainWebrtcTestHtmlPage); | 158 OpenTestPageAndGetUserMediaInNewTab(kMainWebrtcTestHtmlPage); |
147 | 159 |
148 #if defined(OS_MACOSX) | 160 #if defined(OS_MACOSX) |
(...skipping 30 matching lines...) Expand all Loading... | |
179 | 191 |
180 #if !defined(OS_MACOSX) | 192 #if !defined(OS_MACOSX) |
181 PrintProcessMetrics(renderer_process_metrics.get(), "_r"); | 193 PrintProcessMetrics(renderer_process_metrics.get(), "_r"); |
182 #endif | 194 #endif |
183 PrintProcessMetrics(browser_process_metrics.get(), "_b"); | 195 PrintProcessMetrics(browser_process_metrics.get(), "_b"); |
184 | 196 |
185 ASSERT_TRUE(peerconnection_server_.Stop()); | 197 ASSERT_TRUE(peerconnection_server_.Stop()); |
186 } | 198 } |
187 | 199 |
188 // This is manual for its long execution time. | 200 // This is manual for its long execution time. |
189 IN_PROC_BROWSER_TEST_F(WebRtcBrowserTest, | 201 IN_PROC_BROWSER_TEST_P(WebRtcBrowserTest, |
190 MANUAL_RunsAudioVideoCall60SecsAndLogsInternalMetrics) { | 202 MANUAL_RunsAudioVideoCall60SecsAndLogsInternalMetrics) { |
191 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); | 203 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); |
192 ASSERT_TRUE(peerconnection_server_.Start()); | 204 ASSERT_TRUE(peerconnection_server_.Start()); |
193 | 205 |
194 ASSERT_GE(TestTimeouts::action_max_timeout().InSeconds(), 100) << | 206 ASSERT_GE(TestTimeouts::action_max_timeout().InSeconds(), 100) << |
195 "This is a long-running test; you must specify " | 207 "This is a long-running test; you must specify " |
196 "--ui-test-action-max-timeout to have a value of at least 100000."; | 208 "--ui-test-action-max-timeout to have a value of at least 100000."; |
197 | 209 |
198 content::WebContents* left_tab = | 210 content::WebContents* left_tab = |
199 OpenTestPageAndGetUserMediaInNewTab(kMainWebrtcTestHtmlPage); | 211 OpenTestPageAndGetUserMediaInNewTab(kMainWebrtcTestHtmlPage); |
(...skipping 29 matching lines...) Expand all Loading... | |
229 PrintBweForVideoMetrics(*first_pc_dict); | 241 PrintBweForVideoMetrics(*first_pc_dict); |
230 PrintMetricsForAllStreams(*first_pc_dict); | 242 PrintMetricsForAllStreams(*first_pc_dict); |
231 | 243 |
232 HangUp(left_tab); | 244 HangUp(left_tab); |
233 WaitUntilHangupVerified(left_tab); | 245 WaitUntilHangupVerified(left_tab); |
234 WaitUntilHangupVerified(right_tab); | 246 WaitUntilHangupVerified(right_tab); |
235 | 247 |
236 ASSERT_TRUE(peerconnection_server_.Stop()); | 248 ASSERT_TRUE(peerconnection_server_.Stop()); |
237 } | 249 } |
238 | 250 |
239 IN_PROC_BROWSER_TEST_F(WebRtcBrowserTest, TestWebAudioMediaStream) { | 251 IN_PROC_BROWSER_TEST_P(WebRtcBrowserTest, TestWebAudioMediaStream) { |
240 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); | 252 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); |
241 GURL url(embedded_test_server()->GetURL("/webrtc/webaudio_crash.html")); | 253 GURL url(embedded_test_server()->GetURL("/webrtc/webaudio_crash.html")); |
242 ui_test_utils::NavigateToURL(browser(), url); | 254 ui_test_utils::NavigateToURL(browser(), url); |
243 content::WebContents* tab = | 255 content::WebContents* tab = |
244 browser()->tab_strip_model()->GetActiveWebContents(); | 256 browser()->tab_strip_model()->GetActiveWebContents(); |
245 | 257 |
246 // A sleep is necessary to be able to detect the crash. | 258 // A sleep is necessary to be able to detect the crash. |
247 SleepInJavascript(tab, 1000); | 259 SleepInJavascript(tab, 1000); |
248 | 260 |
249 ASSERT_FALSE(tab->IsCrashed()); | 261 ASSERT_FALSE(tab->IsCrashed()); |
250 } | 262 } |
OLD | NEW |