| OLD | NEW |
| 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 Loading... |
| 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 |
| OLD | NEW |