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 bool ResetAudioPlayer(AudioPacket::SamplingRate) OVERRIDE { | 32 virtual bool ResetAudioPlayer(AudioPacket::SamplingRate) OVERRIDE { |
33 return true; | 33 return true; |
34 } | 34 } |
35 | 35 |
36 uint32 GetSamplesPerFrame() OVERRIDE { | 36 virtual uint32 GetSamplesPerFrame() OVERRIDE { |
37 return kAudioSamplesPerFrame; | 37 return kAudioSamplesPerFrame; |
38 } | 38 } |
39 }; | 39 }; |
40 | 40 |
41 class AudioPlayerTest : public ::testing::Test { | 41 class AudioPlayerTest : public ::testing::Test { |
42 protected: | 42 protected: |
43 virtual void SetUp() { | 43 virtual void SetUp() { |
44 audio_.reset(new FakeAudioPlayer()); | 44 audio_.reset(new FakeAudioPlayer()); |
45 buffer_.reset(new char[kAudioFrameBytes + kPaddingBytes]); | 45 buffer_.reset(new char[kAudioFrameBytes + kPaddingBytes]); |
46 } | 46 } |
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
318 | 318 |
319 // Attempt to consume a frame of 25 samples. | 319 // Attempt to consume a frame of 25 samples. |
320 ConsumeAudioFrame(); | 320 ConsumeAudioFrame(); |
321 ASSERT_EQ(0, GetNumQueuedSamples()); | 321 ASSERT_EQ(0, GetNumQueuedSamples()); |
322 ASSERT_EQ(0, GetNumQueuedPackets()); | 322 ASSERT_EQ(0, GetNumQueuedPackets()); |
323 ASSERT_EQ(0, GetBytesConsumed()); | 323 ASSERT_EQ(0, GetBytesConsumed()); |
324 CheckAudioFrameBytes(packet1_samples * kAudioSampleBytes); | 324 CheckAudioFrameBytes(packet1_samples * kAudioSampleBytes); |
325 } | 325 } |
326 | 326 |
327 } // namespace remoting | 327 } // namespace remoting |
OLD | NEW |