| 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/filters/pipeline_integration_test_base.h" | 5 #include "media/filters/pipeline_integration_test_base.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "media/base/decoder_buffer.h" | 8 #include "media/base/decoder_buffer.h" |
| 9 #include "media/base/decryptor_client.h" | 9 #include "media/base/decryptor_client.h" |
| 10 #include "media/base/test_data_util.h" | 10 #include "media/base/test_data_util.h" |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 AesDecryptor decryptor_; | 177 AesDecryptor decryptor_; |
| 178 std::string current_key_system_; | 178 std::string current_key_system_; |
| 179 std::string current_session_id_; | 179 std::string current_session_id_; |
| 180 }; | 180 }; |
| 181 | 181 |
| 182 class PipelineIntegrationTest | 182 class PipelineIntegrationTest |
| 183 : public testing::Test, | 183 : public testing::Test, |
| 184 public PipelineIntegrationTestBase { | 184 public PipelineIntegrationTestBase { |
| 185 public: | 185 public: |
| 186 void StartPipelineWithMediaSource(MockMediaSource* source) { | 186 void StartPipelineWithMediaSource(MockMediaSource* source) { |
| 187 EXPECT_CALL(*this, OnBufferingState(Pipeline::kHaveMetadata)); |
| 188 EXPECT_CALL(*this, OnBufferingState(Pipeline::kPrerollCompleted)); |
| 187 pipeline_->Start( | 189 pipeline_->Start( |
| 188 CreateFilterCollection(source, NULL), | 190 CreateFilterCollection(source, NULL), |
| 189 base::Bind(&PipelineIntegrationTest::OnEnded, base::Unretained(this)), | 191 base::Bind(&PipelineIntegrationTest::OnEnded, base::Unretained(this)), |
| 190 base::Bind(&PipelineIntegrationTest::OnError, base::Unretained(this)), | 192 base::Bind(&PipelineIntegrationTest::OnError, base::Unretained(this)), |
| 191 QuitOnStatusCB(PIPELINE_OK)); | 193 QuitOnStatusCB(PIPELINE_OK), |
| 194 base::Bind(&PipelineIntegrationTest::OnBufferingState, |
| 195 base::Unretained(this))); |
| 192 | 196 |
| 193 message_loop_.Run(); | 197 message_loop_.Run(); |
| 194 } | 198 } |
| 195 | 199 |
| 196 void StartPipelineWithEncryptedMedia( | 200 void StartPipelineWithEncryptedMedia( |
| 197 MockMediaSource* source, | 201 MockMediaSource* source, |
| 198 FakeDecryptorClient* encrypted_media) { | 202 FakeDecryptorClient* encrypted_media) { |
| 203 EXPECT_CALL(*this, OnBufferingState(Pipeline::kHaveMetadata)); |
| 204 EXPECT_CALL(*this, OnBufferingState(Pipeline::kPrerollCompleted)); |
| 199 pipeline_->Start( | 205 pipeline_->Start( |
| 200 CreateFilterCollection(source, encrypted_media->decryptor()), | 206 CreateFilterCollection(source, encrypted_media->decryptor()), |
| 201 base::Bind(&PipelineIntegrationTest::OnEnded, base::Unretained(this)), | 207 base::Bind(&PipelineIntegrationTest::OnEnded, base::Unretained(this)), |
| 202 base::Bind(&PipelineIntegrationTest::OnError, base::Unretained(this)), | 208 base::Bind(&PipelineIntegrationTest::OnError, base::Unretained(this)), |
| 203 QuitOnStatusCB(PIPELINE_OK)); | 209 QuitOnStatusCB(PIPELINE_OK), |
| 210 base::Bind(&PipelineIntegrationTest::OnBufferingState, |
| 211 base::Unretained(this))); |
| 204 | 212 |
| 205 source->set_decryptor_client(encrypted_media); | 213 source->set_decryptor_client(encrypted_media); |
| 206 | 214 |
| 207 message_loop_.Run(); | 215 message_loop_.Run(); |
| 208 } | 216 } |
| 209 | 217 |
| 210 // Verifies that seeking works properly for ChunkDemuxer when the | 218 // Verifies that seeking works properly for ChunkDemuxer when the |
| 211 // seek happens while there is a pending read on the ChunkDemuxer | 219 // seek happens while there is a pending read on the ChunkDemuxer |
| 212 // and no data is available. | 220 // and no data is available. |
| 213 bool TestSeekDuringRead(const std::string& filename, | 221 bool TestSeekDuringRead(const std::string& filename, |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 353 | 361 |
| 354 // Verify video decoder & renderer can handle aborted demuxer reads. | 362 // Verify video decoder & renderer can handle aborted demuxer reads. |
| 355 TEST_F(PipelineIntegrationTest, ChunkDemuxerAbortRead_VideoOnly) { | 363 TEST_F(PipelineIntegrationTest, ChunkDemuxerAbortRead_VideoOnly) { |
| 356 ASSERT_TRUE(TestSeekDuringRead("bear-320x240-video-only.webm", 32768, | 364 ASSERT_TRUE(TestSeekDuringRead("bear-320x240-video-only.webm", 32768, |
| 357 base::TimeDelta::FromMilliseconds(200), | 365 base::TimeDelta::FromMilliseconds(200), |
| 358 base::TimeDelta::FromMilliseconds(1668), | 366 base::TimeDelta::FromMilliseconds(1668), |
| 359 0x1C896, 65536, false, true)); | 367 0x1C896, 65536, false, true)); |
| 360 } | 368 } |
| 361 | 369 |
| 362 } // namespace media | 370 } // namespace media |
| OLD | NEW |