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

Unified Diff: net/url_request/url_request_job_unittest.cc

Issue 1662763002: [ON HOLD] Implement pull-based design for content decoding (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address comments Created 4 years, 5 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
« net/url_request/url_request_job.cc ('K') | « net/url_request/url_request_job.cc ('k') | no next file » | 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 cf338b0520804c32d242152d841af5c7be6372d4..cf2c0c955cd26ac1d94f9fa170e0e95b31bf20e9 100644
--- a/net/url_request/url_request_job_unittest.cc
+++ b/net/url_request/url_request_job_unittest.cc
@@ -50,7 +50,7 @@ void GZipHelloServer(const HttpRequestInfo* request,
std::string* response_status,
std::string* response_headers,
std::string* response_data) {
- response_data->assign(kGzipHelloData, sizeof(kGzipHelloData));
+ response_data->assign(kGzipHelloData, sizeof(kGzipHelloData) - 1);
}
void BigGZipServer(const HttpRequestInfo* request,
@@ -95,6 +95,15 @@ void MakeMockReferrerPolicyTransaction(const char* original_url,
transaction->return_code = OK;
}
+const MockTransaction kNoFilter_Transaction = {
+ "http://www.google.com/gzyp", "GET", base::Time(), "", LOAD_NORMAL,
+ "HTTP/1.1 200 OK",
+ "Cache-Control: max-age=10000\n"
+ "Content-Length: 30\n", // Intentionally wrong.
+ base::Time(),
+ "hello", TEST_MODE_NORMAL, nullptr, nullptr, 0, 0, OK,
+};
+
const MockTransaction kGZip_Transaction = {
"http://www.google.com/gzyp", "GET", base::Time(), "", LOAD_NORMAL,
"HTTP/1.1 200 OK",
@@ -163,6 +172,26 @@ const MockTransaction kBrotli_Slow_Transaction = {
} // namespace
+TEST(URLRequestJob, TransactionNoFilter) {
+ MockNetworkLayer network_layer;
+ TestURLRequestContext context;
+ context.set_http_transaction_factory(&network_layer);
+
+ TestDelegate d;
+ std::unique_ptr<URLRequest> req(context.CreateRequest(
+ GURL(kNoFilter_Transaction.url), DEFAULT_PRIORITY, &d));
+ AddMockTransaction(&kNoFilter_Transaction);
+
+ req->set_method("GET");
+ req->Start();
+
+ base::RunLoop().Run();
+
+ EXPECT_TRUE(network_layer.done_reading_called());
mmenke 2016/07/28 18:40:14 Should we check the final result of the transactio
xunjieli 2016/08/01 16:46:24 Done.
+
+ RemoveMockTransaction(&kNoFilter_Transaction);
+}
+
TEST(URLRequestJob, TransactionNotifiedWhenDone) {
MockNetworkLayer network_layer;
TestURLRequestContext context;
« net/url_request/url_request_job.cc ('K') | « net/url_request/url_request_job.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698