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 "remoting/client/audio_player.h" | 5 #include "remoting/client/audio_player.h" |
6 | 6 |
7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
10 | 10 |
(...skipping 11 matching lines...) Expand all Loading... |
22 | 22 |
23 } // namespace | 23 } // namespace |
24 | 24 |
25 namespace remoting { | 25 namespace remoting { |
26 | 26 |
27 class FakeAudioPlayer : public AudioPlayer { | 27 class FakeAudioPlayer : public AudioPlayer { |
28 public: | 28 public: |
29 FakeAudioPlayer() { | 29 FakeAudioPlayer() { |
30 } | 30 } |
31 | 31 |
32 virtual bool ResetAudioPlayer(AudioPacket::SamplingRate) override { | 32 bool ResetAudioPlayer(AudioPacket::SamplingRate) override { return true; } |
33 return true; | |
34 } | |
35 | 33 |
36 virtual uint32 GetSamplesPerFrame() override { | 34 uint32 GetSamplesPerFrame() override { return kAudioSamplesPerFrame; } |
37 return kAudioSamplesPerFrame; | |
38 } | |
39 }; | 35 }; |
40 | 36 |
41 class AudioPlayerTest : public ::testing::Test { | 37 class AudioPlayerTest : public ::testing::Test { |
42 protected: | 38 protected: |
43 virtual void SetUp() { | 39 virtual void SetUp() { |
44 audio_.reset(new FakeAudioPlayer()); | 40 audio_.reset(new FakeAudioPlayer()); |
45 buffer_.reset(new char[kAudioFrameBytes + kPaddingBytes]); | 41 buffer_.reset(new char[kAudioFrameBytes + kPaddingBytes]); |
46 } | 42 } |
47 | 43 |
48 virtual void TearDown() { | 44 virtual void TearDown() { |
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
306 | 302 |
307 // Attempt to consume a frame of 25 samples. | 303 // Attempt to consume a frame of 25 samples. |
308 ConsumeAudioFrame(); | 304 ConsumeAudioFrame(); |
309 ASSERT_EQ(0, GetNumQueuedSamples()); | 305 ASSERT_EQ(0, GetNumQueuedSamples()); |
310 ASSERT_EQ(0, GetNumQueuedPackets()); | 306 ASSERT_EQ(0, GetNumQueuedPackets()); |
311 ASSERT_EQ(0, GetBytesConsumed()); | 307 ASSERT_EQ(0, GetBytesConsumed()); |
312 CheckAudioFrameBytes(packet1_samples * kAudioSampleBytes); | 308 CheckAudioFrameBytes(packet1_samples * kAudioSampleBytes); |
313 } | 309 } |
314 | 310 |
315 } // namespace remoting | 311 } // namespace remoting |
OLD | NEW |