| 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/bind.h" | 5 #include "base/bind.h" |
| 6 #include "base/callback_helpers.h" | 6 #include "base/callback_helpers.h" |
| 7 #include "base/format_macros.h" | 7 #include "base/format_macros.h" |
| 8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
| 9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
| 10 #include "base/test/simple_test_tick_clock.h" | 10 #include "base/test/simple_test_tick_clock.h" |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 | 59 |
| 60 class AudioRendererImplTest : public ::testing::Test { | 60 class AudioRendererImplTest : public ::testing::Test { |
| 61 public: | 61 public: |
| 62 // Give the decoder some non-garbage media properties. | 62 // Give the decoder some non-garbage media properties. |
| 63 AudioRendererImplTest() | 63 AudioRendererImplTest() |
| 64 : hardware_config_(AudioParameters(), AudioParameters()), | 64 : hardware_config_(AudioParameters(), AudioParameters()), |
| 65 tick_clock_(new base::SimpleTestTickClock()), | 65 tick_clock_(new base::SimpleTestTickClock()), |
| 66 demuxer_stream_(DemuxerStream::AUDIO), | 66 demuxer_stream_(DemuxerStream::AUDIO), |
| 67 decoder_(new MockAudioDecoder()), | 67 decoder_(new MockAudioDecoder()), |
| 68 ended_(false) { | 68 ended_(false) { |
| 69 AudioDecoderConfig audio_config(kCodec, | 69 AudioDecoderConfig audio_config(kCodec, kSampleFormat, kChannelLayout, |
| 70 kSampleFormat, | 70 kInputSamplesPerSecond, EmptyExtraData(), |
| 71 kChannelLayout, | 71 EncryptionScheme(false)); |
| 72 kInputSamplesPerSecond, | |
| 73 EmptyExtraData(), | |
| 74 false); | |
| 75 demuxer_stream_.set_audio_decoder_config(audio_config); | 72 demuxer_stream_.set_audio_decoder_config(audio_config); |
| 76 | 73 |
| 77 // Used to save callbacks and run them at a later time. | 74 // Used to save callbacks and run them at a later time. |
| 78 EXPECT_CALL(*decoder_, Decode(_, _)) | 75 EXPECT_CALL(*decoder_, Decode(_, _)) |
| 79 .WillRepeatedly(Invoke(this, &AudioRendererImplTest::DecodeDecoder)); | 76 .WillRepeatedly(Invoke(this, &AudioRendererImplTest::DecodeDecoder)); |
| 80 EXPECT_CALL(*decoder_, Reset(_)) | 77 EXPECT_CALL(*decoder_, Reset(_)) |
| 81 .WillRepeatedly(Invoke(this, &AudioRendererImplTest::ResetDecoder)); | 78 .WillRepeatedly(Invoke(this, &AudioRendererImplTest::ResetDecoder)); |
| 82 | 79 |
| 83 // Mock out demuxer reads. | 80 // Mock out demuxer reads. |
| 84 EXPECT_CALL(demuxer_stream_, Read(_)).WillRepeatedly( | 81 EXPECT_CALL(demuxer_stream_, Read(_)).WillRepeatedly( |
| (...skipping 798 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 883 // Advance far enough that we shouldn't be clamped to current time (tested | 880 // Advance far enough that we shouldn't be clamped to current time (tested |
| 884 // already above). | 881 // already above). |
| 885 tick_clock_->Advance(kOneSecond); | 882 tick_clock_->Advance(kOneSecond); |
| 886 EXPECT_EQ( | 883 EXPECT_EQ( |
| 887 current_time + timestamp_helper.GetFrameDuration(frames_to_consume.value), | 884 current_time + timestamp_helper.GetFrameDuration(frames_to_consume.value), |
| 888 CurrentMediaWallClockTime(&is_time_moving)); | 885 CurrentMediaWallClockTime(&is_time_moving)); |
| 889 EXPECT_TRUE(is_time_moving); | 886 EXPECT_TRUE(is_time_moving); |
| 890 } | 887 } |
| 891 | 888 |
| 892 } // namespace media | 889 } // namespace media |
| OLD | NEW |