Chromium Code Reviews| 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; |