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 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
11 | 11 |
12 #include "base/base_paths.h" | 12 #include "base/base_paths.h" |
13 #include "base/memory/aligned_memory.h" | 13 #include "base/memory/aligned_memory.h" |
| 14 #include "base/memory/ptr_util.h" |
14 #include "base/message_loop/message_loop.h" | 15 #include "base/message_loop/message_loop.h" |
15 #include "base/run_loop.h" | 16 #include "base/run_loop.h" |
16 #include "base/sync_socket.h" | 17 #include "base/sync_socket.h" |
17 #include "base/time/time.h" | 18 #include "base/time/time.h" |
18 #include "base/win/scoped_com_initializer.h" | 19 #include "base/win/scoped_com_initializer.h" |
19 #include "base/win/windows_version.h" | 20 #include "base/win/windows_version.h" |
20 #include "media/audio/audio_io.h" | 21 #include "media/audio/audio_io.h" |
21 #include "media/audio/audio_manager.h" | 22 #include "media/audio/audio_manager.h" |
22 #include "media/audio/audio_unittest_util.h" | 23 #include "media/audio/audio_unittest_util.h" |
23 #include "media/audio/mock_audio_source_callback.h" | 24 #include "media/audio/mock_audio_source_callback.h" |
24 #include "media/audio/simple_sources.h" | 25 #include "media/audio/simple_sources.h" |
| 26 #include "media/audio/test_audio_thread.h" |
25 #include "media/base/limits.h" | 27 #include "media/base/limits.h" |
26 #include "testing/gmock/include/gmock/gmock.h" | 28 #include "testing/gmock/include/gmock/gmock.h" |
27 #include "testing/gtest/include/gtest/gtest.h" | 29 #include "testing/gtest/include/gtest/gtest.h" |
28 | 30 |
29 using ::testing::_; | 31 using ::testing::_; |
30 using ::testing::AnyNumber; | 32 using ::testing::AnyNumber; |
31 using ::testing::DoAll; | 33 using ::testing::DoAll; |
32 using ::testing::Field; | 34 using ::testing::Field; |
33 using ::testing::Invoke; | 35 using ::testing::Invoke; |
34 using ::testing::InSequence; | 36 using ::testing::InSequence; |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 private: | 149 private: |
148 HANDLE fmap_; | 150 HANDLE fmap_; |
149 char* start_; | 151 char* start_; |
150 uint32_t size_; | 152 uint32_t size_; |
151 }; | 153 }; |
152 | 154 |
153 class WinAudioTest : public ::testing::Test { | 155 class WinAudioTest : public ::testing::Test { |
154 public: | 156 public: |
155 WinAudioTest() { | 157 WinAudioTest() { |
156 audio_manager_ = | 158 audio_manager_ = |
157 AudioManager::CreateForTesting(message_loop_.task_runner()); | 159 AudioManager::CreateForTesting(base::MakeUnique<TestAudioThread>()); |
158 base::RunLoop().RunUntilIdle(); | 160 base::RunLoop().RunUntilIdle(); |
159 } | 161 } |
160 ~WinAudioTest() override { | 162 ~WinAudioTest() override { audio_manager_->Shutdown(); } |
161 audio_manager_.reset(); | |
162 base::RunLoop().RunUntilIdle(); | |
163 } | |
164 | 163 |
165 protected: | 164 protected: |
166 base::MessageLoop message_loop_; | 165 base::MessageLoop message_loop_; |
167 ScopedAudioManagerPtr audio_manager_; | 166 std::unique_ptr<AudioManager> audio_manager_; |
168 }; | 167 }; |
169 | 168 |
170 // =========================================================================== | 169 // =========================================================================== |
171 // Validation of AudioManager::AUDIO_PCM_LINEAR | 170 // Validation of AudioManager::AUDIO_PCM_LINEAR |
172 // | 171 // |
173 // NOTE: | 172 // NOTE: |
174 // The tests can fail on the build bots when somebody connects to them via | 173 // The tests can fail on the build bots when somebody connects to them via |
175 // remote-desktop and the rdp client installs an audio device that fails to open | 174 // remote-desktop and the rdp client installs an audio device that fails to open |
176 // at some point, possibly when the connection goes idle. | 175 // at some point, possibly when the connection goes idle. |
177 | 176 |
(...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
658 oas->Start(&source); | 657 oas->Start(&source); |
659 | 658 |
660 ::WaitForSingleObject(thread, INFINITE); | 659 ::WaitForSingleObject(thread, INFINITE); |
661 ::CloseHandle(thread); | 660 ::CloseHandle(thread); |
662 | 661 |
663 oas->Stop(); | 662 oas->Stop(); |
664 oas->Close(); | 663 oas->Close(); |
665 } | 664 } |
666 | 665 |
667 } // namespace media | 666 } // namespace media |
OLD | NEW |