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

Unified Diff: content/browser/loader/test_url_loader_client.cc

Issue 2633123002: [Mojo-Loading] OnStartLoadingResponseBody should be called after OnReceiveResponse (Closed)
Patch Set: fix Created 3 years, 11 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
Index: content/browser/loader/test_url_loader_client.cc
diff --git a/content/browser/loader/test_url_loader_client.cc b/content/browser/loader/test_url_loader_client.cc
index d87ee132ce21179e89e940a4f7ef35d9ac3a8d61..c8839229d29b056d9e53cab64d3425106ebd9cd5 100644
--- a/content/browser/loader/test_url_loader_client.cc
+++ b/content/browser/loader/test_url_loader_client.cc
@@ -18,6 +18,7 @@ void TestURLLoaderClient::OnReceiveResponse(
mojom::DownloadedTempFilePtr downloaded_file) {
has_received_response_ = true;
response_head_ = response_head;
+ EXPECT_FALSE(has_received_completion_);
if (quit_closure_for_on_receive_response_)
quit_closure_for_on_receive_response_.Run();
}
@@ -29,6 +30,7 @@ void TestURLLoaderClient::OnReceiveRedirect(
EXPECT_FALSE(has_received_response_);
// Use ClearHasReceivedRedirect to accept more redirects.
EXPECT_FALSE(has_received_redirect_);
+ EXPECT_FALSE(has_received_completion_);
has_received_redirect_ = true;
redirect_info_ = redirect_info;
response_head_ = response_head;
@@ -38,6 +40,8 @@ void TestURLLoaderClient::OnReceiveRedirect(
void TestURLLoaderClient::OnDataDownloaded(int64_t data_length,
int64_t encoded_data_length) {
+ EXPECT_TRUE(has_received_response_);
+ EXPECT_FALSE(has_received_completion_);
has_data_downloaded_ = true;
download_data_length_ += data_length;
encoded_download_data_length_ += encoded_data_length;
@@ -46,12 +50,16 @@ void TestURLLoaderClient::OnDataDownloaded(int64_t data_length,
}
void TestURLLoaderClient::OnTransferSizeUpdated(int32_t transfer_size_diff) {
+ EXPECT_TRUE(has_received_response_);
+ EXPECT_FALSE(has_received_completion_);
EXPECT_GT(transfer_size_diff, 0);
body_transfer_size_ += transfer_size_diff;
}
void TestURLLoaderClient::OnStartLoadingResponseBody(
mojo::ScopedDataPipeConsumerHandle body) {
+ EXPECT_TRUE(has_received_response_);
+ EXPECT_FALSE(has_received_completion_);
response_body_ = std::move(body);
if (quit_closure_for_on_start_loading_response_body_)
quit_closure_for_on_start_loading_response_body_.Run();

Powered by Google App Engine
This is Rietveld 408576698