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

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: Address Helen's comments. Created 4 years 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 | « no previous file | net/url_request/url_request_http_job.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..7a77a17d17f3e73661606b80048b55f3b0e765be 100644
--- a/components/cronet/ios/test/cronet_http_test.mm
+++ b/components/cronet/ios/test/cronet_http_test.mm
@@ -196,6 +196,40 @@ TEST_F(HttpTest, SdchDisabledByDefault) {
EXPECT_FALSE([[delegate_ responseBody] containsString:@"sdch"]);
}
+// Verify that explictly setting Accept-Encoding request header to 'gzip,sdch"
+// is passed to the server and does not trigger any failures. This behavior may
+// In the future Cronet may not allow caller to set Accept-Encoding header and
+// could limit it to set of internally suported and enabled encodings, matching
+// behavior of Cronet on Android.
+TEST_F(HttpTest, AcceptEncodingSdchIsAllowed) {
+ 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"]);
+}
+
+// Verify that explictly setting Accept-Encoding request header to 'foo,bar"
+// is passed to the server and does not trigger any failures. This behavior may
+// In the future Cronet may not allow caller to set Accept-Encoding header and
+// could limit it to set of internally suported and enabled encodings, matching
+// behavior of Cronet on Android.
+TEST_F(HttpTest, AcceptEncodingFooBarIsAllowed) {
+ 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') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698