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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « components/cronet/ios/Cronet.mm ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #import <Cronet/Cronet.h> 5 #import <Cronet/Cronet.h>
6 #import <Foundation/Foundation.h> 6 #import <Foundation/Foundation.h>
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after
391 [[NSFileManager defaultManager] removeItemAtPath:filePath error:nil]; 391 [[NSFileManager defaultManager] removeItemAtPath:filePath error:nil];
392 EXPECT_TRUE(false) << "Block should not be called for unsupported requests"; 392 EXPECT_TRUE(false) << "Block should not be called for unsupported requests";
393 return YES; 393 return YES;
394 }]; 394 }];
395 StartDataTaskAndWaitForCompletion(task); 395 StartDataTaskAndWaitForCompletion(task);
396 [[NSFileManager defaultManager] removeItemAtPath:filePath error:nil]; 396 [[NSFileManager defaultManager] removeItemAtPath:filePath error:nil];
397 EXPECT_EQ(nil, [delegate_ error]); 397 EXPECT_EQ(nil, [delegate_ error]);
398 EXPECT_TRUE([[delegate_ responseBody] containsString:fileData]); 398 EXPECT_TRUE([[delegate_ responseBody] containsString:fileData]);
399 } 399 }
400 400
401 TEST_F(HttpTest, DataSchemeNotSupported) {
402 NSString* testString = @"Hello, World!";
403 NSData* testData = [testString dataUsingEncoding:NSUTF8StringEncoding];
404 NSString* dataString =
405 [NSString stringWithFormat:@"data:text/plain;base64,%@",
406 [testData base64EncodedStringWithOptions:0]];
407 NSURL* url = [NSURL URLWithString:dataString];
408 NSURLSessionDataTask* task = [session_ dataTaskWithURL:url];
409 [Cronet setRequestFilterBlock:^(NSURLRequest* request) {
410 EXPECT_TRUE(false) << "Block should not be called for unsupported requests";
411 return YES;
412 }];
413 StartDataTaskAndWaitForCompletion(task);
414 EXPECT_EQ(nil, [delegate_ error]);
415 EXPECT_TRUE([[delegate_ responseBody] containsString:testString]);
416 }
417
401 } // namespace cronet 418 } // namespace cronet
OLDNEW
« 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