| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/strings/string_number_conversions.h" |
| 7 #include "base/strings/stringprintf.h" | 8 #include "base/strings/stringprintf.h" |
| 8 #include "base/threading/platform_thread.h" | 9 #include "base/threading/platform_thread.h" |
| 9 #include "base/values.h" | 10 #include "base/values.h" |
| 10 #include "content/browser/media/webrtc_internals.h" | 11 #include "content/browser/media/webrtc_internals.h" |
| 11 #include "content/browser/web_contents/web_contents_impl.h" | 12 #include "content/browser/web_contents/web_contents_impl.h" |
| 12 #include "content/public/common/content_switches.h" | 13 #include "content/public/common/content_switches.h" |
| 13 #include "content/public/test/browser_test_utils.h" | 14 #include "content/public/test/browser_test_utils.h" |
| 14 #include "content/public/test/content_browser_test_utils.h" | 15 #include "content/public/test/content_browser_test_utils.h" |
| 15 #include "content/public/test/test_utils.h" | 16 #include "content/public/test/test_utils.h" |
| 16 #include "content/shell/browser/shell.h" | 17 #include "content/shell/browser/shell.h" |
| (...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 360 IN_PROC_BROWSER_TEST_P(WebRtcBrowserTest, | 361 IN_PROC_BROWSER_TEST_P(WebRtcBrowserTest, |
| 361 MAYBE_EstablishAudioVideoCallAndVerifyUnmutingWorks) { | 362 MAYBE_EstablishAudioVideoCallAndVerifyUnmutingWorks) { |
| 362 MakeAudioDetectingPeerConnectionCall(base::StringPrintf( | 363 MakeAudioDetectingPeerConnectionCall(base::StringPrintf( |
| 363 "callAndEnsureAudioTrackUnmutingWorks(%s);", kUseLenientAudioChecking)); | 364 "callAndEnsureAudioTrackUnmutingWorks(%s);", kUseLenientAudioChecking)); |
| 364 } | 365 } |
| 365 | 366 |
| 366 IN_PROC_BROWSER_TEST_P(WebRtcBrowserTest, CallAndVerifyVideoMutingWorks) { | 367 IN_PROC_BROWSER_TEST_P(WebRtcBrowserTest, CallAndVerifyVideoMutingWorks) { |
| 367 MakeTypicalPeerConnectionCall("callAndEnsureVideoTrackMutingWorks();"); | 368 MakeTypicalPeerConnectionCall("callAndEnsureVideoTrackMutingWorks();"); |
| 368 } | 369 } |
| 369 | 370 |
| 371 #if defined(OS_WIN) |
| 372 #define IntToStringType base::IntToString16 |
| 373 #else |
| 374 #define IntToStringType base::IntToString |
| 375 #endif |
| 376 |
| 370 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) && defined(ARCH_CPU_ARM_FAMILY) | 377 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) && defined(ARCH_CPU_ARM_FAMILY) |
| 371 // Timing out on ARM linux bot: http://crbug.com/238490 | 378 // Timing out on ARM linux bot: http://crbug.com/238490 |
| 372 #define MAYBE_CallWithAecDump DISABLED_CallWithAecDump | 379 #define MAYBE_CallWithAecDump DISABLED_CallWithAecDump |
| 373 #else | 380 #else |
| 374 #define MAYBE_CallWithAecDump CallWithAecDump | 381 #define MAYBE_CallWithAecDump CallWithAecDump |
| 375 #endif | 382 #endif |
| 376 | 383 |
| 377 // This tests will make a complete PeerConnection-based call, verify that | 384 // This tests will make a complete PeerConnection-based call, verify that |
| 378 // video is playing for the call, and verify that a non-empty AEC dump file | 385 // video is playing for the call, and verify that a non-empty AEC dump file |
| 379 // exists. The AEC dump is enabled through webrtc-internals. The HTML and | 386 // exists. The AEC dump is enabled through webrtc-internals. The HTML and |
| (...skipping 11 matching lines...) Expand all Loading... |
| 391 | 398 |
| 392 // This fakes the behavior of another open tab with webrtc-internals, and | 399 // This fakes the behavior of another open tab with webrtc-internals, and |
| 393 // enabling AEC dump in that tab. | 400 // enabling AEC dump in that tab. |
| 394 WebRTCInternals::GetInstance()->FileSelected(dump_file, -1, NULL); | 401 WebRTCInternals::GetInstance()->FileSelected(dump_file, -1, NULL); |
| 395 | 402 |
| 396 GURL url(embedded_test_server()->GetURL("/media/peerconnection-call.html")); | 403 GURL url(embedded_test_server()->GetURL("/media/peerconnection-call.html")); |
| 397 NavigateToURL(shell(), url); | 404 NavigateToURL(shell(), url); |
| 398 DisableOpusIfOnAndroid(); | 405 DisableOpusIfOnAndroid(); |
| 399 ExecuteJavascriptAndWaitForOk("call({video: true, audio: true});"); | 406 ExecuteJavascriptAndWaitForOk("call({video: true, audio: true});"); |
| 400 | 407 |
| 408 // Get the ID for the render process host. There should only be one. |
| 409 RenderProcessHost::iterator it( |
| 410 content::RenderProcessHost::AllHostsIterator()); |
| 411 int render_process_host_id = it.GetCurrentValue()->GetID(); |
| 412 EXPECT_GE(render_process_host_id, 0); |
| 413 |
| 414 // Add file extensions that we expect to be added. |
| 415 static const int kExpectedConsumerId = 0; |
| 416 dump_file = dump_file.AddExtension(IntToStringType(render_process_host_id)) |
| 417 .AddExtension(IntToStringType(kExpectedConsumerId)); |
| 418 |
| 401 EXPECT_TRUE(base::PathExists(dump_file)); | 419 EXPECT_TRUE(base::PathExists(dump_file)); |
| 402 int64 file_size = 0; | 420 int64 file_size = 0; |
| 403 EXPECT_TRUE(base::GetFileSize(dump_file, &file_size)); | 421 EXPECT_TRUE(base::GetFileSize(dump_file, &file_size)); |
| 404 EXPECT_GT(file_size, 0); | 422 EXPECT_GT(file_size, 0); |
| 405 | 423 |
| 406 base::DeleteFile(dump_file, false); | 424 base::DeleteFile(dump_file, false); |
| 407 } | 425 } |
| 408 | 426 |
| 427 // TODO(grunell): Add test for multiple dumps when re-use of |
| 428 // MediaStreamAudioProcessor in AudioCapturer has been removed. |
| 429 |
| 409 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) && defined(ARCH_CPU_ARM_FAMILY) | 430 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) && defined(ARCH_CPU_ARM_FAMILY) |
| 410 // Timing out on ARM linux bot: http://crbug.com/238490 | 431 // Timing out on ARM linux bot: http://crbug.com/238490 |
| 411 #define MAYBE_CallWithAecDumpEnabledThenDisabled DISABLED_CallWithAecDumpEnabled
ThenDisabled | 432 #define MAYBE_CallWithAecDumpEnabledThenDisabled DISABLED_CallWithAecDumpEnabled
ThenDisabled |
| 412 #else | 433 #else |
| 413 #define MAYBE_CallWithAecDumpEnabledThenDisabled CallWithAecDumpEnabledThenDisab
led | 434 #define MAYBE_CallWithAecDumpEnabledThenDisabled CallWithAecDumpEnabledThenDisab
led |
| 414 #endif | 435 #endif |
| 415 | 436 |
| 416 // As above, but enable and disable dump before starting a call. The file should | 437 // As above, but enable and disable dump before starting a call. The file should |
| 417 // be created, but should be empty. | 438 // be created, but should be empty. |
| 418 IN_PROC_BROWSER_TEST_P(WebRtcBrowserTest, | 439 IN_PROC_BROWSER_TEST_P(WebRtcBrowserTest, |
| (...skipping 18 matching lines...) Expand all Loading... |
| 437 | 458 |
| 438 EXPECT_TRUE(base::PathExists(dump_file)); | 459 EXPECT_TRUE(base::PathExists(dump_file)); |
| 439 int64 file_size = 0; | 460 int64 file_size = 0; |
| 440 EXPECT_TRUE(base::GetFileSize(dump_file, &file_size)); | 461 EXPECT_TRUE(base::GetFileSize(dump_file, &file_size)); |
| 441 EXPECT_EQ(0, file_size); | 462 EXPECT_EQ(0, file_size); |
| 442 | 463 |
| 443 base::DeleteFile(dump_file, false); | 464 base::DeleteFile(dump_file, false); |
| 444 } | 465 } |
| 445 | 466 |
| 446 } // namespace content | 467 } // namespace content |
| OLD | NEW |