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

Unified Diff: media/blink/multibuffer_data_source_unittest.cc

Issue 1815893002: Merge M50: "Disable "pause-and-buffer" on Android, cancel suspended players." (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2661
Patch Set: Created 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « media/blink/multibuffer_data_source.cc ('k') | media/blink/webmediaplayer_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/blink/multibuffer_data_source_unittest.cc
diff --git a/media/blink/multibuffer_data_source_unittest.cc b/media/blink/multibuffer_data_source_unittest.cc
index d895ad7117629c3152cd437ab1d45bc63df05510..91d8b31deff9978705758844f5485f52d6670195 100644
--- a/media/blink/multibuffer_data_source_unittest.cc
+++ b/media/blink/multibuffer_data_source_unittest.cc
@@ -1203,7 +1203,7 @@ TEST_F(MultibufferDataSourceTest,
ReadAt(kDataSize);
- data_source_->OnBufferingHaveEnough();
+ data_source_->OnBufferingHaveEnough(false);
ASSERT_TRUE(active_loader());
EXPECT_CALL(*this, ReadCallback(kDataSize));
@@ -1213,6 +1213,47 @@ TEST_F(MultibufferDataSourceTest,
EXPECT_FALSE(active_loader_allownull());
}
+TEST_F(MultibufferDataSourceTest,
+ ExternalResource_Response206_CancelAfterPlay) {
+ set_preload(BufferedDataSource::METADATA);
+ InitializeWith206Response();
+
+ EXPECT_EQ(MultibufferDataSource::METADATA, preload());
+ EXPECT_FALSE(is_local_source());
+
+ EXPECT_TRUE(data_source_->range_supported());
+ CheckReadThenDefer();
+
+ ReadAt(kDataSize);
+
+ // Marking the media as playing should prevent deferral. It also tells the
+ // data source to start buffering beyond the initial load.
+ data_source_->MediaIsPlaying();
+ data_source_->OnBufferingHaveEnough(false);
+ CheckCapacityDefer();
+ ASSERT_TRUE(active_loader());
+
+ // Read a bit from the beginning and ensure deferral hasn't happened yet.
+ EXPECT_CALL(*this, ReadCallback(kDataSize));
+ EXPECT_CALL(host_, AddBufferedByteRange(0, kDataSize * 2));
+ ReceiveData(kDataSize);
+ ASSERT_TRUE(active_loader());
+ data_source_->OnBufferingHaveEnough(true);
+ ASSERT_TRUE(active_loader());
+ ASSERT_FALSE(active_loader()->deferred());
+
+ // Deliver data until capacity is reached and verify deferral.
+ int bytes_received = 0;
+ EXPECT_CALL(host_, AddBufferedByteRange(_, _)).Times(testing::AtLeast(1));
+ while (active_loader_allownull() && !active_loader()->deferred()) {
+ ReceiveData(kDataSize);
+ bytes_received += kDataSize;
+ }
+ EXPECT_GT(bytes_received, 0);
+ EXPECT_LT(bytes_received + kDataSize, kFileSize);
+ EXPECT_FALSE(active_loader_allownull());
+}
+
TEST_F(MultibufferDataSourceTest, SeekPastEOF) {
GURL gurl(kHttpUrl);
data_source_.reset(new MockMultibufferDataSource(
« no previous file with comments | « media/blink/multibuffer_data_source.cc ('k') | media/blink/webmediaplayer_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698