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

Unified Diff: components/cronet/ios/test/cronet_http_test.mm

Issue 2512263002: Pass raw response with Context-Encoding sdch if support is not configured. (Closed)
Patch Set: Fix net unittests. Created 4 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
Index: components/cronet/ios/test/cronet_http_test.mm
diff --git a/components/cronet/ios/test/cronet_http_test.mm b/components/cronet/ios/test/cronet_http_test.mm
index 36923e623a6d47a1e42db8a116aa53b87190d019..860c79b1e4e53748537459d8b8002c34d0fd5523 100644
--- a/components/cronet/ios/test/cronet_http_test.mm
+++ b/components/cronet/ios/test/cronet_http_test.mm
@@ -196,6 +196,30 @@ TEST_F(HttpTest, SdchDisabledByDefault) {
EXPECT_FALSE([[delegate_ responseBody] containsString:@"sdch"]);
}
+TEST_F(HttpTest, AcceptEncodingSdch) {
xunjieli 2016/11/29 23:30:42 I think this deserves a comment and maybe also men
mef 2016/11/30 15:51:06 Done.
+ NSURL* url =
+ net::NSURLWithGURL(GURL(TestServer::GetEchoHeaderURL("Accept-Encoding")));
+ NSMutableURLRequest* mutableRequest =
+ [[NSURLRequest requestWithURL:url] mutableCopy];
+ [mutableRequest addValue:@"gzip,sdch" forHTTPHeaderField:@"Accept-Encoding"];
+ NSURLSessionDataTask* task = [session_ dataTaskWithRequest:mutableRequest];
+ StartDataTaskAndWaitForCompletion(task);
+ EXPECT_EQ(nil, [delegate_ error]);
+ EXPECT_TRUE([[delegate_ responseBody] containsString:@"gzip,sdch"]);
+}
+
+TEST_F(HttpTest, AcceptEncodingFooBar) {
+ NSURL* url =
+ net::NSURLWithGURL(GURL(TestServer::GetEchoHeaderURL("Accept-Encoding")));
+ NSMutableURLRequest* mutableRequest =
+ [[NSURLRequest requestWithURL:url] mutableCopy];
+ [mutableRequest addValue:@"foo,bar" forHTTPHeaderField:@"Accept-Encoding"];
+ NSURLSessionDataTask* task = [session_ dataTaskWithRequest:mutableRequest];
+ StartDataTaskAndWaitForCompletion(task);
+ EXPECT_EQ(nil, [delegate_ error]);
+ EXPECT_TRUE([[delegate_ responseBody] containsString:@"foo,bar"]);
+}
+
TEST_F(HttpTest, NSURLSessionAcceptLanguage) {
NSURL* url =
net::NSURLWithGURL(GURL(TestServer::GetEchoHeaderURL("Accept-Language")));
« no previous file with comments | « no previous file | net/url_request/url_request_http_job.cc » ('j') | net/url_request/url_request_http_job_unittest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698