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

Unified Diff: net/url_request/url_request_job_unittest.cc

Issue 1439953006: Reland: URLRequestJob: change ReadRawData contract (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address David's comment Created 5 years, 1 month 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 | « net/url_request/url_request_job.cc ('k') | net/url_request/url_request_simple_job.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/url_request/url_request_job_unittest.cc
diff --git a/net/url_request/url_request_job_unittest.cc b/net/url_request/url_request_job_unittest.cc
index f9ea1fe6170e34d08926435bb08cf97daeb3f0b4..e0d19b3068274d8c27ca1bb4a1539412e243ef0b 100644
--- a/net/url_request/url_request_job_unittest.cc
+++ b/net/url_request/url_request_job_unittest.cc
@@ -76,6 +76,24 @@ const MockTransaction kRedirect_Transaction = {
OK,
};
+const MockTransaction kEmptyBodyGzip_Transaction = {
+ "http://www.google.com/empty_body",
+ "GET",
+ base::Time(),
+ "",
+ LOAD_NORMAL,
+ "HTTP/1.1 200 OK",
+ "Content-Encoding: gzip\n",
+ base::Time(),
+ "",
+ TEST_MODE_NORMAL,
+ nullptr,
+ nullptr,
+ 0,
+ 0,
+ OK,
+};
+
} // namespace
TEST(URLRequestJob, TransactionNotifiedWhenDone) {
@@ -187,4 +205,30 @@ TEST(URLRequestJob, TransactionNotCachedWhenNetworkDelegateRedirects) {
RemoveMockTransaction(&kGZip_Transaction);
}
+// Makes sure that ReadRawDataComplete correctly updates request status before
+// calling ReadFilteredData.
+// Regression test for crbug.com/553300.
+TEST(URLRequestJob, EmptyBodySkipFilter) {
+ MockNetworkLayer network_layer;
+ TestURLRequestContext context;
+ context.set_http_transaction_factory(&network_layer);
+
+ TestDelegate d;
+ scoped_ptr<URLRequest> req(context.CreateRequest(
+ GURL(kEmptyBodyGzip_Transaction.url), DEFAULT_PRIORITY, &d));
+ AddMockTransaction(&kEmptyBodyGzip_Transaction);
+
+ req->set_method("GET");
+ req->Start();
+
+ base::MessageLoop::current()->Run();
+
+ EXPECT_FALSE(d.request_failed());
+ EXPECT_EQ(200, req->GetResponseCode());
+ EXPECT_TRUE(d.data_received().empty());
+ EXPECT_TRUE(network_layer.done_reading_called());
+
+ RemoveMockTransaction(&kEmptyBodyGzip_Transaction);
+}
+
} // namespace net
« no previous file with comments | « net/url_request/url_request_job.cc ('k') | net/url_request/url_request_simple_job.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698