| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/basictypes.h" | 5 #include "base/basictypes.h" |
| 6 #include "base/synchronization/waitable_event.h" | 6 #include "base/synchronization/waitable_event.h" |
| 7 #include "media/audio/audio_input_controller.h" | 7 #include "media/audio/audio_input_controller.h" |
| 8 #include "testing/gmock/include/gmock/gmock.h" | 8 #include "testing/gmock/include/gmock/gmock.h" |
| 9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
| 10 | 10 |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 // Wait for OnCreated() to be called. | 132 // Wait for OnCreated() to be called. |
| 133 event.Wait(); | 133 event.Wait(); |
| 134 event.Reset(); | 134 event.Reset(); |
| 135 | 135 |
| 136 // Record and then wait for the event to be signaled. | 136 // Record and then wait for the event to be signaled. |
| 137 controller->Record(); | 137 controller->Record(); |
| 138 event.Wait(); | 138 event.Wait(); |
| 139 event.Reset(); | 139 event.Reset(); |
| 140 | 140 |
| 141 // Wait for the stream to be stopped. | 141 // Wait for the stream to be stopped. |
| 142 AudioInputStream* stream = controller->stream(); | 142 AudioInputStream* stream = controller->stream_for_testing(); |
| 143 stream->Stop(); | 143 stream->Stop(); |
| 144 event.Wait(); | 144 event.Wait(); |
| 145 | 145 |
| 146 controller->Close(); | 146 controller->Close(); |
| 147 } | 147 } |
| 148 | 148 |
| 149 // Test that AudioInputController rejects insanely large packet sizes. | 149 // Test that AudioInputController rejects insanely large packet sizes. |
| 150 TEST(AudioInputControllerTest, SamplesPerPacketTooLarge) { | 150 TEST(AudioInputControllerTest, SamplesPerPacketTooLarge) { |
| 151 // Create an audio device with a very large packet size. | 151 // Create an audio device with a very large packet size. |
| 152 MockAudioInputControllerEventHandler event_handler; | 152 MockAudioInputControllerEventHandler event_handler; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 166 kSampleRate, kBitsPerSample, kSamplesPerPacket); | 166 kSampleRate, kBitsPerSample, kSamplesPerPacket); |
| 167 scoped_refptr<AudioInputController> controller = | 167 scoped_refptr<AudioInputController> controller = |
| 168 AudioInputController::Create(&event_handler, params); | 168 AudioInputController::Create(&event_handler, params); |
| 169 ASSERT_TRUE(controller.get()); | 169 ASSERT_TRUE(controller.get()); |
| 170 | 170 |
| 171 controller->Close(); | 171 controller->Close(); |
| 172 controller->Close(); | 172 controller->Close(); |
| 173 } | 173 } |
| 174 | 174 |
| 175 } // namespace media | 175 } // namespace media |
| OLD | NEW |