| 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 } | 44 } |
| 53 | 45 |
| 54 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { | 46 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { |
| 55 // This test expects real device handling and requires a real webcam / audio | 47 // This test expects real device handling and requires a real webcam / audio |
| 56 // device; it will not work with fake devices. | 48 // device; it will not work with fake devices. |
| 57 EXPECT_FALSE(command_line->HasSwitch( | 49 EXPECT_FALSE(command_line->HasSwitch( |
| 58 switches::kUseFakeDeviceForMediaStream)); | 50 switches::kUseFakeDeviceForMediaStream)); |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 base::DictionaryValue::Iterator iterator(*all_data); | 172 base::DictionaryValue::Iterator iterator(*all_data); |
| 181 | 173 |
| 182 const base::DictionaryValue* result; | 174 const base::DictionaryValue* result; |
| 183 if (!iterator.IsAtEnd() && iterator.value().GetAsDictionary(&result)) | 175 if (!iterator.IsAtEnd() && iterator.value().GetAsDictionary(&result)) |
| 184 return result; | 176 return result; |
| 185 | 177 |
| 186 return NULL; | 178 return NULL; |
| 187 } | 179 } |
| 188 | 180 |
| 189 content::WebContents* OpenTestPageAndGetUserMediaInNewTab() { | 181 content::WebContents* OpenTestPageAndGetUserMediaInNewTab() { |
| 190 chrome::AddTabAt(browser(), GURL(), -1, true); | 182 return OpenPageAndGetUserMediaInNewTab( |
| 191 ui_test_utils::NavigateToURL( | 183 embedded_test_server()->GetURL(kMainWebrtcTestHtmlPage)); |
| 192 browser(), embedded_test_server()->GetURL(kMainWebrtcTestHtmlPage)); | |
| 193 content::WebContents* left_tab = | |
| 194 browser()->tab_strip_model()->GetActiveWebContents(); | |
| 195 GetUserMediaAndAccept(left_tab); | |
| 196 return left_tab; | |
| 197 } | 184 } |
| 198 | 185 |
| 199 PeerConnectionServerRunner peerconnection_server_; | 186 PeerConnectionServerRunner peerconnection_server_; |
| 200 }; | 187 }; |
| 201 | 188 |
| 202 IN_PROC_BROWSER_TEST_F(MAYBE_WebrtcBrowserTest, | 189 IN_PROC_BROWSER_TEST_F(WebrtcBrowserTest, |
| 203 MANUAL_RunsAudioVideoWebRTCCallInTwoTabs) { | 190 MANUAL_RunsAudioVideoWebRTCCallInTwoTabs) { |
| 204 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); | 191 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); |
| 205 ASSERT_TRUE(peerconnection_server_.Start()); | 192 ASSERT_TRUE(peerconnection_server_.Start()); |
| 206 | 193 |
| 207 content::WebContents* left_tab = OpenTestPageAndGetUserMediaInNewTab(); | 194 content::WebContents* left_tab = OpenTestPageAndGetUserMediaInNewTab(); |
| 208 content::WebContents* right_tab = OpenTestPageAndGetUserMediaInNewTab(); | 195 content::WebContents* right_tab = OpenTestPageAndGetUserMediaInNewTab(); |
| 209 | 196 |
| 210 EstablishCall(left_tab, right_tab); | 197 EstablishCall(left_tab, right_tab); |
| 211 | 198 |
| 212 StartDetectingVideo(left_tab, "remote-view"); | 199 StartDetectingVideo(left_tab, "remote-view"); |
| 213 StartDetectingVideo(right_tab, "remote-view"); | 200 StartDetectingVideo(right_tab, "remote-view"); |
| 214 | 201 |
| 215 WaitForVideoToPlay(left_tab); | 202 WaitForVideoToPlay(left_tab); |
| 216 WaitForVideoToPlay(right_tab); | 203 WaitForVideoToPlay(right_tab); |
| 217 | 204 |
| 218 HangUp(left_tab); | 205 HangUp(left_tab); |
| 219 WaitUntilHangupVerified(left_tab); | 206 WaitUntilHangupVerified(left_tab); |
| 220 WaitUntilHangupVerified(right_tab); | 207 WaitUntilHangupVerified(right_tab); |
| 221 | 208 |
| 222 AssertNoAsynchronousErrors(left_tab); | 209 AssertNoAsynchronousErrors(left_tab); |
| 223 AssertNoAsynchronousErrors(right_tab); | 210 AssertNoAsynchronousErrors(right_tab); |
| 224 | 211 |
| 225 ASSERT_TRUE(peerconnection_server_.Stop()); | 212 ASSERT_TRUE(peerconnection_server_.Stop()); |
| 226 } | 213 } |
| 227 | 214 |
| 228 IN_PROC_BROWSER_TEST_F(MAYBE_WebrtcBrowserTest, MANUAL_CpuUsage15Seconds) { | 215 IN_PROC_BROWSER_TEST_F(WebrtcBrowserTest, MANUAL_CpuUsage15Seconds) { |
| 229 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); | 216 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); |
| 230 ASSERT_TRUE(peerconnection_server_.Start()); | 217 ASSERT_TRUE(peerconnection_server_.Start()); |
| 231 | 218 |
| 232 base::FilePath results_file; | 219 base::FilePath results_file; |
| 233 ASSERT_TRUE(base::CreateTemporaryFile(&results_file)); | 220 ASSERT_TRUE(base::CreateTemporaryFile(&results_file)); |
| 234 | 221 |
| 235 content::WebContents* left_tab = OpenTestPageAndGetUserMediaInNewTab(); | 222 content::WebContents* left_tab = OpenTestPageAndGetUserMediaInNewTab(); |
| 236 | 223 |
| 237 #if defined(OS_MACOSX) | 224 #if defined(OS_MACOSX) |
| 238 // Don't measure renderer CPU on mac: requires a mach broker we don't have | 225 // Don't measure renderer CPU on mac: requires a mach broker we don't have |
| (...skipping 30 matching lines...) Expand all Loading... |
| 269 PrintProcessMetrics(renderer_process_metrics.get(), "_r"); | 256 PrintProcessMetrics(renderer_process_metrics.get(), "_r"); |
| 270 #endif | 257 #endif |
| 271 PrintProcessMetrics(browser_process_metrics.get(), "_b"); | 258 PrintProcessMetrics(browser_process_metrics.get(), "_b"); |
| 272 | 259 |
| 273 AssertNoAsynchronousErrors(left_tab); | 260 AssertNoAsynchronousErrors(left_tab); |
| 274 AssertNoAsynchronousErrors(right_tab); | 261 AssertNoAsynchronousErrors(right_tab); |
| 275 | 262 |
| 276 ASSERT_TRUE(peerconnection_server_.Stop()); | 263 ASSERT_TRUE(peerconnection_server_.Stop()); |
| 277 } | 264 } |
| 278 | 265 |
| 279 IN_PROC_BROWSER_TEST_F(MAYBE_WebrtcBrowserTest, | 266 IN_PROC_BROWSER_TEST_F(WebrtcBrowserTest, |
| 280 MANUAL_TestMediaStreamTrackEnableDisable) { | 267 MANUAL_TestMediaStreamTrackEnableDisable) { |
| 281 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); | 268 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); |
| 282 ASSERT_TRUE(peerconnection_server_.Start()); | 269 ASSERT_TRUE(peerconnection_server_.Start()); |
| 283 | 270 |
| 284 content::WebContents* left_tab = OpenTestPageAndGetUserMediaInNewTab(); | 271 content::WebContents* left_tab = OpenTestPageAndGetUserMediaInNewTab(); |
| 285 content::WebContents* right_tab = OpenTestPageAndGetUserMediaInNewTab(); | 272 content::WebContents* right_tab = OpenTestPageAndGetUserMediaInNewTab(); |
| 286 | 273 |
| 287 EstablishCall(left_tab, right_tab); | 274 EstablishCall(left_tab, right_tab); |
| 288 | 275 |
| 289 StartDetectingVideo(left_tab, "remote-view"); | 276 StartDetectingVideo(left_tab, "remote-view"); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 303 HangUp(left_tab); | 290 HangUp(left_tab); |
| 304 WaitUntilHangupVerified(left_tab); | 291 WaitUntilHangupVerified(left_tab); |
| 305 WaitUntilHangupVerified(right_tab); | 292 WaitUntilHangupVerified(right_tab); |
| 306 | 293 |
| 307 AssertNoAsynchronousErrors(left_tab); | 294 AssertNoAsynchronousErrors(left_tab); |
| 308 AssertNoAsynchronousErrors(right_tab); | 295 AssertNoAsynchronousErrors(right_tab); |
| 309 | 296 |
| 310 ASSERT_TRUE(peerconnection_server_.Stop()); | 297 ASSERT_TRUE(peerconnection_server_.Stop()); |
| 311 } | 298 } |
| 312 | 299 |
| 313 IN_PROC_BROWSER_TEST_F(MAYBE_WebrtcBrowserTest, | 300 IN_PROC_BROWSER_TEST_F(WebrtcBrowserTest, |
| 314 MANUAL_RunsAudioVideoCall60SecsAndLogsInternalMetrics) { | 301 MANUAL_RunsAudioVideoCall60SecsAndLogsInternalMetrics) { |
| 315 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); | 302 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); |
| 316 ASSERT_TRUE(peerconnection_server_.Start()); | 303 ASSERT_TRUE(peerconnection_server_.Start()); |
| 317 | 304 |
| 318 ASSERT_GT(TestTimeouts::action_max_timeout().InSeconds(), 80) << | 305 ASSERT_GT(TestTimeouts::action_max_timeout().InSeconds(), 80) << |
| 319 "This is a long-running test; you must specify " | 306 "This is a long-running test; you must specify " |
| 320 "--ui-test-action-max-timeout to have a value of at least 80000."; | 307 "--ui-test-action-max-timeout to have a value of at least 80000."; |
| 321 | 308 |
| 322 content::WebContents* left_tab = OpenTestPageAndGetUserMediaInNewTab(); | 309 content::WebContents* left_tab = OpenTestPageAndGetUserMediaInNewTab(); |
| 323 content::WebContents* right_tab = OpenTestPageAndGetUserMediaInNewTab(); | 310 content::WebContents* right_tab = OpenTestPageAndGetUserMediaInNewTab(); |
| (...skipping 30 matching lines...) Expand all Loading... |
| 354 HangUp(left_tab); | 341 HangUp(left_tab); |
| 355 WaitUntilHangupVerified(left_tab); | 342 WaitUntilHangupVerified(left_tab); |
| 356 WaitUntilHangupVerified(right_tab); | 343 WaitUntilHangupVerified(right_tab); |
| 357 | 344 |
| 358 AssertNoAsynchronousErrors(left_tab); | 345 AssertNoAsynchronousErrors(left_tab); |
| 359 AssertNoAsynchronousErrors(right_tab); | 346 AssertNoAsynchronousErrors(right_tab); |
| 360 | 347 |
| 361 ASSERT_TRUE(peerconnection_server_.Stop()); | 348 ASSERT_TRUE(peerconnection_server_.Stop()); |
| 362 } | 349 } |
| 363 | 350 |
| 364 IN_PROC_BROWSER_TEST_F(MAYBE_WebrtcBrowserTest, TestWebAudioMediaStream) { | 351 IN_PROC_BROWSER_TEST_F(WebrtcBrowserTest, TestWebAudioMediaStream) { |
| 365 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); | 352 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); |
| 366 GURL url(embedded_test_server()->GetURL("/webrtc/webaudio_crash.html")); | 353 GURL url(embedded_test_server()->GetURL("/webrtc/webaudio_crash.html")); |
| 367 ui_test_utils::NavigateToURL(browser(), url); | 354 ui_test_utils::NavigateToURL(browser(), url); |
| 368 content::WebContents* tab = | 355 content::WebContents* tab = |
| 369 browser()->tab_strip_model()->GetActiveWebContents(); | 356 browser()->tab_strip_model()->GetActiveWebContents(); |
| 370 // A sleep is necessary to be able to detect the crash. | 357 // A sleep is necessary to be able to detect the crash. |
| 371 SleepInJavascript(tab, 1000); | 358 SleepInJavascript(tab, 1000); |
| 372 | 359 |
| 373 ASSERT_FALSE(tab->IsCrashed()); | 360 ASSERT_FALSE(tab->IsCrashed()); |
| 374 } | 361 } |
| OLD | NEW |