OLD | NEW |
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 #include "components/cronet/ios/test/quic_test_server.h" | 5 #include "components/cronet/ios/test/quic_test_server.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 net::QuicConfig config; | 69 net::QuicConfig config; |
70 // Set up server certs. | 70 // Set up server certs. |
71 base::FilePath directory; | 71 base::FilePath directory; |
72 directory = test_files_root; | 72 directory = test_files_root; |
73 std::unique_ptr<net::ProofSourceChromium> proof_source( | 73 std::unique_ptr<net::ProofSourceChromium> proof_source( |
74 new net::ProofSourceChromium()); | 74 new net::ProofSourceChromium()); |
75 CHECK(proof_source->Initialize( | 75 CHECK(proof_source->Initialize( |
76 directory.Append("quic_test.example.com.crt"), | 76 directory.Append("quic_test.example.com.crt"), |
77 directory.Append("quic_test.example.com.key.pkcs8"), | 77 directory.Append("quic_test.example.com.key.pkcs8"), |
78 directory.Append("quic_test.example.com.key.sct"))); | 78 directory.Append("quic_test.example.com.key.sct"))); |
79 g_quic_server = new net::QuicSimpleServer(std::move(proof_source), config, | 79 g_quic_server = |
80 net::AllSupportedVersions()); | 80 new net::QuicSimpleServer(std::move(proof_source), config, |
| 81 net::QuicCryptoServerConfig::ConfigOptions(), |
| 82 net::AllSupportedVersions()); |
81 | 83 |
82 // Start listening. | 84 // Start listening. |
83 int rv = g_quic_server->Listen( | 85 int rv = g_quic_server->Listen( |
84 net::IPEndPoint(net::IPAddress::IPv4AllZeros(), kTestServerPort)); | 86 net::IPEndPoint(net::IPAddress::IPv4AllZeros(), kTestServerPort)); |
85 CHECK_GE(rv, 0) << "Quic server fails to start"; | 87 CHECK_GE(rv, 0) << "Quic server fails to start"; |
86 server_started_event->Signal(); | 88 server_started_event->Signal(); |
87 } | 89 } |
88 | 90 |
89 void ShutdownOnServerThread(base::WaitableEvent* server_stopped_event) { | 91 void ShutdownOnServerThread(base::WaitableEvent* server_stopped_event) { |
90 DCHECK(g_quic_server_thread->task_runner()->BelongsToCurrentThread()); | 92 DCHECK(g_quic_server_thread->task_runner()->BelongsToCurrentThread()); |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 base::WaitableEvent::ResetPolicy::MANUAL, | 127 base::WaitableEvent::ResetPolicy::MANUAL, |
126 base::WaitableEvent::InitialState::NOT_SIGNALED); | 128 base::WaitableEvent::InitialState::NOT_SIGNALED); |
127 g_quic_server_thread->task_runner()->PostTask( | 129 g_quic_server_thread->task_runner()->PostTask( |
128 FROM_HERE, base::Bind(&ShutdownOnServerThread, &server_stopped_event)); | 130 FROM_HERE, base::Bind(&ShutdownOnServerThread, &server_stopped_event)); |
129 server_stopped_event.Wait(); | 131 server_stopped_event.Wait(); |
130 delete g_quic_server_thread; | 132 delete g_quic_server_thread; |
131 g_quic_server_thread = nullptr; | 133 g_quic_server_thread = nullptr; |
132 } | 134 } |
133 | 135 |
134 } // namespace cronet | 136 } // namespace cronet |
OLD | NEW |