| 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 "media/base/audio_decoder_config.h" | 6 #include "media/base/audio_decoder_config.h" | 
| 7 #include "media/base/mock_callback.h" | 7 #include "media/base/mock_callback.h" | 
| 8 #include "media/base/mock_demuxer_host.h" | 8 #include "media/base/mock_demuxer_host.h" | 
| 9 #include "media/base/test_data_util.h" | 9 #include "media/base/test_data_util.h" | 
| 10 #include "media/filters/chunk_demuxer.h" | 10 #include "media/filters/chunk_demuxer.h" | 
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 176 | 176 | 
| 177   ChunkDemuxer::Status AddId() { | 177   ChunkDemuxer::Status AddId() { | 
| 178     std::vector<std::string> codecs(2); | 178     std::vector<std::string> codecs(2); | 
| 179     codecs[0] = "vp8"; | 179     codecs[0] = "vp8"; | 
| 180     codecs[1] = "vorbis"; | 180     codecs[1] = "vorbis"; | 
| 181     return demuxer_->AddId(kSourceId, "video/webm", codecs); | 181     return demuxer_->AddId(kSourceId, "video/webm", codecs); | 
| 182   } | 182   } | 
| 183 | 183 | 
| 184   bool AppendData(const uint8* data, size_t length) { | 184   bool AppendData(const uint8* data, size_t length) { | 
| 185     CHECK(length); | 185     CHECK(length); | 
| 186     EXPECT_CALL(host_, SetBufferedBytes(_)) | 186     EXPECT_CALL(host_, AddBufferedByteRange(_, _)).Times(AnyNumber()) | 
| 187         .Times(AnyNumber()) | 187         .WillRepeatedly(SaveArg<1>(&buffered_bytes_)); | 
| 188         .WillRepeatedly(SaveArg<0>(&buffered_bytes_)); |  | 
| 189     EXPECT_CALL(host_, SetNetworkActivity(true)) | 188     EXPECT_CALL(host_, SetNetworkActivity(true)) | 
| 190         .Times(AnyNumber()); | 189         .Times(AnyNumber()); | 
| 191     return demuxer_->AppendData(kSourceId, data, length); | 190     return demuxer_->AppendData(kSourceId, data, length); | 
| 192   } | 191   } | 
| 193 | 192 | 
| 194   bool AppendDataInPieces(const uint8* data, size_t length) { | 193   bool AppendDataInPieces(const uint8* data, size_t length) { | 
| 195     return AppendDataInPieces(data, length, 7); | 194     return AppendDataInPieces(data, length, 7); | 
| 196   } | 195   } | 
| 197 | 196 | 
| 198   bool AppendDataInPieces(const uint8* data, size_t length, size_t piece_size) { | 197   bool AppendDataInPieces(const uint8* data, size_t length, size_t piece_size) { | 
| (...skipping 21 matching lines...) Expand all  Loading... | 
| 220     return AppendData(info_tracks.get(), info_tracks_size); | 219     return AppendData(info_tracks.get(), info_tracks_size); | 
| 221   } | 220   } | 
| 222 | 221 | 
| 223   void InitDoneCalled(PipelineStatus expected_status, | 222   void InitDoneCalled(PipelineStatus expected_status, | 
| 224                       PipelineStatus status) { | 223                       PipelineStatus status) { | 
| 225     EXPECT_EQ(status, expected_status); | 224     EXPECT_EQ(status, expected_status); | 
| 226   } | 225   } | 
| 227 | 226 | 
| 228   PipelineStatusCB CreateInitDoneCB(const base::TimeDelta& expected_duration, | 227   PipelineStatusCB CreateInitDoneCB(const base::TimeDelta& expected_duration, | 
| 229                                     PipelineStatus expected_status) { | 228                                     PipelineStatus expected_status) { | 
| 230     if (expected_status == PIPELINE_OK) { | 229     if (expected_status == PIPELINE_OK) | 
| 231       EXPECT_CALL(host_, SetDuration(expected_duration)); | 230       EXPECT_CALL(host_, SetDuration(expected_duration)); | 
| 232       EXPECT_CALL(host_, SetCurrentReadPosition(_)); |  | 
| 233     } |  | 
| 234 | 231 | 
| 235     return base::Bind(&ChunkDemuxerTest::InitDoneCalled, | 232     return base::Bind(&ChunkDemuxerTest::InitDoneCalled, | 
| 236                       base::Unretained(this), | 233                       base::Unretained(this), | 
| 237                       expected_status); | 234                       expected_status); | 
| 238   } | 235   } | 
| 239 | 236 | 
| 240   bool InitDemuxer(bool has_audio, bool has_video, | 237   bool InitDemuxer(bool has_audio, bool has_video, | 
| 241                    bool video_content_encoded) { | 238                    bool video_content_encoded) { | 
| 242     PipelineStatus expected_status = | 239     PipelineStatus expected_status = | 
| 243         (has_audio || has_video) ? PIPELINE_OK : DEMUXER_ERROR_COULD_NOT_OPEN; | 240         (has_audio || has_video) ? PIPELINE_OK : DEMUXER_ERROR_COULD_NOT_OPEN; | 
| (...skipping 828 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1072 | 1069 | 
| 1073   std::vector<std::string> codecs(1); | 1070   std::vector<std::string> codecs(1); | 
| 1074   codecs[0] = "vp8"; | 1071   codecs[0] = "vp8"; | 
| 1075   ASSERT_EQ(demuxer_->AddId(kSourceId, "video/webm", codecs), | 1072   ASSERT_EQ(demuxer_->AddId(kSourceId, "video/webm", codecs), | 
| 1076             ChunkDemuxer::kOk); | 1073             ChunkDemuxer::kOk); | 
| 1077 | 1074 | 
| 1078   ASSERT_TRUE(AppendInfoTracks(true, true, false)); | 1075   ASSERT_TRUE(AppendInfoTracks(true, true, false)); | 
| 1079 } | 1076 } | 
| 1080 | 1077 | 
| 1081 }  // namespace media | 1078 }  // namespace media | 
| OLD | NEW | 
|---|