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/basictypes.h" | 5 #include "base/basictypes.h" |
6 #include "base/environment.h" | 6 #include "base/environment.h" |
7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
9 #include "base/threading/platform_thread.h" | 9 #include "base/threading/platform_thread.h" |
10 #include "media/audio/audio_io.h" | 10 #include "media/audio/audio_io.h" |
11 #include "media/audio/audio_manager_base.h" | 11 #include "media/audio/audio_manager_base.h" |
12 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
13 | 13 |
| 14 namespace media { |
| 15 |
14 static const int kSamplingRate = 8000; | 16 static const int kSamplingRate = 8000; |
15 static const int kSamplesPerPacket = kSamplingRate / 20; | 17 static const int kSamplesPerPacket = kSamplingRate / 20; |
16 | 18 |
17 // This class allows to find out if the callbacks are occurring as | 19 // This class allows to find out if the callbacks are occurring as |
18 // expected and if any error has been reported. | 20 // expected and if any error has been reported. |
19 class TestInputCallback : public AudioInputStream::AudioInputCallback { | 21 class TestInputCallback : public AudioInputStream::AudioInputCallback { |
20 public: | 22 public: |
21 explicit TestInputCallback(int max_data_bytes) | 23 explicit TestInputCallback(int max_data_bytes) |
22 : callback_count_(0), | 24 : callback_count_(0), |
23 had_error_(0), | 25 had_error_(0), |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 FROM_HERE, | 165 FROM_HERE, |
164 MessageLoop::QuitClosure(), | 166 MessageLoop::QuitClosure(), |
165 base::TimeDelta::FromMilliseconds(590)); | 167 base::TimeDelta::FromMilliseconds(590)); |
166 message_loop.Run(); | 168 message_loop.Run(); |
167 EXPECT_GE(test_callback.callback_count(), 10); | 169 EXPECT_GE(test_callback.callback_count(), 10); |
168 EXPECT_FALSE(test_callback.had_error()); | 170 EXPECT_FALSE(test_callback.had_error()); |
169 | 171 |
170 ais->Stop(); | 172 ais->Stop(); |
171 ais->Close(); | 173 ais->Close(); |
172 } | 174 } |
| 175 |
| 176 } // namespace media |
OLD | NEW |