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 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
416 Return(aosw.samples_per_packet()))); | 416 Return(aosw.samples_per_packet()))); |
417 | 417 |
418 aos->Start(&source); | 418 aos->Start(&source); |
419 loop.PostDelayedTask(FROM_HERE, base::MessageLoop::QuitClosure(), | 419 loop.PostDelayedTask(FROM_HERE, base::MessageLoop::QuitClosure(), |
420 TestTimeouts::action_timeout()); | 420 TestTimeouts::action_timeout()); |
421 loop.Run(); | 421 loop.Run(); |
422 aos->Stop(); | 422 aos->Stop(); |
423 aos->Close(); | 423 aos->Close(); |
424 } | 424 } |
425 | 425 |
426 // Use a non-preferred packet size and verify that Open() fails. | |
427 TEST(WASAPIAudioOutputStreamTest, InvalidPacketSize) { | |
428 scoped_ptr<AudioManager> audio_manager(AudioManager::CreateForTesting()); | |
429 if (!CanRunAudioTests(audio_manager.get())) | |
430 return; | |
431 | |
432 if (ExclusiveModeIsEnabled()) | |
433 return; | |
434 | |
435 AudioParameters preferred_params; | |
436 EXPECT_TRUE(SUCCEEDED(CoreAudioUtil::GetPreferredAudioParameters( | |
437 eRender, eConsole, &preferred_params))); | |
438 int too_large_packet_size = 2 * preferred_params.frames_per_buffer(); | |
439 | |
440 AudioOutputStreamWrapper aosw(audio_manager.get()); | |
441 AudioOutputStream* aos = aosw.Create(too_large_packet_size); | |
442 EXPECT_FALSE(aos->Open()); | |
443 | |
444 aos->Close(); | |
445 } | |
446 | |
447 // This test is intended for manual tests and should only be enabled | 426 // This test is intended for manual tests and should only be enabled |
448 // when it is required to play out data from a local PCM file. | 427 // when it is required to play out data from a local PCM file. |
449 // By default, GTest will print out YOU HAVE 1 DISABLED TEST. | 428 // By default, GTest will print out YOU HAVE 1 DISABLED TEST. |
450 // To include disabled tests in test execution, just invoke the test program | 429 // To include disabled tests in test execution, just invoke the test program |
451 // with --gtest_also_run_disabled_tests or set the GTEST_ALSO_RUN_DISABLED_TESTS | 430 // with --gtest_also_run_disabled_tests or set the GTEST_ALSO_RUN_DISABLED_TESTS |
452 // environment variable to a value greater than 0. | 431 // environment variable to a value greater than 0. |
453 // The test files are approximately 20 seconds long. | 432 // The test files are approximately 20 seconds long. |
454 TEST(WASAPIAudioOutputStreamTest, DISABLED_ReadFromStereoFile) { | 433 TEST(WASAPIAudioOutputStreamTest, DISABLED_ReadFromStereoFile) { |
455 scoped_ptr<AudioManager> audio_manager(AudioManager::CreateForTesting()); | 434 scoped_ptr<AudioManager> audio_manager(AudioManager::CreateForTesting()); |
456 if (!CanRunAudioTests(audio_manager.get())) | 435 if (!CanRunAudioTests(audio_manager.get())) |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
684 | 663 |
685 aos->Start(&source); | 664 aos->Start(&source); |
686 loop.PostDelayedTask(FROM_HERE, base::MessageLoop::QuitClosure(), | 665 loop.PostDelayedTask(FROM_HERE, base::MessageLoop::QuitClosure(), |
687 TestTimeouts::action_timeout()); | 666 TestTimeouts::action_timeout()); |
688 loop.Run(); | 667 loop.Run(); |
689 aos->Stop(); | 668 aos->Stop(); |
690 aos->Close(); | 669 aos->Close(); |
691 } | 670 } |
692 | 671 |
693 } // namespace media | 672 } // namespace media |
OLD | NEW |