| 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 net::QuicConfig config; | 43 net::QuicConfig config; |
| 44 | 44 |
| 45 // Set up server certs. | 45 // Set up server certs. |
| 46 base::FilePath directory; | 46 base::FilePath directory; |
| 47 CHECK(base::android::GetExternalStorageDirectory(&directory)); | 47 CHECK(base::android::GetExternalStorageDirectory(&directory)); |
| 48 directory = directory.Append("net/data/ssl/certificates"); | 48 directory = directory.Append("net/data/ssl/certificates"); |
| 49 // TODO(xunjieli): Use scoped_ptr when crbug.com/545474 is fixed. | 49 // TODO(xunjieli): Use scoped_ptr when crbug.com/545474 is fixed. |
| 50 net::ProofSourceChromium* proof_source = new net::ProofSourceChromium(); | 50 net::ProofSourceChromium* proof_source = new net::ProofSourceChromium(); |
| 51 CHECK(proof_source->Initialize( | 51 CHECK(proof_source->Initialize( |
| 52 directory.Append("quic_test.example.com.crt"), | 52 directory.Append("quic_test.example.com.crt"), |
| 53 directory.Append("quic_test.example.com.key.pkcs8"))); | 53 directory.Append("quic_test.example.com.key.pkcs8"), |
| 54 directory.Append("quic_test.example.com.key.sct"))); |
| 54 g_quic_server = new net::tools::QuicSimpleServer( | 55 g_quic_server = new net::tools::QuicSimpleServer( |
| 55 proof_source, config, net::QuicSupportedVersions()); | 56 proof_source, config, net::QuicSupportedVersions()); |
| 56 | 57 |
| 57 // Start listening. | 58 // Start listening. |
| 58 int rv = g_quic_server->Listen(net::IPEndPoint(ip, kServerPort)); | 59 int rv = g_quic_server->Listen(net::IPEndPoint(ip, kServerPort)); |
| 59 CHECK_GE(rv, 0) << "Quic server fails to start"; | 60 CHECK_GE(rv, 0) << "Quic server fails to start"; |
| 60 JNIEnv* env = base::android::AttachCurrentThread(); | 61 JNIEnv* env = base::android::AttachCurrentThread(); |
| 61 Java_QuicTestServer_onServerStarted(env); | 62 Java_QuicTestServer_onServerStarted(env); |
| 62 } | 63 } |
| 63 | 64 |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 | 103 |
| 103 int GetServerPort(JNIEnv* env, const JavaParamRef<jclass>& /*jcaller*/) { | 104 int GetServerPort(JNIEnv* env, const JavaParamRef<jclass>& /*jcaller*/) { |
| 104 return kServerPort; | 105 return kServerPort; |
| 105 } | 106 } |
| 106 | 107 |
| 107 bool RegisterQuicTestServer(JNIEnv* env) { | 108 bool RegisterQuicTestServer(JNIEnv* env) { |
| 108 return RegisterNativesImpl(env); | 109 return RegisterNativesImpl(env); |
| 109 } | 110 } |
| 110 | 111 |
| 111 } // namespace cronet | 112 } // namespace cronet |
| OLD | NEW |