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

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

Issue 10689141: Revert 145937 - Merge 143765 - Ensure media's buffered ranges always have a range that includes cur… (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));
486 483
487 base::TimeDelta kSeekTime = kDuration / 2; 484 base::TimeDelta kSeekTime = kDuration / 2;
488 ExpectSeek(kSeekTime); 485 ExpectSeek(kSeekTime);
489 DoSeek(kSeekTime); 486 DoSeek(kSeekTime);
490 487
491 EXPECT_TRUE(pipeline_->DidLoadingProgress());
492 EXPECT_FALSE(pipeline_->DidLoadingProgress()); 488 EXPECT_FALSE(pipeline_->DidLoadingProgress());
493 pipeline_->AddBufferedByteRange(kTotalBytes / 2, 489 pipeline_->AddBufferedByteRange(kTotalBytes / 2,
494 kTotalBytes / 2 + kTotalBytes / 8); 490 kTotalBytes / 2 + kTotalBytes / 8);
495 EXPECT_TRUE(pipeline_->DidLoadingProgress()); 491 EXPECT_TRUE(pipeline_->DidLoadingProgress());
496 EXPECT_FALSE(pipeline_->DidLoadingProgress()); 492 EXPECT_FALSE(pipeline_->DidLoadingProgress());
497 EXPECT_EQ(2u, pipeline_->GetBufferedTimeRanges().size()); 493 EXPECT_EQ(2u, pipeline_->GetBufferedTimeRanges().size());
498 EXPECT_EQ(base::TimeDelta(), pipeline_->GetBufferedTimeRanges().start(0)); 494 EXPECT_EQ(base::TimeDelta(), pipeline_->GetBufferedTimeRanges().start(0));
499 EXPECT_EQ(kDuration / 8, pipeline_->GetBufferedTimeRanges().end(0)); 495 EXPECT_EQ(kDuration / 8, pipeline_->GetBufferedTimeRanges().end(0));
500 EXPECT_EQ(kDuration / 2, pipeline_->GetBufferedTimeRanges().start(1)); 496 EXPECT_EQ(kDuration / 2, pipeline_->GetBufferedTimeRanges().start(1));
501 EXPECT_EQ(kDuration / 2 + kDuration / 8, 497 EXPECT_EQ(kDuration / 2 + kDuration / 8,
502 pipeline_->GetBufferedTimeRanges().end(1)); 498 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));
512 } 499 }
513 500
514 TEST_F(PipelineTest, DisableAudioRenderer) { 501 TEST_F(PipelineTest, DisableAudioRenderer) {
515 CreateAudioStream(); 502 CreateAudioStream();
516 CreateVideoStream(); 503 CreateVideoStream();
517 MockDemuxerStreamVector streams; 504 MockDemuxerStreamVector streams;
518 streams.push_back(audio_stream()); 505 streams.push_back(audio_stream());
519 streams.push_back(video_stream()); 506 streams.push_back(video_stream());
520 507
521 InitializeDemuxer(&streams); 508 InitializeDemuxer(&streams);
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after
857 TestPipelineStatusNotification(base::TimeDelta::FromMilliseconds(0)); 844 TestPipelineStatusNotification(base::TimeDelta::FromMilliseconds(0));
858 } 845 }
859 846
860 // Test that different-thread, some-delay callback (the expected common case) 847 // Test that different-thread, some-delay callback (the expected common case)
861 // works correctly. 848 // works correctly.
862 TEST(PipelineStatusNotificationTest, DelayedCallback) { 849 TEST(PipelineStatusNotificationTest, DelayedCallback) {
863 TestPipelineStatusNotification(base::TimeDelta::FromMilliseconds(20)); 850 TestPipelineStatusNotification(base::TimeDelta::FromMilliseconds(20));
864 } 851 }
865 852
866 } // namespace media 853 } // 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