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

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

Issue 2733253002: [Cronet] Don't claim support of UrlRequests with data URL scheme. (Closed)
Patch Set: Created 3 years, 9 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 | « components/cronet/ios/Cronet.mm ('k') | no next file » | 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 011132e5c6910ad6ca125343a904dd2af767a64e..e1642feeaf9cbb5a6ad0cff8fdde7d7e7a03d6b1 100644
--- a/components/cronet/ios/test/cronet_http_test.mm
+++ b/components/cronet/ios/test/cronet_http_test.mm
@@ -398,4 +398,21 @@ TEST_F(HttpTest, FileSchemeNotSupported) {
EXPECT_TRUE([[delegate_ responseBody] containsString:fileData]);
}
+TEST_F(HttpTest, DataSchemeNotSupported) {
+ NSString* testString = @"Hello, World!";
+ NSData* testData = [testString dataUsingEncoding:NSUTF8StringEncoding];
+ NSString* dataString =
+ [NSString stringWithFormat:@"data:text/plain;base64,%@",
+ [testData base64EncodedStringWithOptions:0]];
+ NSURL* url = [NSURL URLWithString:dataString];
+ NSURLSessionDataTask* task = [session_ dataTaskWithURL:url];
+ [Cronet setRequestFilterBlock:^(NSURLRequest* request) {
+ EXPECT_TRUE(false) << "Block should not be called for unsupported requests";
+ return YES;
+ }];
+ StartDataTaskAndWaitForCompletion(task);
+ EXPECT_EQ(nil, [delegate_ error]);
+ EXPECT_TRUE([[delegate_ responseBody] containsString:testString]);
+}
+
} // namespace cronet
« no previous file with comments | « components/cronet/ios/Cronet.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698