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

Unified Diff: media/blink/multibuffer_data_source_unittest.cc

Issue 1777153002: Improve retry support for media network loading. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: comments addressed 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/buffered_data_source_unittest.cc ('k') | media/blink/resource_multibuffer_data_provider.h » ('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 a855001f97d03dceab3dde27caa13f1feef4da0b..a52700cde0ceba8f351ce6da8ba000f60cee7026 100644
--- a/media/blink/multibuffer_data_source_unittest.cc
+++ b/media/blink/multibuffer_data_source_unittest.cc
@@ -322,6 +322,12 @@ class MultibufferDataSourceTest : public testing::Test {
message_loop_.RunUntilIdle();
}
+ void FailLoading() {
+ data_provider()->didFail(url_loader(),
+ response_generator_->GenerateError());
+ message_loop_.RunUntilIdle();
+ }
+
void Restart() {
EXPECT_TRUE(data_provider());
EXPECT_FALSE(active_loader_allownull());
@@ -793,23 +799,19 @@ TEST_F(MultibufferDataSourceTest, Http_TooManyRetries) {
// Make sure there's a pending read -- we'll expect it to error.
ReadAt(kDataSize);
- // It'll try three times.
- FinishLoading();
- Restart();
- Respond(response_generator_->Generate206(kDataSize));
-
- FinishLoading();
- Restart();
- Respond(response_generator_->Generate206(kDataSize));
-
- FinishLoading();
- Restart();
- Respond(response_generator_->Generate206(kDataSize));
-
- // It'll error after this.
- EXPECT_CALL(*this, ReadCallback(media::DataSource::kReadError));
- FinishLoading();
+ for (int i = 0; i < ResourceMultiBufferDataProvider::kMaxRetries; i++) {
+ FailLoading();
+ data_provider()->Start();
+ Respond(response_generator_->Generate206(kDataSize));
+ }
+ // Stop() will also cause the readback to be called with kReadError, but
+ // we want to make sure it was called during FailLoading().
+ bool failed_ = false;
+ EXPECT_CALL(*this, ReadCallback(media::DataSource::kReadError))
+ .WillOnce(Assign(&failed_, true));
+ FailLoading();
+ EXPECT_TRUE(failed_);
EXPECT_FALSE(loading());
Stop();
}
@@ -820,23 +822,19 @@ TEST_F(MultibufferDataSourceTest, File_TooManyRetries) {
// Make sure there's a pending read -- we'll expect it to error.
ReadAt(kDataSize);
- // It'll try three times.
- FinishLoading();
- Restart();
- Respond(response_generator_->GenerateFileResponse(0));
-
- FinishLoading();
- Restart();
- Respond(response_generator_->GenerateFileResponse(0));
-
- FinishLoading();
- Restart();
- Respond(response_generator_->GenerateFileResponse(0));
-
- // It'll error after this.
- EXPECT_CALL(*this, ReadCallback(media::DataSource::kReadError));
- FinishLoading();
+ for (int i = 0; i < ResourceMultiBufferDataProvider::kMaxRetries; i++) {
+ FailLoading();
+ data_provider()->Start();
+ Respond(response_generator_->Generate206(kDataSize));
+ }
+ // Stop() will also cause the readback to be called with kReadError, but
+ // we want to make sure it was called during FailLoading().
+ bool failed_ = false;
+ EXPECT_CALL(*this, ReadCallback(media::DataSource::kReadError))
+ .WillOnce(Assign(&failed_, true));
+ FailLoading();
+ EXPECT_TRUE(failed_);
EXPECT_FALSE(loading());
Stop();
}
« no previous file with comments | « media/blink/buffered_data_source_unittest.cc ('k') | media/blink/resource_multibuffer_data_provider.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698