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

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

Issue 1526303004: Fix buffered range updates in media::Pipeline (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added unit test Created 5 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
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/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "base/stl_util.h" 9 #include "base/stl_util.h"
10 #include "base/test/simple_test_tick_clock.h" 10 #include "base/test/simple_test_tick_clock.h"
(...skipping 639 matching lines...) Expand 10 before | Expand all | Expand 10 after
650 650
651 const base::TimeDelta kDuration = base::TimeDelta::FromSeconds(100); 651 const base::TimeDelta kDuration = base::TimeDelta::FromSeconds(100);
652 SetDemuxerExpectations(&streams, kDuration); 652 SetDemuxerExpectations(&streams, kDuration);
653 SetRendererExpectations(); 653 SetRendererExpectations();
654 654
655 StartPipelineAndExpect(PIPELINE_OK); 655 StartPipelineAndExpect(PIPELINE_OK);
656 656
657 EXPECT_EQ(0u, pipeline_->GetBufferedTimeRanges().size()); 657 EXPECT_EQ(0u, pipeline_->GetBufferedTimeRanges().size());
658 658
659 EXPECT_FALSE(pipeline_->DidLoadingProgress()); 659 EXPECT_FALSE(pipeline_->DidLoadingProgress());
660 pipeline_->AddBufferedTimeRange(base::TimeDelta(), kDuration / 8); 660 Ranges<base::TimeDelta> ranges;
661 ranges.Add(base::TimeDelta::FromSeconds(0), kDuration / 8);
wolenetz 2016/01/06 19:28:41 nit: just base::TimeDelta() is much more frequentl
servolk 2016/01/06 21:05:05 Done.
wolenetz 2016/01/14 19:25:53 Friendly nit ping (it's still FromSeconds(0) in pa
wolenetz 2016/01/14 19:53:06 Still a nit :)
662 pipeline_->OnBufferedTimeRangesChanged(ranges);
661 EXPECT_TRUE(pipeline_->DidLoadingProgress()); 663 EXPECT_TRUE(pipeline_->DidLoadingProgress());
662 EXPECT_FALSE(pipeline_->DidLoadingProgress()); 664 EXPECT_FALSE(pipeline_->DidLoadingProgress());
663 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size()); 665 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size());
664 EXPECT_EQ(base::TimeDelta(), pipeline_->GetBufferedTimeRanges().start(0)); 666 EXPECT_EQ(base::TimeDelta(), pipeline_->GetBufferedTimeRanges().start(0));
665 EXPECT_EQ(kDuration / 8, pipeline_->GetBufferedTimeRanges().end(0)); 667 EXPECT_EQ(kDuration / 8, pipeline_->GetBufferedTimeRanges().end(0));
666 668
667 base::TimeDelta kSeekTime = kDuration / 2; 669 base::TimeDelta kSeekTime = kDuration / 2;
668 ExpectSeek(kSeekTime, false); 670 ExpectSeek(kSeekTime, false);
669 DoSeek(kSeekTime); 671 DoSeek(kSeekTime);
670 672
(...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after
1151 INSTANTIATE_TEARDOWN_TEST(Error, Seeking); 1153 INSTANTIATE_TEARDOWN_TEST(Error, Seeking);
1152 INSTANTIATE_TEARDOWN_TEST(Error, Playing); 1154 INSTANTIATE_TEARDOWN_TEST(Error, Playing);
1153 INSTANTIATE_TEARDOWN_TEST(Error, Suspending); 1155 INSTANTIATE_TEARDOWN_TEST(Error, Suspending);
1154 INSTANTIATE_TEARDOWN_TEST(Error, Suspended); 1156 INSTANTIATE_TEARDOWN_TEST(Error, Suspended);
1155 INSTANTIATE_TEARDOWN_TEST(Error, Resuming); 1157 INSTANTIATE_TEARDOWN_TEST(Error, Resuming);
1156 1158
1157 INSTANTIATE_TEARDOWN_TEST(ErrorAndStop, Playing); 1159 INSTANTIATE_TEARDOWN_TEST(ErrorAndStop, Playing);
1158 INSTANTIATE_TEARDOWN_TEST(ErrorAndStop, Suspended); 1160 INSTANTIATE_TEARDOWN_TEST(ErrorAndStop, Suspended);
1159 1161
1160 } // namespace media 1162 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698