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

Unified Diff: net/url_request/url_request_http_job_unittest.cc

Issue 2451233002: Make request fail with ERR_CONTENT_DECODING_INIT_FAILED if sdch is not supported (Closed)
Patch Set: Address Matt's comment Created 4 years, 2 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
« no previous file with comments | « net/url_request/url_request_http_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_http_job_unittest.cc
diff --git a/net/url_request/url_request_http_job_unittest.cc b/net/url_request/url_request_http_job_unittest.cc
index d2e308111f1f0e2ad3596b3cd740c7c2b3001fe3..8dc4e0050ea0ce7e9057bd7f64cd59c0c562df52 100644
--- a/net/url_request/url_request_http_job_unittest.cc
+++ b/net/url_request/url_request_http_job_unittest.cc
@@ -159,6 +159,33 @@ TEST_F(URLRequestHttpJobSetUpSourceTest, UnknownEncoding) {
EXPECT_EQ("Test Content", delegate_.data_received());
}
+// Received a malformed SDCH encoded response when there is no SdchManager.
+TEST_F(URLRequestHttpJobSetUpSourceTest,
+ SdchNotAdvertisedGotMalformedSdchResponse) {
+ MockWrite writes[] = {MockWrite(kSimpleGetMockWrite)};
+ MockRead reads[] = {MockRead("HTTP/1.1 200 OK\r\n"
+ "Content-Encoding: sdch\r\n"
+ "Content-Length: 12\r\n\r\n"),
+ MockRead("Test Content")};
+
+ StaticSocketDataProvider socket_data(reads, arraysize(reads), writes,
+ arraysize(writes));
+ socket_factory_.AddSocketDataProvider(&socket_data);
+
+ // This test expects TestURLRequestContexts to have no SdchManager.
+ DCHECK(!context_.sdch_manager());
+
+ std::unique_ptr<URLRequest> request = context_.CreateRequest(
+ GURL("http://www.example.com"), DEFAULT_PRIORITY, &delegate_);
+ std::unique_ptr<TestURLRequestHttpJob> job(
+ new TestURLRequestHttpJob(request.get()));
+ test_job_interceptor_->set_main_intercept_job(std::move(job));
+ request->Start();
+
+ base::RunLoop().Run();
+ EXPECT_EQ(ERR_CONTENT_DECODING_INIT_FAILED, delegate_.request_status());
+}
+
class URLRequestHttpJobTest : public ::testing::Test {
protected:
URLRequestHttpJobTest() : context_(true) {
« no previous file with comments | « net/url_request/url_request_http_job.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698