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