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

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

Issue 8661002: Fire CanPlayThrough immediately for local and streaming media files (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase ToT Created 9 years 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
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 <string> 5 #include <string>
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/callback.h" 8 #include "base/callback.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 534 matching lines...) Expand 10 before | Expand all | Expand 10 after
545 // Test VBR case where the bytes have been consumed faster than the average 545 // Test VBR case where the bytes have been consumed faster than the average
546 // rate. 546 // rate.
547 pipeline_->SetBufferedBytes(estimated_bytes + 10); 547 pipeline_->SetBufferedBytes(estimated_bytes + 10);
548 EXPECT_LT(pipeline_->GetCurrentTime(), pipeline_->GetBufferedTime()); 548 EXPECT_LT(pipeline_->GetCurrentTime(), pipeline_->GetBufferedTime());
549 549
550 // If media has been fully received, we should return the duration 550 // If media has been fully received, we should return the duration
551 // of the media. 551 // of the media.
552 pipeline_->SetBufferedBytes(kTotalBytes); 552 pipeline_->SetBufferedBytes(kTotalBytes);
553 EXPECT_EQ(kDuration.ToInternalValue(), 553 EXPECT_EQ(kDuration.ToInternalValue(),
554 pipeline_->GetBufferedTime().ToInternalValue()); 554 pipeline_->GetBufferedTime().ToInternalValue());
555
556 // If media is loaded, we should return duration of media.
557 pipeline_->SetLoaded(true);
558 EXPECT_EQ(kDuration.ToInternalValue(),
559 pipeline_->GetBufferedTime().ToInternalValue());
560 } 555 }
561 556
562 TEST_F(PipelineImplTest, DisableAudioRenderer) { 557 TEST_F(PipelineImplTest, DisableAudioRenderer) {
563 CreateAudioStream(); 558 CreateAudioStream();
564 CreateVideoStream(); 559 CreateVideoStream();
565 MockDemuxerStreamVector streams; 560 MockDemuxerStreamVector streams;
566 streams.push_back(audio_stream()); 561 streams.push_back(audio_stream());
567 streams.push_back(video_stream()); 562 streams.push_back(video_stream());
568 563
569 InitializeDemuxer(&streams, base::TimeDelta()); 564 InitializeDemuxer(&streams, base::TimeDelta());
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after
917 TestPipelineStatusNotification(0); 912 TestPipelineStatusNotification(0);
918 } 913 }
919 914
920 // Test that different-thread, some-delay callback (the expected common case) 915 // Test that different-thread, some-delay callback (the expected common case)
921 // works correctly. 916 // works correctly.
922 TEST(PipelineStatusNotificationTest, DelayedCallback) { 917 TEST(PipelineStatusNotificationTest, DelayedCallback) {
923 TestPipelineStatusNotification(20); 918 TestPipelineStatusNotification(20);
924 } 919 }
925 920
926 } // namespace media 921 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698