| 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/strings/stringprintf.h" | 6 #include "base/strings/stringprintf.h" |
| 7 #include "base/values.h" | 7 #include "base/values.h" |
| 8 #include "content/browser/media/webrtc_internals.h" | 8 #include "content/browser/media/webrtc_internals.h" |
| 9 #include "content/browser/web_contents/web_contents_impl.h" | 9 #include "content/browser/web_contents/web_contents_impl.h" |
| 10 #include "content/public/common/content_switches.h" | 10 #include "content/public/common/content_switches.h" |
| 11 #include "content/public/test/browser_test_utils.h" | 11 #include "content/public/test/browser_test_utils.h" |
| 12 #include "content/public/test/content_browser_test_utils.h" | 12 #include "content/public/test/content_browser_test_utils.h" |
| 13 #include "content/public/test/test_utils.h" | 13 #include "content/public/test/test_utils.h" |
| 14 #include "content/shell/browser/shell.h" | 14 #include "content/shell/browser/shell.h" |
| 15 #include "content/test/webrtc_content_browsertest_base.h" | 15 #include "content/test/webrtc_content_browsertest_base.h" |
| 16 #include "media/audio/audio_manager.h" | 16 #include "media/audio/audio_manager.h" |
| 17 #include "net/test/embedded_test_server/embedded_test_server.h" | 17 #include "net/test/embedded_test_server/embedded_test_server.h" |
| 18 | 18 |
| 19 #if defined(OS_WIN) | 19 #if defined(OS_WIN) |
| 20 #include "base/win/windows_version.h" | 20 #include "base/win/windows_version.h" |
| 21 #endif | 21 #endif |
| 22 | 22 |
| 23 #if defined (OS_ANDROID) || defined(THREAD_SANITIZER) |
| 24 // Just do the bare minimum of audio checking on Android and under TSAN since |
| 25 // it's a bit sensitive to device performance. |
| 26 static const char kUseLenientAudioChecking[] = "true"; |
| 27 #else |
| 28 static const char kUseLenientAudioChecking[] = "false"; |
| 29 #endif |
| 30 |
| 23 namespace content { | 31 namespace content { |
| 24 | 32 |
| 25 class WebRtcBrowserTest : public WebRtcContentBrowserTest, | 33 class WebRtcBrowserTest : public WebRtcContentBrowserTest, |
| 26 public testing::WithParamInterface<bool> { | 34 public testing::WithParamInterface<bool> { |
| 27 public: | 35 public: |
| 28 WebRtcBrowserTest() {} | 36 WebRtcBrowserTest() {} |
| 29 virtual ~WebRtcBrowserTest() {} | 37 virtual ~WebRtcBrowserTest() {} |
| 30 | 38 |
| 31 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { | 39 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { |
| 32 WebRtcContentBrowserTest::SetUpCommandLine(command_line); | 40 WebRtcContentBrowserTest::SetUpCommandLine(command_line); |
| (...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 298 // such bots (see crbug.com/326338). | 306 // such bots (see crbug.com/326338). |
| 299 LOG(INFO) << "Missing output devices: skipping test..."; | 307 LOG(INFO) << "Missing output devices: skipping test..."; |
| 300 return; | 308 return; |
| 301 } | 309 } |
| 302 | 310 |
| 303 ASSERT_TRUE(CommandLine::ForCurrentProcess()->HasSwitch( | 311 ASSERT_TRUE(CommandLine::ForCurrentProcess()->HasSwitch( |
| 304 switches::kUseFakeDeviceForMediaStream)) | 312 switches::kUseFakeDeviceForMediaStream)) |
| 305 << "Must run with fake devices since the test will explicitly look " | 313 << "Must run with fake devices since the test will explicitly look " |
| 306 << "for the fake device signal."; | 314 << "for the fake device signal."; |
| 307 | 315 |
| 308 MakeTypicalPeerConnectionCall("callAndEnsureAudioIsPlaying();"); | 316 MakeTypicalPeerConnectionCall(base::StringPrintf( |
| 317 "callAndEnsureAudioIsPlaying(%s);", kUseLenientAudioChecking)); |
| 309 } | 318 } |
| 310 | 319 |
| 311 IN_PROC_BROWSER_TEST_P(WebRtcBrowserTest, | 320 IN_PROC_BROWSER_TEST_P(WebRtcBrowserTest, |
| 312 EstablishAudioVideoCallAndVerifyMutingWorks) { | 321 EstablishAudioVideoCallAndVerifyMutingWorks) { |
| 313 if (!media::AudioManager::Get()->HasAudioOutputDevices()) { | 322 if (!media::AudioManager::Get()->HasAudioOutputDevices()) { |
| 314 // Bots with no output devices will force the audio code into a different | 323 // See comment on EstablishAudioVideoCallAndMeasureOutputLevel. |
| 315 // path where it doesn't manage to set either the low or high latency path. | |
| 316 // This test will compute useless values in that case, so skip running on | |
| 317 // such bots (see crbug.com/326338). | |
| 318 LOG(INFO) << "Missing output devices: skipping test..."; | 324 LOG(INFO) << "Missing output devices: skipping test..."; |
| 319 return; | 325 return; |
| 320 } | 326 } |
| 321 | 327 |
| 322 ASSERT_TRUE(CommandLine::ForCurrentProcess()->HasSwitch( | 328 ASSERT_TRUE(CommandLine::ForCurrentProcess()->HasSwitch( |
| 323 switches::kUseFakeDeviceForMediaStream)) | 329 switches::kUseFakeDeviceForMediaStream)) |
| 324 << "Must run with fake devices since the test will explicitly look " | 330 << "Must run with fake devices since the test will explicitly look " |
| 325 << "for the fake device signal."; | 331 << "for the fake device signal."; |
| 326 | 332 |
| 327 MakeTypicalPeerConnectionCall("callAndEnsureAudioTrackMutingWorks();"); | 333 MakeTypicalPeerConnectionCall(base::StringPrintf( |
| 334 "callAndEnsureAudioTrackMutingWorks(%s);", kUseLenientAudioChecking)); |
| 328 } | 335 } |
| 329 | 336 |
| 330 IN_PROC_BROWSER_TEST_P(WebRtcBrowserTest, | 337 IN_PROC_BROWSER_TEST_P(WebRtcBrowserTest, |
| 331 EstablishAudioVideoCallAndVerifyUnmutingWorks) { | 338 EstablishAudioVideoCallAndVerifyUnmutingWorks) { |
| 332 if (!media::AudioManager::Get()->HasAudioOutputDevices()) { | 339 if (!media::AudioManager::Get()->HasAudioOutputDevices()) { |
| 333 // See comment on EstablishAudioVideoCallAndVerifyMutingWorks. | 340 // See comment on EstablishAudioVideoCallAndMeasureOutputLevel. |
| 334 LOG(INFO) << "Missing output devices: skipping test..."; | 341 LOG(INFO) << "Missing output devices: skipping test..."; |
| 335 return; | 342 return; |
| 336 } | 343 } |
| 337 | 344 |
| 338 ASSERT_TRUE(CommandLine::ForCurrentProcess()->HasSwitch( | 345 ASSERT_TRUE(CommandLine::ForCurrentProcess()->HasSwitch( |
| 339 switches::kUseFakeDeviceForMediaStream)) | 346 switches::kUseFakeDeviceForMediaStream)) |
| 340 << "Must run with fake devices since the test will explicitly look " | 347 << "Must run with fake devices since the test will explicitly look " |
| 341 << "for the fake device signal."; | 348 << "for the fake device signal."; |
| 342 | 349 |
| 343 MakeTypicalPeerConnectionCall("callAndEnsureAudioTrackUnmutingWorks();"); | 350 MakeTypicalPeerConnectionCall(base::StringPrintf( |
| 351 "callAndEnsureAudioTrackUnmutingWorks(%s);", kUseLenientAudioChecking)); |
| 344 } | 352 } |
| 345 | 353 |
| 346 IN_PROC_BROWSER_TEST_P(WebRtcBrowserTest, CallAndVerifyVideoMutingWorks) { | 354 IN_PROC_BROWSER_TEST_P(WebRtcBrowserTest, CallAndVerifyVideoMutingWorks) { |
| 347 MakeTypicalPeerConnectionCall("callAndEnsureVideoTrackMutingWorks();"); | 355 MakeTypicalPeerConnectionCall("callAndEnsureVideoTrackMutingWorks();"); |
| 348 } | 356 } |
| 349 | 357 |
| 350 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) && defined(ARCH_CPU_ARM_FAMILY) | 358 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) && defined(ARCH_CPU_ARM_FAMILY) |
| 351 // Timing out on ARM linux bot: http://crbug.com/238490 | 359 // Timing out on ARM linux bot: http://crbug.com/238490 |
| 352 #define MAYBE_CallWithAecDump DISABLED_CallWithAecDump | 360 #define MAYBE_CallWithAecDump DISABLED_CallWithAecDump |
| 353 #else | 361 #else |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 417 | 425 |
| 418 EXPECT_TRUE(base::PathExists(dump_file)); | 426 EXPECT_TRUE(base::PathExists(dump_file)); |
| 419 int64 file_size = 0; | 427 int64 file_size = 0; |
| 420 EXPECT_TRUE(base::GetFileSize(dump_file, &file_size)); | 428 EXPECT_TRUE(base::GetFileSize(dump_file, &file_size)); |
| 421 EXPECT_EQ(0, file_size); | 429 EXPECT_EQ(0, file_size); |
| 422 | 430 |
| 423 base::DeleteFile(dump_file, false); | 431 base::DeleteFile(dump_file, false); |
| 424 } | 432 } |
| 425 | 433 |
| 426 } // namespace content | 434 } // namespace content |
| OLD | NEW |