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

Side by Side Diff: media/base/pipeline_unittest.cc

Issue 10698134: Merge 143765 - Ensure media's buffered ranges always have a range that includes currentTime. (Closed) Base URL: svn://svn.chromium.org/chrome/branches/1180/src/
Patch Set: Created 8 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « media/base/pipeline.cc ('k') | media/base/ranges.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <vector> 5 #include <vector>
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/message_loop.h" 8 #include "base/message_loop.h"
9 #include "base/stl_util.h" 9 #include "base/stl_util.h"
10 #include "base/threading/simple_thread.h" 10 #include "base/threading/simple_thread.h"
(...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after
473 473
474 EXPECT_EQ(0u, pipeline_->GetBufferedTimeRanges().size()); 474 EXPECT_EQ(0u, pipeline_->GetBufferedTimeRanges().size());
475 475
476 EXPECT_FALSE(pipeline_->DidLoadingProgress()); 476 EXPECT_FALSE(pipeline_->DidLoadingProgress());
477 pipeline_->AddBufferedByteRange(0, kTotalBytes / 8); 477 pipeline_->AddBufferedByteRange(0, kTotalBytes / 8);
478 EXPECT_TRUE(pipeline_->DidLoadingProgress()); 478 EXPECT_TRUE(pipeline_->DidLoadingProgress());
479 EXPECT_FALSE(pipeline_->DidLoadingProgress()); 479 EXPECT_FALSE(pipeline_->DidLoadingProgress());
480 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size()); 480 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size());
481 EXPECT_EQ(base::TimeDelta(), pipeline_->GetBufferedTimeRanges().start(0)); 481 EXPECT_EQ(base::TimeDelta(), pipeline_->GetBufferedTimeRanges().start(0));
482 EXPECT_EQ(kDuration / 8, pipeline_->GetBufferedTimeRanges().end(0)); 482 EXPECT_EQ(kDuration / 8, pipeline_->GetBufferedTimeRanges().end(0));
483 pipeline_->AddBufferedTimeRange(base::TimeDelta(), kDuration / 8);
484 EXPECT_EQ(base::TimeDelta(), pipeline_->GetBufferedTimeRanges().start(0));
485 EXPECT_EQ(kDuration / 8, pipeline_->GetBufferedTimeRanges().end(0));
483 486
484 base::TimeDelta kSeekTime = kDuration / 2; 487 base::TimeDelta kSeekTime = kDuration / 2;
485 ExpectSeek(kSeekTime); 488 ExpectSeek(kSeekTime);
486 DoSeek(kSeekTime); 489 DoSeek(kSeekTime);
487 490
491 EXPECT_TRUE(pipeline_->DidLoadingProgress());
488 EXPECT_FALSE(pipeline_->DidLoadingProgress()); 492 EXPECT_FALSE(pipeline_->DidLoadingProgress());
489 pipeline_->AddBufferedByteRange(kTotalBytes / 2, 493 pipeline_->AddBufferedByteRange(kTotalBytes / 2,
490 kTotalBytes / 2 + kTotalBytes / 8); 494 kTotalBytes / 2 + kTotalBytes / 8);
491 EXPECT_TRUE(pipeline_->DidLoadingProgress()); 495 EXPECT_TRUE(pipeline_->DidLoadingProgress());
492 EXPECT_FALSE(pipeline_->DidLoadingProgress()); 496 EXPECT_FALSE(pipeline_->DidLoadingProgress());
493 EXPECT_EQ(2u, pipeline_->GetBufferedTimeRanges().size()); 497 EXPECT_EQ(2u, pipeline_->GetBufferedTimeRanges().size());
494 EXPECT_EQ(base::TimeDelta(), pipeline_->GetBufferedTimeRanges().start(0)); 498 EXPECT_EQ(base::TimeDelta(), pipeline_->GetBufferedTimeRanges().start(0));
495 EXPECT_EQ(kDuration / 8, pipeline_->GetBufferedTimeRanges().end(0)); 499 EXPECT_EQ(kDuration / 8, pipeline_->GetBufferedTimeRanges().end(0));
496 EXPECT_EQ(kDuration / 2, pipeline_->GetBufferedTimeRanges().start(1)); 500 EXPECT_EQ(kDuration / 2, pipeline_->GetBufferedTimeRanges().start(1));
497 EXPECT_EQ(kDuration / 2 + kDuration / 8, 501 EXPECT_EQ(kDuration / 2 + kDuration / 8,
498 pipeline_->GetBufferedTimeRanges().end(1)); 502 pipeline_->GetBufferedTimeRanges().end(1));
503
504 pipeline_->AddBufferedTimeRange(kDuration / 4, 3 * kDuration / 8);
505 EXPECT_EQ(base::TimeDelta(), pipeline_->GetBufferedTimeRanges().start(0));
506 EXPECT_EQ(kDuration / 8, pipeline_->GetBufferedTimeRanges().end(0));
507 EXPECT_EQ(kDuration / 4, pipeline_->GetBufferedTimeRanges().start(1));
508 EXPECT_EQ(3* kDuration / 8, pipeline_->GetBufferedTimeRanges().end(1));
509 EXPECT_EQ(kDuration / 2, pipeline_->GetBufferedTimeRanges().start(2));
510 EXPECT_EQ(kDuration / 2 + kDuration / 8,
511 pipeline_->GetBufferedTimeRanges().end(2));
499 } 512 }
500 513
501 TEST_F(PipelineTest, DisableAudioRenderer) { 514 TEST_F(PipelineTest, DisableAudioRenderer) {
502 CreateAudioStream(); 515 CreateAudioStream();
503 CreateVideoStream(); 516 CreateVideoStream();
504 MockDemuxerStreamVector streams; 517 MockDemuxerStreamVector streams;
505 streams.push_back(audio_stream()); 518 streams.push_back(audio_stream());
506 streams.push_back(video_stream()); 519 streams.push_back(video_stream());
507 520
508 InitializeDemuxer(&streams); 521 InitializeDemuxer(&streams);
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after
844 TestPipelineStatusNotification(base::TimeDelta::FromMilliseconds(0)); 857 TestPipelineStatusNotification(base::TimeDelta::FromMilliseconds(0));
845 } 858 }
846 859
847 // Test that different-thread, some-delay callback (the expected common case) 860 // Test that different-thread, some-delay callback (the expected common case)
848 // works correctly. 861 // works correctly.
849 TEST(PipelineStatusNotificationTest, DelayedCallback) { 862 TEST(PipelineStatusNotificationTest, DelayedCallback) {
850 TestPipelineStatusNotification(base::TimeDelta::FromMilliseconds(20)); 863 TestPipelineStatusNotification(base::TimeDelta::FromMilliseconds(20));
851 } 864 }
852 865
853 } // namespace media 866 } // namespace media
OLDNEW
« no previous file with comments | « media/base/pipeline.cc ('k') | media/base/ranges.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698