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" |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "base/message_loop.h" | 12 #include "base/message_loop.h" |
13 #include "base/path_service.h" | 13 #include "base/path_service.h" |
14 #include "base/test/test_timeouts.h" | 14 #include "base/test/test_timeouts.h" |
15 #include "base/win/scoped_com_initializer.h" | 15 #include "base/win/scoped_com_initializer.h" |
16 #include "media/audio/audio_io.h" | 16 #include "media/audio/audio_io.h" |
17 #include "media/audio/audio_manager_base.h" | 17 #include "media/audio/audio_manager_base.h" |
18 #include "media/audio/win/audio_low_latency_input_win.h" | 18 #include "media/audio/win/audio_low_latency_input_win.h" |
19 #include "media/base/seekable_buffer.h" | 19 #include "media/base/seekable_buffer.h" |
20 #include "testing/gmock/include/gmock/gmock.h" | 20 #include "testing/gmock/include/gmock/gmock.h" |
21 #include "testing/gtest/include/gtest/gtest.h" | 21 #include "testing/gtest/include/gtest/gtest.h" |
22 | 22 |
23 using base::win::ScopedCOMInitializer; | 23 using base::win::ScopedCOMInitializer; |
24 using ::testing::_; | 24 using ::testing::_; |
25 using ::testing::AnyNumber; | 25 using ::testing::AnyNumber; |
26 using ::testing::AtLeast; | 26 using ::testing::AtLeast; |
27 using ::testing::Gt; | 27 using ::testing::Gt; |
28 using ::testing::NotNull; | 28 using ::testing::NotNull; |
29 | 29 |
30 namespace media { | |
31 | |
32 ACTION_P3(CheckCountAndPostQuitTask, count, limit, loop) { | 30 ACTION_P3(CheckCountAndPostQuitTask, count, limit, loop) { |
33 if (++*count >= limit) { | 31 if (++*count >= limit) { |
34 loop->PostTask(FROM_HERE, MessageLoop::QuitClosure()); | 32 loop->PostTask(FROM_HERE, MessageLoop::QuitClosure()); |
35 } | 33 } |
36 } | 34 } |
37 | 35 |
38 class MockAudioInputCallback : public AudioInputStream::AudioInputCallback { | 36 class MockAudioInputCallback : public AudioInputStream::AudioInputCallback { |
39 public: | 37 public: |
40 MOCK_METHOD5(OnData, void(AudioInputStream* stream, | 38 MOCK_METHOD5(OnData, void(AudioInputStream* stream, |
41 const uint8* src, uint32 size, | 39 const uint8* src, uint32 size, |
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
387 | 385 |
388 LOG(INFO) << ">> Sample rate: " << aisw.sample_rate() << " [Hz]"; | 386 LOG(INFO) << ">> Sample rate: " << aisw.sample_rate() << " [Hz]"; |
389 WriteToFileAudioSink file_sink(file_name); | 387 WriteToFileAudioSink file_sink(file_name); |
390 LOG(INFO) << ">> Speak into the default microphone while recording."; | 388 LOG(INFO) << ">> Speak into the default microphone while recording."; |
391 ais->Start(&file_sink); | 389 ais->Start(&file_sink); |
392 base::PlatformThread::Sleep(TestTimeouts::action_timeout_ms()); | 390 base::PlatformThread::Sleep(TestTimeouts::action_timeout_ms()); |
393 ais->Stop(); | 391 ais->Stop(); |
394 LOG(INFO) << ">> Recording has stopped."; | 392 LOG(INFO) << ">> Recording has stopped."; |
395 ais->Close(); | 393 ais->Close(); |
396 } | 394 } |
397 | |
398 } // namespace media | |
OLD | NEW |