| OLD | NEW |
| (Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #import <Cronet/Cronet.h> |
| 6 #import <Foundation/Foundation.h> |
| 7 |
| 8 #include "components/cronet/ios/test/start_cronet.h" |
| 9 |
| 10 #include "base/at_exit.h" |
| 11 #include "components/grpc_support/test/quic_test_server.h" |
| 12 |
| 13 namespace cronet { |
| 14 |
| 15 base::AtExitManager* g_at_exit_ = nullptr; |
| 16 |
| 17 void StartCronetIfNecessary() { |
| 18 static bool initialized = false; |
| 19 if (!initialized) { |
| 20 initialized = true; |
| 21 [Cronet setUserAgent:@"CronetTest/1.0.0.0" partial:NO]; |
| 22 [Cronet setHttp2Enabled:true]; |
| 23 [Cronet setQuicEnabled:true]; |
| 24 [Cronet setSslKeyLogFileName:@"SSLKEYLOGFILE"]; |
| 25 [Cronet addQuicHint:@"test.example.com" |
| 26 port:grpc_support::kTestServerPort |
| 27 altPort:grpc_support::kTestServerPort]; |
| 28 [Cronet enableTestCertVerifierForTesting]; |
| 29 [Cronet |
| 30 setHostResolverRulesForTesting:@"MAP test.example.com 127.0.0.1," |
| 31 "MAP notfound.example.com ~NOTFOUND"]; |
| 32 [Cronet start]; |
| 33 |
| 34 // This method must be called once from the main thread. |
| 35 if (!g_at_exit_) |
| 36 g_at_exit_ = new base::AtExitManager; |
| 37 } |
| 38 } |
| 39 |
| 40 } // namespace cronet |
| OLD | NEW |