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

Side by Side Diff: components/cronet/ios/test/cronet_http_test.mm

Issue 2760073002: [cronet] Expose API to set experimental options (Closed)
Patch Set: sync Created 3 years, 8 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_environment.mm ('k') | components/cronet/ios/test/start_cronet.mm » ('j') | 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 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 [task resume]; 156 [task resume];
157 int64_t deadline_ns = 1 * ns_in_second; 157 int64_t deadline_ns = 1 * ns_in_second;
158 dispatch_semaphore_wait([delegate_ semaphore], 158 dispatch_semaphore_wait([delegate_ semaphore],
159 dispatch_time(DISPATCH_TIME_NOW, deadline_ns)); 159 dispatch_time(DISPATCH_TIME_NOW, deadline_ns));
160 } 160 }
161 161
162 base::scoped_nsobject<NSURLSession> session_; 162 base::scoped_nsobject<NSURLSession> session_;
163 base::scoped_nsobject<TestDelegate> delegate_; 163 base::scoped_nsobject<TestDelegate> delegate_;
164 }; 164 };
165 165
166 TEST_F(HttpTest, CreateFile) {
167 bool ssl_file_created = [[NSFileManager defaultManager]
168 fileExistsAtPath:[Cronet getNetLogPathForFile:@"SSLKEYLOGFILE"]];
169
170 [[NSFileManager defaultManager]
171 removeItemAtPath:[Cronet getNetLogPathForFile:@"SSLKEYLOGFILE"]
172 error:nil];
173
174 EXPECT_TRUE(ssl_file_created);
175 }
176
166 TEST_F(HttpTest, NSURLSessionReceivesData) { 177 TEST_F(HttpTest, NSURLSessionReceivesData) {
167 NSURL* url = net::NSURLWithGURL(GURL(grpc_support::kTestServerUrl)); 178 NSURL* url = net::NSURLWithGURL(GURL(grpc_support::kTestServerUrl));
168 __block BOOL block_used = NO; 179 __block BOOL block_used = NO;
169 NSURLSessionDataTask* task = [session_ dataTaskWithURL:url]; 180 NSURLSessionDataTask* task = [session_ dataTaskWithURL:url];
170 [Cronet setRequestFilterBlock:^(NSURLRequest* request) { 181 [Cronet setRequestFilterBlock:^(NSURLRequest* request) {
171 block_used = YES; 182 block_used = YES;
172 EXPECT_EQ([request URL], url); 183 EXPECT_EQ([request URL], url);
173 return YES; 184 return YES;
174 }]; 185 }];
175 StartDataTaskAndWaitForCompletion(task); 186 StartDataTaskAndWaitForCompletion(task);
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
409 [Cronet setRequestFilterBlock:^(NSURLRequest* request) { 420 [Cronet setRequestFilterBlock:^(NSURLRequest* request) {
410 EXPECT_TRUE(false) << "Block should not be called for unsupported requests"; 421 EXPECT_TRUE(false) << "Block should not be called for unsupported requests";
411 return YES; 422 return YES;
412 }]; 423 }];
413 StartDataTaskAndWaitForCompletion(task); 424 StartDataTaskAndWaitForCompletion(task);
414 EXPECT_EQ(nil, [delegate_ error]); 425 EXPECT_EQ(nil, [delegate_ error]);
415 EXPECT_TRUE([[delegate_ responseBody] containsString:testString]); 426 EXPECT_TRUE([[delegate_ responseBody] containsString:testString]);
416 } 427 }
417 428
418 } // namespace cronet 429 } // namespace cronet
OLDNEW
« no previous file with comments | « components/cronet/ios/cronet_environment.mm ('k') | components/cronet/ios/test/start_cronet.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698