| 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 16 matching lines...) Expand all Loading... |
| 27 #include "chrome/test/ui/ui_test.h" | 27 #include "chrome/test/ui/ui_test.h" |
| 28 #include "content/public/browser/notification_service.h" | 28 #include "content/public/browser/notification_service.h" |
| 29 #include "content/public/browser/render_process_host.h" | 29 #include "content/public/browser/render_process_host.h" |
| 30 #include "content/public/test/browser_test_utils.h" | 30 #include "content/public/test/browser_test_utils.h" |
| 31 #include "net/test/embedded_test_server/embedded_test_server.h" | 31 #include "net/test/embedded_test_server/embedded_test_server.h" |
| 32 #include "testing/perf/perf_test.h" | 32 #include "testing/perf/perf_test.h" |
| 33 | 33 |
| 34 static const char kMainWebrtcTestHtmlPage[] = | 34 static const char kMainWebrtcTestHtmlPage[] = |
| 35 "/webrtc/webrtc_jsep01_test.html"; | 35 "/webrtc/webrtc_jsep01_test.html"; |
| 36 | 36 |
| 37 // Temporarily disabled on Linux. | |
| 38 // http://crbug.com/281268. | |
| 39 #if defined(OS_LINUX) | |
| 40 #define MAYBE_WebrtcBrowserTest DISABLED_WebrtcBrowserTest | |
| 41 #else | |
| 42 #define MAYBE_WebrtcBrowserTest WebrtcBrowserTest | |
| 43 #endif | |
| 44 | |
| 45 // Top-level integration test for WebRTC. Requires a real webcam and microphone | 37 // Top-level integration test for WebRTC. Requires a real webcam and microphone |
| 46 // on the running system. This test is not meant to run in the main browser | 38 // on the running system. This test is not meant to run in the main browser |
| 47 // test suite since normal tester machines do not have webcams. | 39 // test suite since normal tester machines do not have webcams. |
| 48 class MAYBE_WebrtcBrowserTest : public WebRtcTestBase { | 40 class WebrtcBrowserTest : public WebRtcTestBase { |
| 49 public: | 41 public: |
| 50 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { | 42 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { |
| 51 PeerConnectionServerRunner::KillAllPeerConnectionServersOnCurrentSystem(); | 43 PeerConnectionServerRunner::KillAllPeerConnectionServersOnCurrentSystem(); |
| 52 DetectErrorsInJavaScript(); // Look for errors in our rather complex js. | 44 DetectErrorsInJavaScript(); // Look for errors in our rather complex js. |
| 53 } | 45 } |
| 54 | 46 |
| 55 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { | 47 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { |
| 56 // This test expects real device handling and requires a real webcam / audio | 48 // This test expects real device handling and requires a real webcam / audio |
| 57 // device; it will not work with fake devices. | 49 // device; it will not work with fake devices. |
| 58 EXPECT_FALSE(command_line->HasSwitch( | 50 EXPECT_FALSE(command_line->HasSwitch( |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 base::DictionaryValue::Iterator iterator(*all_data); | 163 base::DictionaryValue::Iterator iterator(*all_data); |
| 172 | 164 |
| 173 const base::DictionaryValue* result; | 165 const base::DictionaryValue* result; |
| 174 if (!iterator.IsAtEnd() && iterator.value().GetAsDictionary(&result)) | 166 if (!iterator.IsAtEnd() && iterator.value().GetAsDictionary(&result)) |
| 175 return result; | 167 return result; |
| 176 | 168 |
| 177 return NULL; | 169 return NULL; |
| 178 } | 170 } |
| 179 | 171 |
| 180 content::WebContents* OpenTestPageAndGetUserMediaInNewTab() { | 172 content::WebContents* OpenTestPageAndGetUserMediaInNewTab() { |
| 181 chrome::AddTabAt(browser(), GURL(), -1, true); | 173 return OpenPageAndGetUserMediaInNewTab( |
| 182 ui_test_utils::NavigateToURL( | 174 embedded_test_server()->GetURL(kMainWebrtcTestHtmlPage)); |
| 183 browser(), embedded_test_server()->GetURL(kMainWebrtcTestHtmlPage)); | |
| 184 content::WebContents* left_tab = | |
| 185 browser()->tab_strip_model()->GetActiveWebContents(); | |
| 186 GetUserMediaAndAccept(left_tab); | |
| 187 return left_tab; | |
| 188 } | 175 } |
| 189 | 176 |
| 190 PeerConnectionServerRunner peerconnection_server_; | 177 PeerConnectionServerRunner peerconnection_server_; |
| 191 }; | 178 }; |
| 192 | 179 |
| 193 IN_PROC_BROWSER_TEST_F(MAYBE_WebrtcBrowserTest, | 180 IN_PROC_BROWSER_TEST_F(WebrtcBrowserTest, |
| 194 MANUAL_RunsAudioVideoWebRTCCallInTwoTabs) { | 181 MANUAL_RunsAudioVideoWebRTCCallInTwoTabs) { |
| 195 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); | 182 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); |
| 196 ASSERT_TRUE(peerconnection_server_.Start()); | 183 ASSERT_TRUE(peerconnection_server_.Start()); |
| 197 | 184 |
| 198 content::WebContents* left_tab = OpenTestPageAndGetUserMediaInNewTab(); | 185 content::WebContents* left_tab = OpenTestPageAndGetUserMediaInNewTab(); |
| 199 content::WebContents* right_tab = OpenTestPageAndGetUserMediaInNewTab(); | 186 content::WebContents* right_tab = OpenTestPageAndGetUserMediaInNewTab(); |
| 200 | 187 |
| 201 EstablishCall(left_tab, right_tab); | 188 EstablishCall(left_tab, right_tab); |
| 202 | 189 |
| 203 StartDetectingVideo(left_tab, "remote-view"); | 190 StartDetectingVideo(left_tab, "remote-view"); |
| 204 StartDetectingVideo(right_tab, "remote-view"); | 191 StartDetectingVideo(right_tab, "remote-view"); |
| 205 | 192 |
| 206 WaitForVideoToPlay(left_tab); | 193 WaitForVideoToPlay(left_tab); |
| 207 WaitForVideoToPlay(right_tab); | 194 WaitForVideoToPlay(right_tab); |
| 208 | 195 |
| 209 HangUp(left_tab); | 196 HangUp(left_tab); |
| 210 WaitUntilHangupVerified(left_tab); | 197 WaitUntilHangupVerified(left_tab); |
| 211 WaitUntilHangupVerified(right_tab); | 198 WaitUntilHangupVerified(right_tab); |
| 212 | 199 |
| 213 ASSERT_TRUE(peerconnection_server_.Stop()); | 200 ASSERT_TRUE(peerconnection_server_.Stop()); |
| 214 } | 201 } |
| 215 | 202 |
| 216 IN_PROC_BROWSER_TEST_F(MAYBE_WebrtcBrowserTest, MANUAL_CpuUsage15Seconds) { | 203 IN_PROC_BROWSER_TEST_F(WebrtcBrowserTest, MANUAL_CpuUsage15Seconds) { |
| 217 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); | 204 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); |
| 218 ASSERT_TRUE(peerconnection_server_.Start()); | 205 ASSERT_TRUE(peerconnection_server_.Start()); |
| 219 | 206 |
| 220 base::FilePath results_file; | 207 base::FilePath results_file; |
| 221 ASSERT_TRUE(base::CreateTemporaryFile(&results_file)); | 208 ASSERT_TRUE(base::CreateTemporaryFile(&results_file)); |
| 222 | 209 |
| 223 content::WebContents* left_tab = OpenTestPageAndGetUserMediaInNewTab(); | 210 content::WebContents* left_tab = OpenTestPageAndGetUserMediaInNewTab(); |
| 224 | 211 |
| 225 #if defined(OS_MACOSX) | 212 #if defined(OS_MACOSX) |
| 226 // Don't measure renderer CPU on mac: requires a mach broker we don't have | 213 // Don't measure renderer CPU on mac: requires a mach broker we don't have |
| (...skipping 27 matching lines...) Expand all Loading... |
| 254 WaitUntilHangupVerified(right_tab); | 241 WaitUntilHangupVerified(right_tab); |
| 255 | 242 |
| 256 #if !defined(OS_MACOSX) | 243 #if !defined(OS_MACOSX) |
| 257 PrintProcessMetrics(renderer_process_metrics.get(), "_r"); | 244 PrintProcessMetrics(renderer_process_metrics.get(), "_r"); |
| 258 #endif | 245 #endif |
| 259 PrintProcessMetrics(browser_process_metrics.get(), "_b"); | 246 PrintProcessMetrics(browser_process_metrics.get(), "_b"); |
| 260 | 247 |
| 261 ASSERT_TRUE(peerconnection_server_.Stop()); | 248 ASSERT_TRUE(peerconnection_server_.Stop()); |
| 262 } | 249 } |
| 263 | 250 |
| 264 IN_PROC_BROWSER_TEST_F(MAYBE_WebrtcBrowserTest, | 251 IN_PROC_BROWSER_TEST_F(WebrtcBrowserTest, |
| 265 MANUAL_TestMediaStreamTrackEnableDisable) { | 252 MANUAL_TestMediaStreamTrackEnableDisable) { |
| 266 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); | 253 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); |
| 267 ASSERT_TRUE(peerconnection_server_.Start()); | 254 ASSERT_TRUE(peerconnection_server_.Start()); |
| 268 | 255 |
| 269 content::WebContents* left_tab = OpenTestPageAndGetUserMediaInNewTab(); | 256 content::WebContents* left_tab = OpenTestPageAndGetUserMediaInNewTab(); |
| 270 content::WebContents* right_tab = OpenTestPageAndGetUserMediaInNewTab(); | 257 content::WebContents* right_tab = OpenTestPageAndGetUserMediaInNewTab(); |
| 271 | 258 |
| 272 EstablishCall(left_tab, right_tab); | 259 EstablishCall(left_tab, right_tab); |
| 273 | 260 |
| 274 StartDetectingVideo(left_tab, "remote-view"); | 261 StartDetectingVideo(left_tab, "remote-view"); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 285 | 272 |
| 286 WaitForVideoToPlay(right_tab); | 273 WaitForVideoToPlay(right_tab); |
| 287 | 274 |
| 288 HangUp(left_tab); | 275 HangUp(left_tab); |
| 289 WaitUntilHangupVerified(left_tab); | 276 WaitUntilHangupVerified(left_tab); |
| 290 WaitUntilHangupVerified(right_tab); | 277 WaitUntilHangupVerified(right_tab); |
| 291 | 278 |
| 292 ASSERT_TRUE(peerconnection_server_.Stop()); | 279 ASSERT_TRUE(peerconnection_server_.Stop()); |
| 293 } | 280 } |
| 294 | 281 |
| 295 IN_PROC_BROWSER_TEST_F(MAYBE_WebrtcBrowserTest, | 282 IN_PROC_BROWSER_TEST_F(WebrtcBrowserTest, |
| 296 MANUAL_RunsAudioVideoCall60SecsAndLogsInternalMetrics) { | 283 MANUAL_RunsAudioVideoCall60SecsAndLogsInternalMetrics) { |
| 297 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); | 284 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); |
| 298 ASSERT_TRUE(peerconnection_server_.Start()); | 285 ASSERT_TRUE(peerconnection_server_.Start()); |
| 299 | 286 |
| 300 ASSERT_GE(TestTimeouts::action_max_timeout().InSeconds(), 80) << | 287 ASSERT_GE(TestTimeouts::action_max_timeout().InSeconds(), 80) << |
| 301 "This is a long-running test; you must specify " | 288 "This is a long-running test; you must specify " |
| 302 "--ui-test-action-max-timeout to have a value of at least 80000."; | 289 "--ui-test-action-max-timeout to have a value of at least 80000."; |
| 303 | 290 |
| 304 content::WebContents* left_tab = OpenTestPageAndGetUserMediaInNewTab(); | 291 content::WebContents* left_tab = OpenTestPageAndGetUserMediaInNewTab(); |
| 305 content::WebContents* right_tab = OpenTestPageAndGetUserMediaInNewTab(); | 292 content::WebContents* right_tab = OpenTestPageAndGetUserMediaInNewTab(); |
| (...skipping 27 matching lines...) Expand all Loading... |
| 333 PrintBweForVideoMetrics(*first_pc_dict); | 320 PrintBweForVideoMetrics(*first_pc_dict); |
| 334 PrintMetricsForAllStreams(*first_pc_dict); | 321 PrintMetricsForAllStreams(*first_pc_dict); |
| 335 | 322 |
| 336 HangUp(left_tab); | 323 HangUp(left_tab); |
| 337 WaitUntilHangupVerified(left_tab); | 324 WaitUntilHangupVerified(left_tab); |
| 338 WaitUntilHangupVerified(right_tab); | 325 WaitUntilHangupVerified(right_tab); |
| 339 | 326 |
| 340 ASSERT_TRUE(peerconnection_server_.Stop()); | 327 ASSERT_TRUE(peerconnection_server_.Stop()); |
| 341 } | 328 } |
| 342 | 329 |
| 343 IN_PROC_BROWSER_TEST_F(MAYBE_WebrtcBrowserTest, TestWebAudioMediaStream) { | 330 IN_PROC_BROWSER_TEST_F(WebrtcBrowserTest, TestWebAudioMediaStream) { |
| 344 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); | 331 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); |
| 345 GURL url(embedded_test_server()->GetURL("/webrtc/webaudio_crash.html")); | 332 GURL url(embedded_test_server()->GetURL("/webrtc/webaudio_crash.html")); |
| 346 ui_test_utils::NavigateToURL(browser(), url); | 333 ui_test_utils::NavigateToURL(browser(), url); |
| 347 content::WebContents* tab = | 334 content::WebContents* tab = |
| 348 browser()->tab_strip_model()->GetActiveWebContents(); | 335 browser()->tab_strip_model()->GetActiveWebContents(); |
| 349 // A sleep is necessary to be able to detect the crash. | 336 // A sleep is necessary to be able to detect the crash. |
| 350 SleepInJavascript(tab, 1000); | 337 SleepInJavascript(tab, 1000); |
| 351 | 338 |
| 352 ASSERT_FALSE(tab->IsCrashed()); | 339 ASSERT_FALSE(tab->IsCrashed()); |
| 353 } | 340 } |
| OLD | NEW |