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 "base/bind.h" | 5 #include "base/bind.h" |
6 #include "base/environment.h" | 6 #include "base/environment.h" |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "base/synchronization/waitable_event.h" | 10 #include "base/synchronization/waitable_event.h" |
11 #include "media/audio/audio_output_controller.h" | 11 #include "media/audio/audio_output_controller.h" |
12 #include "testing/gmock/include/gmock/gmock.h" | 12 #include "testing/gmock/include/gmock/gmock.h" |
13 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
14 | 14 |
15 // TODO(vrk): These tests need to be rewritten! (crbug.com/112500) | 15 // TODO(vrk): These tests need to be rewritten! (crbug.com/112500) |
16 | 16 |
17 using ::testing::_; | 17 using ::testing::_; |
18 using ::testing::AtLeast; | 18 using ::testing::AtLeast; |
19 using ::testing::DoAll; | 19 using ::testing::DoAll; |
20 using ::testing::Exactly; | 20 using ::testing::Exactly; |
21 using ::testing::InvokeWithoutArgs; | 21 using ::testing::InvokeWithoutArgs; |
22 using ::testing::NotNull; | 22 using ::testing::NotNull; |
23 using ::testing::Return; | 23 using ::testing::Return; |
24 | 24 |
| 25 namespace media { |
| 26 |
25 static const int kSampleRate = AudioParameters::kAudioCDSampleRate; | 27 static const int kSampleRate = AudioParameters::kAudioCDSampleRate; |
26 static const int kBitsPerSample = 16; | 28 static const int kBitsPerSample = 16; |
27 static const ChannelLayout kChannelLayout = CHANNEL_LAYOUT_STEREO; | 29 static const ChannelLayout kChannelLayout = CHANNEL_LAYOUT_STEREO; |
28 static const int kSamplesPerPacket = kSampleRate / 10; | 30 static const int kSamplesPerPacket = kSampleRate / 10; |
29 static const int kHardwareBufferSize = kSamplesPerPacket * | 31 static const int kHardwareBufferSize = kSamplesPerPacket * |
30 ChannelLayoutToChannelCount(kChannelLayout) * kBitsPerSample / 8; | 32 ChannelLayoutToChannelCount(kChannelLayout) * kBitsPerSample / 8; |
31 | 33 |
32 namespace media { | |
33 | |
34 class MockAudioOutputControllerEventHandler | 34 class MockAudioOutputControllerEventHandler |
35 : public AudioOutputController::EventHandler { | 35 : public AudioOutputController::EventHandler { |
36 public: | 36 public: |
37 MockAudioOutputControllerEventHandler() {} | 37 MockAudioOutputControllerEventHandler() {} |
38 | 38 |
39 MOCK_METHOD1(OnCreated, void(AudioOutputController* controller)); | 39 MOCK_METHOD1(OnCreated, void(AudioOutputController* controller)); |
40 MOCK_METHOD1(OnPlaying, void(AudioOutputController* controller)); | 40 MOCK_METHOD1(OnPlaying, void(AudioOutputController* controller)); |
41 MOCK_METHOD1(OnPaused, void(AudioOutputController* controller)); | 41 MOCK_METHOD1(OnPaused, void(AudioOutputController* controller)); |
42 MOCK_METHOD2(OnError, void(AudioOutputController* controller, | 42 MOCK_METHOD2(OnError, void(AudioOutputController* controller, |
43 int error_code)); | 43 int error_code)); |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 scoped_refptr<AudioOutputController> controller = | 169 scoped_refptr<AudioOutputController> controller = |
170 AudioOutputController::Create( | 170 AudioOutputController::Create( |
171 audio_manager.get(), &event_handler, params, &sync_reader); | 171 audio_manager.get(), &event_handler, params, &sync_reader); |
172 | 172 |
173 // Use assert because we don't stop the device and assume we can't | 173 // Use assert because we don't stop the device and assume we can't |
174 // create one. | 174 // create one. |
175 ASSERT_FALSE(controller); | 175 ASSERT_FALSE(controller); |
176 } | 176 } |
177 | 177 |
178 } // namespace media | 178 } // namespace media |
OLD | NEW |