| 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 "media/base/fake_demuxer_stream.h" |
| 6 |
| 7 #include <memory> |
| 8 |
| 5 #include "base/bind.h" | 9 #include "base/bind.h" |
| 6 #include "base/macros.h" | 10 #include "base/macros.h" |
| 7 #include "base/memory/scoped_ptr.h" | |
| 8 #include "base/message_loop/message_loop.h" | 11 #include "base/message_loop/message_loop.h" |
| 9 #include "media/base/decoder_buffer.h" | 12 #include "media/base/decoder_buffer.h" |
| 10 #include "media/base/demuxer_stream.h" | 13 #include "media/base/demuxer_stream.h" |
| 11 #include "media/base/fake_demuxer_stream.h" | |
| 12 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
| 13 | 15 |
| 14 namespace media { | 16 namespace media { |
| 15 | 17 |
| 16 const int kNumBuffersInOneConfig = 9; | 18 const int kNumBuffersInOneConfig = 9; |
| 17 const int kNumBuffersToReadFirst = 5; | 19 const int kNumBuffersToReadFirst = 5; |
| 18 const int kNumConfigs = 3; | 20 const int kNumConfigs = 3; |
| 19 static_assert(kNumBuffersToReadFirst < kNumBuffersInOneConfig, | 21 static_assert(kNumBuffersToReadFirst < kNumBuffersInOneConfig, |
| 20 "do not read too many buffers"); | 22 "do not read too many buffers"); |
| 21 static_assert(kNumConfigs > 0, | 23 static_assert(kNumConfigs > 0, |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 num_configs, num_buffers_in_one_config, is_encrypted)); | 163 num_configs, num_buffers_in_one_config, is_encrypted)); |
| 162 | 164 |
| 163 const VideoDecoderConfig& config = stream_->video_decoder_config(); | 165 const VideoDecoderConfig& config = stream_->video_decoder_config(); |
| 164 EXPECT_TRUE(config.IsValidConfig()); | 166 EXPECT_TRUE(config.IsValidConfig()); |
| 165 EXPECT_EQ(is_encrypted, config.is_encrypted()); | 167 EXPECT_EQ(is_encrypted, config.is_encrypted()); |
| 166 | 168 |
| 167 ReadAllBuffers(num_configs, num_buffers_in_one_config); | 169 ReadAllBuffers(num_configs, num_buffers_in_one_config); |
| 168 } | 170 } |
| 169 | 171 |
| 170 base::MessageLoop message_loop_; | 172 base::MessageLoop message_loop_; |
| 171 scoped_ptr<FakeDemuxerStream> stream_; | 173 std::unique_ptr<FakeDemuxerStream> stream_; |
| 172 | 174 |
| 173 DemuxerStream::Status status_; | 175 DemuxerStream::Status status_; |
| 174 scoped_refptr<DecoderBuffer> buffer_; | 176 scoped_refptr<DecoderBuffer> buffer_; |
| 175 bool read_pending_; | 177 bool read_pending_; |
| 176 int num_buffers_received_; | 178 int num_buffers_received_; |
| 177 | 179 |
| 178 private: | 180 private: |
| 179 DISALLOW_COPY_AND_ASSIGN(FakeDemuxerStreamTest); | 181 DISALLOW_COPY_AND_ASSIGN(FakeDemuxerStreamTest); |
| 180 }; | 182 }; |
| 181 | 183 |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 277 } | 279 } |
| 278 | 280 |
| 279 TEST_F(FakeDemuxerStreamTest, SeekToStart_AfterEOS) { | 281 TEST_F(FakeDemuxerStreamTest, SeekToStart_AfterEOS) { |
| 280 TestRead(3, 5, false); | 282 TestRead(3, 5, false); |
| 281 stream_->SeekToStart(); | 283 stream_->SeekToStart(); |
| 282 num_buffers_received_ = 0; | 284 num_buffers_received_ = 0; |
| 283 ReadAllBuffers(3, 5); | 285 ReadAllBuffers(3, 5); |
| 284 } | 286 } |
| 285 | 287 |
| 286 } // namespace media | 288 } // namespace media |
| OLD | NEW |