| 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 <windows.h> | 5 #include <windows.h> |
| 6 #include <mmsystem.h> | 6 #include <mmsystem.h> |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/environment.h" | 9 #include "base/environment.h" |
| 10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
| (...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 403 EXPECT_CALL(source, OnMoreData(aos, NotNull(), bytes_per_packet, | 403 EXPECT_CALL(source, OnMoreData(aos, NotNull(), bytes_per_packet, |
| 404 HasValidDelay(state))) | 404 HasValidDelay(state))) |
| 405 .WillOnce( | 405 .WillOnce( |
| 406 DoAll( | 406 DoAll( |
| 407 InvokeWithoutArgs( | 407 InvokeWithoutArgs( |
| 408 CreateFunctor(&QuitMessageLoop, proxy.get())), | 408 CreateFunctor(&QuitMessageLoop, proxy.get())), |
| 409 Return(bytes_per_packet))); | 409 Return(bytes_per_packet))); |
| 410 | 410 |
| 411 aos->Start(&source); | 411 aos->Start(&source); |
| 412 loop.PostDelayedTask(FROM_HERE, MessageLoop::QuitClosure(), | 412 loop.PostDelayedTask(FROM_HERE, MessageLoop::QuitClosure(), |
| 413 TestTimeouts::action_timeout_ms()); | 413 TestTimeouts::action_timeout()); |
| 414 loop.Run(); | 414 loop.Run(); |
| 415 aos->Stop(); | 415 aos->Stop(); |
| 416 aos->Close(); | 416 aos->Close(); |
| 417 } | 417 } |
| 418 | 418 |
| 419 // Use a fixed packets size (independent of sample rate) and verify | 419 // Use a fixed packets size (independent of sample rate) and verify |
| 420 // that rendering starts. | 420 // that rendering starts. |
| 421 TEST(WinAudioOutputTest, WASAPIAudioOutputStreamTestPacketSizeInSamples) { | 421 TEST(WinAudioOutputTest, WASAPIAudioOutputStreamTestPacketSizeInSamples) { |
| 422 scoped_ptr<AudioManager> audio_manager(AudioManager::Create()); | 422 scoped_ptr<AudioManager> audio_manager(AudioManager::Create()); |
| 423 if (!CanRunAudioTests(audio_manager.get())) | 423 if (!CanRunAudioTests(audio_manager.get())) |
| (...skipping 21 matching lines...) Expand all Loading... |
| 445 EXPECT_CALL(source, OnMoreData(aos, NotNull(), bytes_per_packet, | 445 EXPECT_CALL(source, OnMoreData(aos, NotNull(), bytes_per_packet, |
| 446 HasValidDelay(state))) | 446 HasValidDelay(state))) |
| 447 .WillOnce( | 447 .WillOnce( |
| 448 DoAll( | 448 DoAll( |
| 449 InvokeWithoutArgs( | 449 InvokeWithoutArgs( |
| 450 CreateFunctor(&QuitMessageLoop, proxy.get())), | 450 CreateFunctor(&QuitMessageLoop, proxy.get())), |
| 451 Return(bytes_per_packet))); | 451 Return(bytes_per_packet))); |
| 452 | 452 |
| 453 aos->Start(&source); | 453 aos->Start(&source); |
| 454 loop.PostDelayedTask(FROM_HERE, MessageLoop::QuitClosure(), | 454 loop.PostDelayedTask(FROM_HERE, MessageLoop::QuitClosure(), |
| 455 TestTimeouts::action_timeout_ms()); | 455 TestTimeouts::action_timeout()); |
| 456 loop.Run(); | 456 loop.Run(); |
| 457 aos->Stop(); | 457 aos->Stop(); |
| 458 aos->Close(); | 458 aos->Close(); |
| 459 } | 459 } |
| 460 | 460 |
| 461 TEST(WinAudioOutputTest, WASAPIAudioOutputStreamTestMono) { | 461 TEST(WinAudioOutputTest, WASAPIAudioOutputStreamTestMono) { |
| 462 scoped_ptr<AudioManager> audio_manager(AudioManager::Create()); | 462 scoped_ptr<AudioManager> audio_manager(AudioManager::Create()); |
| 463 if (!CanRunAudioTests(audio_manager.get())) | 463 if (!CanRunAudioTests(audio_manager.get())) |
| 464 return; | 464 return; |
| 465 | 465 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 491 EXPECT_CALL(source, OnMoreData(aos, NotNull(), bytes_per_packet, | 491 EXPECT_CALL(source, OnMoreData(aos, NotNull(), bytes_per_packet, |
| 492 HasValidDelay(state))) | 492 HasValidDelay(state))) |
| 493 .WillOnce( | 493 .WillOnce( |
| 494 DoAll( | 494 DoAll( |
| 495 InvokeWithoutArgs( | 495 InvokeWithoutArgs( |
| 496 CreateFunctor(&QuitMessageLoop, proxy.get())), | 496 CreateFunctor(&QuitMessageLoop, proxy.get())), |
| 497 Return(bytes_per_packet))); | 497 Return(bytes_per_packet))); |
| 498 | 498 |
| 499 aos->Start(&source); | 499 aos->Start(&source); |
| 500 loop.PostDelayedTask(FROM_HERE, MessageLoop::QuitClosure(), | 500 loop.PostDelayedTask(FROM_HERE, MessageLoop::QuitClosure(), |
| 501 TestTimeouts::action_timeout_ms()); | 501 TestTimeouts::action_timeout()); |
| 502 loop.Run(); | 502 loop.Run(); |
| 503 aos->Stop(); | 503 aos->Stop(); |
| 504 aos->Close(); | 504 aos->Close(); |
| 505 } | 505 } |
| 506 | 506 |
| 507 // This test is intended for manual tests and should only be enabled | 507 // This test is intended for manual tests and should only be enabled |
| 508 // when it is required to store the captured data on a local file. | 508 // when it is required to store the captured data on a local file. |
| 509 // By default, GTest will print out YOU HAVE 1 DISABLED TEST. | 509 // By default, GTest will print out YOU HAVE 1 DISABLED TEST. |
| 510 // To include disabled tests in test execution, just invoke the test program | 510 // To include disabled tests in test execution, just invoke the test program |
| 511 // with --gtest_also_run_disabled_tests or set the GTEST_ALSO_RUN_DISABLED_TESTS | 511 // with --gtest_also_run_disabled_tests or set the GTEST_ALSO_RUN_DISABLED_TESTS |
| (...skipping 30 matching lines...) Expand all Loading... |
| 542 aos->Start(&file_source); | 542 aos->Start(&file_source); |
| 543 base::PlatformThread::Sleep( | 543 base::PlatformThread::Sleep( |
| 544 base::TimeDelta::FromMilliseconds(kFileDurationMs)); | 544 base::TimeDelta::FromMilliseconds(kFileDurationMs)); |
| 545 aos->Stop(); | 545 aos->Stop(); |
| 546 | 546 |
| 547 LOG(INFO) << ">> File playout has stopped."; | 547 LOG(INFO) << ">> File playout has stopped."; |
| 548 aos->Close(); | 548 aos->Close(); |
| 549 } | 549 } |
| 550 | 550 |
| 551 } // namespace media | 551 } // namespace media |
| OLD | NEW |