Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(386)

Side by Side Diff: media/filters/pipeline_integration_test.cc

Issue 206103004: Remove HasAudio(), HasVideo(), GetInitialNaturalSize() from media::Pipeline. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added tests. Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/strings/string_util.h" 10 #include "base/strings/string_util.h"
11 #include "build/build_config.h" 11 #include "build/build_config.h"
12 #include "media/base/decoder_buffer.h" 12 #include "media/base/decoder_buffer.h"
13 #include "media/base/media_keys.h" 13 #include "media/base/media_keys.h"
14 #include "media/base/media_switches.h" 14 #include "media/base/media_switches.h"
15 #include "media/base/test_data_util.h" 15 #include "media/base/test_data_util.h"
16 #include "media/cdm/aes_decryptor.h" 16 #include "media/cdm/aes_decryptor.h"
17 #include "media/cdm/json_web_key.h" 17 #include "media/cdm/json_web_key.h"
18 #include "media/filters/chunk_demuxer.h" 18 #include "media/filters/chunk_demuxer.h"
19 19
20 using testing::_;
20 using testing::AnyNumber; 21 using testing::AnyNumber;
21 using testing::AtMost; 22 using testing::AtMost;
22 23
23 namespace media { 24 namespace media {
24 25
25 const char kSourceId[] = "SourceId"; 26 const char kSourceId[] = "SourceId";
26 const uint8 kInitData[] = { 0x69, 0x6e, 0x69, 0x74 }; 27 const uint8 kInitData[] = { 0x69, 0x6e, 0x69, 0x74 };
27 28
28 const char kWebM[] = "video/webm; codecs=\"vp8,vorbis\""; 29 const char kWebM[] = "video/webm; codecs=\"vp8,vorbis\"";
29 const char kWebMVP9[] = "video/webm; codecs=\"vp9\""; 30 const char kWebMVP9[] = "video/webm; codecs=\"vp9\"";
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after
386 scoped_ptr<Demuxer> owned_chunk_demuxer_; 387 scoped_ptr<Demuxer> owned_chunk_demuxer_;
387 Demuxer::NeedKeyCB need_key_cb_; 388 Demuxer::NeedKeyCB need_key_cb_;
388 base::TimeDelta last_timestamp_offset_; 389 base::TimeDelta last_timestamp_offset_;
389 }; 390 };
390 391
391 class PipelineIntegrationTest 392 class PipelineIntegrationTest
392 : public testing::Test, 393 : public testing::Test,
393 public PipelineIntegrationTestBase { 394 public PipelineIntegrationTestBase {
394 public: 395 public:
395 void StartPipelineWithMediaSource(MockMediaSource* source) { 396 void StartPipelineWithMediaSource(MockMediaSource* source) {
396 EXPECT_CALL(*this, OnBufferingState(Pipeline::kHaveMetadata)) 397 EXPECT_CALL(*this, OnMetadata(_)).Times(AtMost(1));
397 .Times(AtMost(1)); 398 EXPECT_CALL(*this, OnPrerollCompleted()).Times(AtMost(1));
398 EXPECT_CALL(*this, OnBufferingState(Pipeline::kPrerollCompleted))
399 .Times(AtMost(1));
400 pipeline_->Start( 399 pipeline_->Start(
401 CreateFilterCollection(source->GetDemuxer(), NULL), 400 CreateFilterCollection(source->GetDemuxer(), NULL),
402 base::Bind(&PipelineIntegrationTest::OnEnded, base::Unretained(this)), 401 base::Bind(&PipelineIntegrationTest::OnEnded, base::Unretained(this)),
403 base::Bind(&PipelineIntegrationTest::OnError, base::Unretained(this)), 402 base::Bind(&PipelineIntegrationTest::OnError, base::Unretained(this)),
404 QuitOnStatusCB(PIPELINE_OK), 403 QuitOnStatusCB(PIPELINE_OK),
405 base::Bind(&PipelineIntegrationTest::OnBufferingState, 404 base::Bind(&PipelineIntegrationTest::OnMetadata,
405 base::Unretained(this)),
406 base::Bind(&PipelineIntegrationTest::OnPrerollCompleted,
406 base::Unretained(this)), 407 base::Unretained(this)),
407 base::Closure()); 408 base::Closure());
408 409
409 message_loop_.Run(); 410 message_loop_.Run();
410 } 411 }
411 412
412 void StartHashedPipelineWithMediaSource(MockMediaSource* source) { 413 void StartHashedPipelineWithMediaSource(MockMediaSource* source) {
413 hashing_enabled_ = true; 414 hashing_enabled_ = true;
414 StartPipelineWithMediaSource(source); 415 StartPipelineWithMediaSource(source);
415 } 416 }
416 417
417 void StartPipelineWithEncryptedMedia( 418 void StartPipelineWithEncryptedMedia(
418 MockMediaSource* source, 419 MockMediaSource* source,
419 FakeEncryptedMedia* encrypted_media) { 420 FakeEncryptedMedia* encrypted_media) {
420 EXPECT_CALL(*this, OnBufferingState(Pipeline::kHaveMetadata)) 421 EXPECT_CALL(*this, OnMetadata(_)).Times(AtMost(1));
421 .Times(AtMost(1)); 422 EXPECT_CALL(*this, OnPrerollCompleted()).Times(AtMost(1));
422 EXPECT_CALL(*this, OnBufferingState(Pipeline::kPrerollCompleted))
423 .Times(AtMost(1));
424 pipeline_->Start( 423 pipeline_->Start(
425 CreateFilterCollection(source->GetDemuxer(), 424 CreateFilterCollection(source->GetDemuxer(),
426 encrypted_media->decryptor()), 425 encrypted_media->decryptor()),
427 base::Bind(&PipelineIntegrationTest::OnEnded, base::Unretained(this)), 426 base::Bind(&PipelineIntegrationTest::OnEnded, base::Unretained(this)),
428 base::Bind(&PipelineIntegrationTest::OnError, base::Unretained(this)), 427 base::Bind(&PipelineIntegrationTest::OnError, base::Unretained(this)),
429 QuitOnStatusCB(PIPELINE_OK), 428 QuitOnStatusCB(PIPELINE_OK),
430 base::Bind(&PipelineIntegrationTest::OnBufferingState, 429 base::Bind(&PipelineIntegrationTest::OnMetadata,
430 base::Unretained(this)),
431 base::Bind(&PipelineIntegrationTest::OnPrerollCompleted,
431 base::Unretained(this)), 432 base::Unretained(this)),
432 base::Closure()); 433 base::Closure());
433 434
434 source->set_need_key_cb(base::Bind(&FakeEncryptedMedia::NeedKey, 435 source->set_need_key_cb(base::Bind(&FakeEncryptedMedia::NeedKey,
435 base::Unretained(encrypted_media))); 436 base::Unretained(encrypted_media)));
436 437
437 message_loop_.Run(); 438 message_loop_.Run();
438 } 439 }
439 440
440 // Verifies that seeking works properly for ChunkDemuxer when the 441 // Verifies that seeking works properly for ChunkDemuxer when the
(...skipping 740 matching lines...) Expand 10 before | Expand all | Expand 10 after
1181 // Verify that VP8 video with inband text track can be played back. 1182 // Verify that VP8 video with inband text track can be played back.
1182 TEST_F(PipelineIntegrationTest, 1183 TEST_F(PipelineIntegrationTest,
1183 BasicPlayback_VP8_WebVTT_WebM) { 1184 BasicPlayback_VP8_WebVTT_WebM) {
1184 ASSERT_TRUE(Start(GetTestDataFilePath("bear-vp8-webvtt.webm"), 1185 ASSERT_TRUE(Start(GetTestDataFilePath("bear-vp8-webvtt.webm"),
1185 PIPELINE_OK)); 1186 PIPELINE_OK));
1186 Play(); 1187 Play();
1187 ASSERT_TRUE(WaitUntilOnEnded()); 1188 ASSERT_TRUE(WaitUntilOnEnded());
1188 } 1189 }
1189 1190
1190 } // namespace media 1191 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698