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

Unified Diff: net/url_request/url_request_unittest.cc

Issue 6881106: Treat ERR_CONNECTION_CLOSED as end-of-data marker for downloads. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: pick 91c11da Forced logging on again. Created 9 years, 7 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: net/url_request/url_request_unittest.cc
diff --git a/net/url_request/url_request_unittest.cc b/net/url_request/url_request_unittest.cc
index ebabe8da4a9bd063ec69ccabd8ad58c6ab6bc850..acbf4c1a9600fdefd5273b63214252d3d4fee80a 100644
--- a/net/url_request/url_request_unittest.cc
+++ b/net/url_request/url_request_unittest.cc
@@ -428,6 +428,54 @@ TEST_F(URLRequestTestHTTP, GetTest) {
}
}
+TEST_F(URLRequestTestHTTP, GetZippedTest) {
+ ASSERT_TRUE(test_server_.Start());
+
+ // Parameter that specifies the Content-Length field in the response:
+ // C - Compressed length.
+ // U - Uncompressed length.
+ // L - Large length (larger than both C & U).
+ // M - Medium length (between C & U).
+ // S - Small length (smaller than both C & U).
+ const char test_parameters[] = "CULMS";
+ const int num_tests =
+ (sizeof(test_parameters) / sizeof(test_parameters[0])) - 1; // Skip NULL.
willchan no longer on Chromium 2011/05/23 22:12:26 Use arraysize() instead.
ahendrickson 2011/05/24 04:58:37 Done.
+ // C & U should be OK.
+ // L & M are larger than the data sent, and show an error.
+ // S has too little data, but we seem to accept it.
+ const bool test_expect_success[num_tests] =
+ { true, true, false, false, true };
+
+ for (int i = 0; i < num_tests ; i++) {
+ TestDelegate d;
+ {
+ std::string test_file =
+ base::StringPrintf("compressedfiles/BullRunSpeech.txt?%c",
+ test_parameters[i]);
+ TestURLRequest r(test_server_.GetURL(test_file), &d);
+
+ r.Start();
+ EXPECT_TRUE(r.is_pending());
+
+ MessageLoop::current()->Run();
+
+ EXPECT_EQ(1, d.response_started_count());
+ EXPECT_FALSE(d.received_data_before_response());
+ VLOG(1) << " Received " << d.bytes_received() << " bytes"
+ << " status = " << r.status().status()
+ << " os_error = " << r.status().os_error();
+ if (test_expect_success[i]) {
+ EXPECT_EQ(URLRequestStatus::SUCCESS, r.status().status())
+ << " Parameter = \"" << test_file << "\"";
+ } else {
+ EXPECT_EQ(URLRequestStatus::FAILED, r.status().status());
+ EXPECT_EQ(-100, r.status().os_error())
+ << " Parameter = \"" << test_file << "\"";
+ }
+ }
+ }
+}
+
TEST_F(URLRequestTestHTTP, HTTPSToHTTPRedirectNoRefererTest) {
ASSERT_TRUE(test_server_.Start());
« net/url_request/url_request_http_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