| 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 net::QuicConfig config; | 46 net::QuicConfig config; |
| 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 = |
| 57 net::AllSupportedVersions()); | 57 new net::QuicSimpleServer(std::move(proof_source), config, |
| 58 net::QuicCryptoServerConfig::ConfigOptions(), |
| 59 net::AllSupportedVersions()); |
| 58 | 60 |
| 59 // Start listening. | 61 // Start listening. |
| 60 int rv = g_quic_server->Listen( | 62 int rv = g_quic_server->Listen( |
| 61 net::IPEndPoint(net::IPAddress::IPv4AllZeros(), kServerPort)); | 63 net::IPEndPoint(net::IPAddress::IPv4AllZeros(), kServerPort)); |
| 62 CHECK_GE(rv, 0) << "Quic server fails to start"; | 64 CHECK_GE(rv, 0) << "Quic server fails to start"; |
| 63 JNIEnv* env = base::android::AttachCurrentThread(); | 65 JNIEnv* env = base::android::AttachCurrentThread(); |
| 64 Java_QuicTestServer_onServerStarted(env); | 66 Java_QuicTestServer_onServerStarted(env); |
| 65 } | 67 } |
| 66 | 68 |
| 67 void ShutdownOnServerThread() { | 69 void ShutdownOnServerThread() { |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 | 107 |
| 106 int GetServerPort(JNIEnv* env, const JavaParamRef<jclass>& /*jcaller*/) { | 108 int GetServerPort(JNIEnv* env, const JavaParamRef<jclass>& /*jcaller*/) { |
| 107 return kServerPort; | 109 return kServerPort; |
| 108 } | 110 } |
| 109 | 111 |
| 110 bool RegisterQuicTestServer(JNIEnv* env) { | 112 bool RegisterQuicTestServer(JNIEnv* env) { |
| 111 return RegisterNativesImpl(env); | 113 return RegisterNativesImpl(env); |
| 112 } | 114 } |
| 113 | 115 |
| 114 } // namespace cronet | 116 } // namespace cronet |
| OLD | NEW |