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 <stdint.h> | 5 #include <stdint.h> |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 | 8 |
9 #include "base/environment.h" | 9 #include "base/environment.h" |
10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
11 #include "base/run_loop.h" | 11 #include "base/run_loop.h" |
| 12 #include "base/single_thread_task_runner.h" |
12 #include "base/test/test_timeouts.h" | 13 #include "base/test/test_timeouts.h" |
13 #include "base/threading/platform_thread.h" | 14 #include "base/threading/platform_thread.h" |
14 #include "media/audio/audio_device_description.h" | 15 #include "media/audio/audio_device_description.h" |
15 #include "media/audio/audio_io.h" | 16 #include "media/audio/audio_io.h" |
16 #include "media/audio/audio_manager_base.h" | 17 #include "media/audio/audio_manager_base.h" |
17 #include "media/audio/audio_unittest_util.h" | 18 #include "media/audio/audio_unittest_util.h" |
18 #include "media/audio/mac/audio_low_latency_input_mac.h" | 19 #include "media/audio/mac/audio_low_latency_input_mac.h" |
19 #include "media/base/seekable_buffer.h" | 20 #include "media/base/seekable_buffer.h" |
20 #include "testing/gmock/include/gmock/gmock.h" | 21 #include "testing/gmock/include/gmock/gmock.h" |
21 #include "testing/gtest/include/gtest/gtest.h" | 22 #include "testing/gtest/include/gtest/gtest.h" |
22 | 23 |
23 using ::testing::_; | 24 using ::testing::_; |
24 using ::testing::AnyNumber; | 25 using ::testing::AnyNumber; |
25 using ::testing::AtLeast; | 26 using ::testing::AtLeast; |
26 using ::testing::Ge; | 27 using ::testing::Ge; |
27 using ::testing::NotNull; | 28 using ::testing::NotNull; |
28 | 29 |
29 namespace media { | 30 namespace media { |
30 | 31 |
31 ACTION_P4(CheckCountAndPostQuitTask, count, limit, loop, closure) { | 32 ACTION_P4(CheckCountAndPostQuitTask, count, limit, loop, closure) { |
32 if (++*count >= limit) { | 33 if (++*count >= limit) { |
33 loop->PostTask(FROM_HERE, closure); | 34 loop->task_runner()->PostTask(FROM_HERE, closure); |
34 } | 35 } |
35 } | 36 } |
36 | 37 |
37 class MockAudioInputCallback : public AudioInputStream::AudioInputCallback { | 38 class MockAudioInputCallback : public AudioInputStream::AudioInputCallback { |
38 public: | 39 public: |
39 MOCK_METHOD4(OnData, | 40 MOCK_METHOD4(OnData, |
40 void(AudioInputStream* stream, | 41 void(AudioInputStream* stream, |
41 const AudioBus* src, | 42 const AudioBus* src, |
42 uint32_t hardware_delay_bytes, | 43 uint32_t hardware_delay_bytes, |
43 double volume)); | 44 double volume)); |
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
279 WriteToFileAudioSink file_sink(file_name); | 280 WriteToFileAudioSink file_sink(file_name); |
280 fprintf(stderr, " >> Speak into the mic while recording...\n"); | 281 fprintf(stderr, " >> Speak into the mic while recording...\n"); |
281 ais->Start(&file_sink); | 282 ais->Start(&file_sink); |
282 base::PlatformThread::Sleep(TestTimeouts::action_timeout()); | 283 base::PlatformThread::Sleep(TestTimeouts::action_timeout()); |
283 ais->Stop(); | 284 ais->Stop(); |
284 fprintf(stderr, " >> Recording has stopped.\n"); | 285 fprintf(stderr, " >> Recording has stopped.\n"); |
285 ais->Close(); | 286 ais->Close(); |
286 } | 287 } |
287 | 288 |
288 } // namespace media | 289 } // namespace media |
OLD | NEW |