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

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

Issue 2760073002: [cronet] Expose API to set experimental options (Closed)
Patch Set: fix bugs per xunjieli 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/test/cronet_http_test.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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "components/cronet/ios/test/start_cronet.h" 8 #include "components/cronet/ios/test/start_cronet.h"
9 9
10 #include "base/strings/stringprintf.h" 10 #include "base/strings/stringprintf.h"
11 #include "base/strings/sys_string_conversions.h" 11 #include "base/strings/sys_string_conversions.h"
12 #include "components/grpc_support/test/quic_test_server.h" 12 #include "components/grpc_support/test/quic_test_server.h"
13 13
14 namespace cronet { 14 namespace cronet {
15 15
16 void StartCronetIfNecessary(int port) { 16 void StartCronetIfNecessary(int port) {
17 static bool initialized = false; 17 static bool initialized = false;
18 if (!initialized) { 18 if (!initialized) {
19 initialized = true; 19 initialized = true;
20 [Cronet setUserAgent:@"CronetTest/1.0.0.0" partial:NO]; 20 [Cronet setUserAgent:@"CronetTest/1.0.0.0" partial:NO];
21 [Cronet setHttp2Enabled:true]; 21 [Cronet setHttp2Enabled:true];
22 [Cronet setQuicEnabled:true]; 22 [Cronet setQuicEnabled:true];
23 [Cronet setAcceptLanguages:@"en-US,en"]; 23 [Cronet setAcceptLanguages:@"en-US,en"];
24 [Cronet setSslKeyLogFileName:@"SSLKEYLOGFILE"]; 24 [Cronet
25 setExperimentalOptions:
26 [NSString
27 stringWithFormat:@"%@%@%@", @"{\"ssl_key_log_file\":\"",
mef 2017/04/06 18:58:26 Can this be simplified to have first and third str
28 [Cronet getNetLogPathForFile:@"SSLKEYLOGFILE"],
29 @"\"}"]];
25 [Cronet addQuicHint:@"test.example.com" port:443 altPort:443]; 30 [Cronet addQuicHint:@"test.example.com" port:443 altPort:443];
26 [Cronet enableTestCertVerifierForTesting]; 31 [Cronet enableTestCertVerifierForTesting];
27 [Cronet start]; 32 [Cronet start];
28 } 33 }
29 NSString* rules = base::SysUTF8ToNSString( 34 NSString* rules = base::SysUTF8ToNSString(
30 base::StringPrintf("MAP test.example.com 127.0.0.1:%d," 35 base::StringPrintf("MAP test.example.com 127.0.0.1:%d,"
31 "MAP notfound.example.com ~NOTFOUND", 36 "MAP notfound.example.com ~NOTFOUND",
32 port)); 37 port));
33 [Cronet setHostResolverRulesForTesting:rules]; 38 [Cronet setHostResolverRulesForTesting:rules];
34 } 39 }
35 40
36 } // namespace cronet 41 } // namespace cronet
OLDNEW
« no previous file with comments | « components/cronet/ios/test/cronet_http_test.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698