| OLD | NEW |
| 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 #include "quic_test_server.h" | 5 #include "quic_test_server.h" |
| 6 | 6 |
| 7 #include "base/android/jni_android.h" | 7 #include "base/android/jni_android.h" |
| 8 #include "base/android/jni_string.h" | 8 #include "base/android/jni_string.h" |
| 9 #include "base/android/path_utils.h" | 9 #include "base/android/path_utils.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 | 47 |
| 48 // Set up server certs. | 48 // Set up server certs. |
| 49 base::FilePath directory = test_data_dir.Append("net/data/ssl/certificates"); | 49 base::FilePath directory = test_data_dir.Append("net/data/ssl/certificates"); |
| 50 std::unique_ptr<net::ProofSourceChromium> proof_source( | 50 std::unique_ptr<net::ProofSourceChromium> proof_source( |
| 51 new net::ProofSourceChromium()); | 51 new net::ProofSourceChromium()); |
| 52 CHECK(proof_source->Initialize( | 52 CHECK(proof_source->Initialize( |
| 53 directory.Append("quic_test.example.com.crt"), | 53 directory.Append("quic_test.example.com.crt"), |
| 54 directory.Append("quic_test.example.com.key.pkcs8"), | 54 directory.Append("quic_test.example.com.key.pkcs8"), |
| 55 directory.Append("quic_test.example.com.key.sct"))); | 55 directory.Append("quic_test.example.com.key.sct"))); |
| 56 g_quic_server = new net::QuicSimpleServer(std::move(proof_source), config, | 56 g_quic_server = new net::QuicSimpleServer(std::move(proof_source), config, |
| 57 net::QuicSupportedVersions()); | 57 net::AllSupportedVersions()); |
| 58 | 58 |
| 59 // Start listening. | 59 // Start listening. |
| 60 int rv = g_quic_server->Listen( | 60 int rv = g_quic_server->Listen( |
| 61 net::IPEndPoint(net::IPAddress::IPv4AllZeros(), kServerPort)); | 61 net::IPEndPoint(net::IPAddress::IPv4AllZeros(), kServerPort)); |
| 62 CHECK_GE(rv, 0) << "Quic server fails to start"; | 62 CHECK_GE(rv, 0) << "Quic server fails to start"; |
| 63 JNIEnv* env = base::android::AttachCurrentThread(); | 63 JNIEnv* env = base::android::AttachCurrentThread(); |
| 64 Java_QuicTestServer_onServerStarted(env); | 64 Java_QuicTestServer_onServerStarted(env); |
| 65 } | 65 } |
| 66 | 66 |
| 67 void ShutdownOnServerThread() { | 67 void ShutdownOnServerThread() { |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 | 111 |
| 112 int GetServerPort(JNIEnv* env, const JavaParamRef<jclass>& /*jcaller*/) { | 112 int GetServerPort(JNIEnv* env, const JavaParamRef<jclass>& /*jcaller*/) { |
| 113 return kServerPort; | 113 return kServerPort; |
| 114 } | 114 } |
| 115 | 115 |
| 116 bool RegisterQuicTestServer(JNIEnv* env) { | 116 bool RegisterQuicTestServer(JNIEnv* env) { |
| 117 return RegisterNativesImpl(env); | 117 return RegisterNativesImpl(env); |
| 118 } | 118 } |
| 119 | 119 |
| 120 } // namespace cronet | 120 } // namespace cronet |
| OLD | NEW |