| 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. Requires a real webcam and microphone | 38 // Top-level integration test for WebRTC. Requires a real webcam and microphone |
| 39 // on the running system. This test is not meant to run in the main browser | 39 // on the running system. This test is not meant to run in the main browser |
| 40 // test suite since normal tester machines do not have webcams. | 40 // test suite since normal tester machines do not have webcams. |
| 41 class WebrtcBrowserTest : public WebRtcTestBase { | 41 class WebRtcBrowserTest : public WebRtcTestBase { |
| 42 public: | 42 public: |
| 43 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { | 43 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { |
| 44 PeerConnectionServerRunner::KillAllPeerConnectionServersOnCurrentSystem(); | 44 PeerConnectionServerRunner::KillAllPeerConnectionServersOnCurrentSystem(); |
| 45 DetectErrorsInJavaScript(); // Look for errors in our rather complex js. | 45 DetectErrorsInJavaScript(); // Look for errors in our rather complex js. |
| 46 } | 46 } |
| 47 | 47 |
| 48 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { | 48 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { |
| 49 // This test expects real device handling and requires a real webcam / audio | 49 // This test expects real device handling and requires a real webcam / audio |
| 50 // device; it will not work with fake devices. | 50 // device; it will not work with fake devices. |
| 51 EXPECT_FALSE(command_line->HasSwitch( | 51 EXPECT_FALSE(command_line->HasSwitch( |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 } | 149 } |
| 150 | 150 |
| 151 content::WebContents* OpenTestPageAndGetUserMediaInNewTab() { | 151 content::WebContents* OpenTestPageAndGetUserMediaInNewTab() { |
| 152 return OpenPageAndGetUserMediaInNewTab( | 152 return OpenPageAndGetUserMediaInNewTab( |
| 153 embedded_test_server()->GetURL(kMainWebrtcTestHtmlPage)); | 153 embedded_test_server()->GetURL(kMainWebrtcTestHtmlPage)); |
| 154 } | 154 } |
| 155 | 155 |
| 156 PeerConnectionServerRunner peerconnection_server_; | 156 PeerConnectionServerRunner peerconnection_server_; |
| 157 }; | 157 }; |
| 158 | 158 |
| 159 IN_PROC_BROWSER_TEST_F(WebrtcBrowserTest, | 159 IN_PROC_BROWSER_TEST_F(WebRtcBrowserTest, |
| 160 MANUAL_RunsAudioVideoWebRTCCallInTwoTabs) { | 160 MANUAL_RunsAudioVideoWebRTCCallInTwoTabs) { |
| 161 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); | 161 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); |
| 162 ASSERT_TRUE(peerconnection_server_.Start()); | 162 ASSERT_TRUE(peerconnection_server_.Start()); |
| 163 | 163 |
| 164 content::WebContents* left_tab = OpenTestPageAndGetUserMediaInNewTab(); | 164 content::WebContents* left_tab = OpenTestPageAndGetUserMediaInNewTab(); |
| 165 content::WebContents* right_tab = OpenTestPageAndGetUserMediaInNewTab(); | 165 content::WebContents* right_tab = OpenTestPageAndGetUserMediaInNewTab(); |
| 166 | 166 |
| 167 EstablishCall(left_tab, right_tab); | 167 EstablishCall(left_tab, right_tab); |
| 168 | 168 |
| 169 StartDetectingVideo(left_tab, "remote-view"); | 169 StartDetectingVideo(left_tab, "remote-view"); |
| 170 StartDetectingVideo(right_tab, "remote-view"); | 170 StartDetectingVideo(right_tab, "remote-view"); |
| 171 | 171 |
| 172 WaitForVideoToPlay(left_tab); | 172 WaitForVideoToPlay(left_tab); |
| 173 WaitForVideoToPlay(right_tab); | 173 WaitForVideoToPlay(right_tab); |
| 174 | 174 |
| 175 HangUp(left_tab); | 175 HangUp(left_tab); |
| 176 WaitUntilHangupVerified(left_tab); | 176 WaitUntilHangupVerified(left_tab); |
| 177 WaitUntilHangupVerified(right_tab); | 177 WaitUntilHangupVerified(right_tab); |
| 178 | 178 |
| 179 ASSERT_TRUE(peerconnection_server_.Stop()); | 179 ASSERT_TRUE(peerconnection_server_.Stop()); |
| 180 } | 180 } |
| 181 | 181 |
| 182 IN_PROC_BROWSER_TEST_F(WebrtcBrowserTest, MANUAL_CpuUsage15Seconds) { | 182 IN_PROC_BROWSER_TEST_F(WebRtcBrowserTest, MANUAL_CpuUsage15Seconds) { |
| 183 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); | 183 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); |
| 184 ASSERT_TRUE(peerconnection_server_.Start()); | 184 ASSERT_TRUE(peerconnection_server_.Start()); |
| 185 | 185 |
| 186 base::FilePath results_file; | 186 base::FilePath results_file; |
| 187 ASSERT_TRUE(base::CreateTemporaryFile(&results_file)); | 187 ASSERT_TRUE(base::CreateTemporaryFile(&results_file)); |
| 188 | 188 |
| 189 content::WebContents* left_tab = OpenTestPageAndGetUserMediaInNewTab(); | 189 content::WebContents* left_tab = OpenTestPageAndGetUserMediaInNewTab(); |
| 190 | 190 |
| 191 #if defined(OS_MACOSX) | 191 #if defined(OS_MACOSX) |
| 192 // Don't measure renderer CPU on mac: requires a mach broker we don't have | 192 // Don't measure renderer CPU on mac: requires a mach broker we don't have |
| (...skipping 27 matching lines...) Expand all Loading... |
| 220 WaitUntilHangupVerified(right_tab); | 220 WaitUntilHangupVerified(right_tab); |
| 221 | 221 |
| 222 #if !defined(OS_MACOSX) | 222 #if !defined(OS_MACOSX) |
| 223 PrintProcessMetrics(renderer_process_metrics.get(), "_r"); | 223 PrintProcessMetrics(renderer_process_metrics.get(), "_r"); |
| 224 #endif | 224 #endif |
| 225 PrintProcessMetrics(browser_process_metrics.get(), "_b"); | 225 PrintProcessMetrics(browser_process_metrics.get(), "_b"); |
| 226 | 226 |
| 227 ASSERT_TRUE(peerconnection_server_.Stop()); | 227 ASSERT_TRUE(peerconnection_server_.Stop()); |
| 228 } | 228 } |
| 229 | 229 |
| 230 IN_PROC_BROWSER_TEST_F(WebrtcBrowserTest, | 230 IN_PROC_BROWSER_TEST_F(WebRtcBrowserTest, |
| 231 MANUAL_RunsAudioVideoCall60SecsAndLogsInternalMetrics) { | 231 MANUAL_RunsAudioVideoCall60SecsAndLogsInternalMetrics) { |
| 232 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); | 232 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); |
| 233 ASSERT_TRUE(peerconnection_server_.Start()); | 233 ASSERT_TRUE(peerconnection_server_.Start()); |
| 234 | 234 |
| 235 ASSERT_GE(TestTimeouts::action_max_timeout().InSeconds(), 80) << | 235 ASSERT_GE(TestTimeouts::action_max_timeout().InSeconds(), 80) << |
| 236 "This is a long-running test; you must specify " | 236 "This is a long-running test; you must specify " |
| 237 "--ui-test-action-max-timeout to have a value of at least 80000."; | 237 "--ui-test-action-max-timeout to have a value of at least 80000."; |
| 238 | 238 |
| 239 content::WebContents* left_tab = OpenTestPageAndGetUserMediaInNewTab(); | 239 content::WebContents* left_tab = OpenTestPageAndGetUserMediaInNewTab(); |
| 240 content::WebContents* right_tab = OpenTestPageAndGetUserMediaInNewTab(); | 240 content::WebContents* right_tab = OpenTestPageAndGetUserMediaInNewTab(); |
| (...skipping 27 matching lines...) Expand all Loading... |
| 268 PrintBweForVideoMetrics(*first_pc_dict); | 268 PrintBweForVideoMetrics(*first_pc_dict); |
| 269 PrintMetricsForAllStreams(*first_pc_dict); | 269 PrintMetricsForAllStreams(*first_pc_dict); |
| 270 | 270 |
| 271 HangUp(left_tab); | 271 HangUp(left_tab); |
| 272 WaitUntilHangupVerified(left_tab); | 272 WaitUntilHangupVerified(left_tab); |
| 273 WaitUntilHangupVerified(right_tab); | 273 WaitUntilHangupVerified(right_tab); |
| 274 | 274 |
| 275 ASSERT_TRUE(peerconnection_server_.Stop()); | 275 ASSERT_TRUE(peerconnection_server_.Stop()); |
| 276 } | 276 } |
| 277 | 277 |
| 278 IN_PROC_BROWSER_TEST_F(WebrtcBrowserTest, TestWebAudioMediaStream) { | 278 IN_PROC_BROWSER_TEST_F(WebRtcBrowserTest, TestWebAudioMediaStream) { |
| 279 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); | 279 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); |
| 280 GURL url(embedded_test_server()->GetURL("/webrtc/webaudio_crash.html")); | 280 GURL url(embedded_test_server()->GetURL("/webrtc/webaudio_crash.html")); |
| 281 ui_test_utils::NavigateToURL(browser(), url); | 281 ui_test_utils::NavigateToURL(browser(), url); |
| 282 content::WebContents* tab = | 282 content::WebContents* tab = |
| 283 browser()->tab_strip_model()->GetActiveWebContents(); | 283 browser()->tab_strip_model()->GetActiveWebContents(); |
| 284 // A sleep is necessary to be able to detect the crash. | 284 // A sleep is necessary to be able to detect the crash. |
| 285 SleepInJavascript(tab, 1000); | 285 SleepInJavascript(tab, 1000); |
| 286 | 286 |
| 287 ASSERT_FALSE(tab->IsCrashed()); | 287 ASSERT_FALSE(tab->IsCrashed()); |
| 288 } | 288 } |
| OLD | NEW |