OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/memory/ref_counted.h" | 6 #include "base/memory/ref_counted.h" |
7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
8 #include "media/cast/audio_receiver/audio_decoder.h" | 8 #include "media/cast/audio_receiver/audio_decoder.h" |
9 #include "media/cast/cast_thread.h" | 9 #include "media/cast/cast_thread.h" |
10 #include "media/cast/test/fake_task_runner.h" | 10 #include "media/cast/test/fake_task_runner.h" |
11 #include "testing/gmock/include/gmock/gmock.h" | 11 #include "testing/gmock/include/gmock/gmock.h" |
12 | 12 |
13 namespace media { | 13 namespace media { |
14 namespace cast { | 14 namespace cast { |
15 | 15 |
16 static const int64 kStartMillisecond = 123456789; | 16 static const int64 kStartMillisecond = 123456789; |
17 | 17 |
18 class AudioDecoderTest : public ::testing::Test { | 18 class AudioDecoderTest : public ::testing::Test { |
19 protected: | 19 protected: |
20 AudioDecoderTest() {} | 20 AudioDecoderTest() {} |
21 | 21 |
22 virtual ~AudioDecoderTest() {} | 22 ~AudioDecoderTest() {} |
23 | 23 |
24 virtual void SetUp() { | 24 virtual void SetUp() { |
25 task_runner_ = new test::FakeTaskRunner(&testing_clock_); | 25 task_runner_ = new test::FakeTaskRunner(&testing_clock_); |
26 cast_thread_ = new CastThread(task_runner_, task_runner_, task_runner_, | 26 cast_thread_ = new CastThread(task_runner_, task_runner_, task_runner_, |
27 NULL, NULL); | 27 NULL, NULL); |
28 } | 28 } |
29 void Configure(const AudioReceiverConfig& audio_config) { | 29 void Configure(const AudioReceiverConfig& audio_config) { |
30 audio_decoder_ = new AudioDecoder(cast_thread_, audio_config); | 30 audio_decoder_ = new AudioDecoder(cast_thread_, audio_config); |
31 } | 31 } |
32 | 32 |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 for (size_t i = 100 * audio_config.channels; i < audio_frame.samples.size(); | 192 for (size_t i = 100 * audio_config.channels; i < audio_frame.samples.size(); |
193 ++i) { | 193 ++i) { |
194 EXPECT_NEAR(0x3412, audio_frame.samples[i], 400); | 194 EXPECT_NEAR(0x3412, audio_frame.samples[i], 400); |
195 if (0x3412 == audio_frame.samples[i]) count++; | 195 if (0x3412 == audio_frame.samples[i]) count++; |
196 } | 196 } |
197 task_runner_->RunTasks(); | 197 task_runner_->RunTasks(); |
198 } | 198 } |
199 | 199 |
200 } // namespace cast | 200 } // namespace cast |
201 } // namespace media | 201 } // namespace media |
OLD | NEW |