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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 = new net::QuicSimpleServer(std::move(proof_source), config, |
80 net::QuicSupportedVersions()); | 80 net::AllSupportedVersions()); |
81 | 81 |
82 // Start listening. | 82 // Start listening. |
83 int rv = g_quic_server->Listen( | 83 int rv = g_quic_server->Listen( |
84 net::IPEndPoint(net::IPAddress::IPv4AllZeros(), kTestServerPort)); | 84 net::IPEndPoint(net::IPAddress::IPv4AllZeros(), kTestServerPort)); |
85 CHECK_GE(rv, 0) << "Quic server fails to start"; | 85 CHECK_GE(rv, 0) << "Quic server fails to start"; |
86 server_started_event->Signal(); | 86 server_started_event->Signal(); |
87 } | 87 } |
88 | 88 |
89 void ShutdownOnServerThread(base::WaitableEvent* server_stopped_event) { | 89 void ShutdownOnServerThread(base::WaitableEvent* server_stopped_event) { |
90 DCHECK(g_quic_server_thread->task_runner()->BelongsToCurrentThread()); | 90 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, | 125 base::WaitableEvent::ResetPolicy::MANUAL, |
126 base::WaitableEvent::InitialState::NOT_SIGNALED); | 126 base::WaitableEvent::InitialState::NOT_SIGNALED); |
127 g_quic_server_thread->task_runner()->PostTask( | 127 g_quic_server_thread->task_runner()->PostTask( |
128 FROM_HERE, base::Bind(&ShutdownOnServerThread, &server_stopped_event)); | 128 FROM_HERE, base::Bind(&ShutdownOnServerThread, &server_stopped_event)); |
129 server_stopped_event.Wait(); | 129 server_stopped_event.Wait(); |
130 delete g_quic_server_thread; | 130 delete g_quic_server_thread; |
131 g_quic_server_thread = nullptr; | 131 g_quic_server_thread = nullptr; |
132 } | 132 } |
133 | 133 |
134 } // namespace cronet | 134 } // namespace cronet |
OLD | NEW |