Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(40)

Side by Side Diff: components/cronet/android/test/quic_test_server.cc

Issue 1411063004: Remove insecure QUIC support (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: enough! Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | net/http/disk_cache_based_quic_server_info_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 23 matching lines...) Expand all
34 DCHECK(!g_quic_server); 34 DCHECK(!g_quic_server);
35 35
36 // Set up in-memory cache. 36 // Set up in-memory cache.
37 base::FilePath file_dir = test_files_root.Append("quic_data"); 37 base::FilePath file_dir = test_files_root.Append("quic_data");
38 CHECK(base::PathExists(file_dir)) << "Quic data does not exist"; 38 CHECK(base::PathExists(file_dir)) << "Quic data does not exist";
39 net::tools::QuicInMemoryCache::GetInstance()->InitializeFromDirectory( 39 net::tools::QuicInMemoryCache::GetInstance()->InitializeFromDirectory(
40 file_dir.value()); 40 file_dir.value());
41 net::IPAddressNumber ip; 41 net::IPAddressNumber ip;
42 net::ParseIPLiteralToNumber(kServerHost, &ip); 42 net::ParseIPLiteralToNumber(kServerHost, &ip);
43 net::QuicConfig config; 43 net::QuicConfig config;
44 g_quic_server =
45 new net::tools::QuicSimpleServer(config, net::QuicSupportedVersions());
46 44
47 // Set up server certs. 45 // Set up server certs.
48 base::FilePath directory; 46 base::FilePath directory;
49 CHECK(base::android::GetExternalStorageDirectory(&directory)); 47 CHECK(base::android::GetExternalStorageDirectory(&directory));
50 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.
51 net::ProofSourceChromium* proof_source = new net::ProofSourceChromium(); 50 net::ProofSourceChromium* proof_source = new net::ProofSourceChromium();
52 CHECK(proof_source->Initialize( 51 CHECK(proof_source->Initialize(
53 directory.Append("quic_test.example.com.crt"), 52 directory.Append("quic_test.example.com.crt"),
54 directory.Append("quic_test.example.com.key.pkcs8"))); 53 directory.Append("quic_test.example.com.key.pkcs8")));
55 // TODO(xunjieli): Use scoped_ptr when crbug.com/545474 is fixed. 54 g_quic_server = new net::tools::QuicSimpleServer(
56 g_quic_server->SetProofSource(proof_source); 55 proof_source, config, net::QuicSupportedVersions());
57 56
58 // Start listening. 57 // Start listening.
59 int rv = g_quic_server->Listen(net::IPEndPoint(ip, kServerPort)); 58 int rv = g_quic_server->Listen(net::IPEndPoint(ip, kServerPort));
60 CHECK_GE(rv, 0) << "Quic server fails to start"; 59 CHECK_GE(rv, 0) << "Quic server fails to start";
61 JNIEnv* env = base::android::AttachCurrentThread(); 60 JNIEnv* env = base::android::AttachCurrentThread();
62 Java_QuicTestServer_onServerStarted(env); 61 Java_QuicTestServer_onServerStarted(env);
63 } 62 }
64 63
65 void ShutdownOnServerThread() { 64 void ShutdownOnServerThread() {
66 DCHECK(g_quic_server_thread->task_runner()->BelongsToCurrentThread()); 65 DCHECK(g_quic_server_thread->task_runner()->BelongsToCurrentThread());
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 102
104 int GetServerPort(JNIEnv* env, const JavaParamRef<jclass>& /*jcaller*/) { 103 int GetServerPort(JNIEnv* env, const JavaParamRef<jclass>& /*jcaller*/) {
105 return kServerPort; 104 return kServerPort;
106 } 105 }
107 106
108 bool RegisterQuicTestServer(JNIEnv* env) { 107 bool RegisterQuicTestServer(JNIEnv* env) {
109 return RegisterNativesImpl(env); 108 return RegisterNativesImpl(env);
110 } 109 }
111 110
112 } // namespace cronet 111 } // namespace cronet
OLDNEW
« no previous file with comments | « no previous file | net/http/disk_cache_based_quic_server_info_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698