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

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

Issue 2561963002: base: Remove the string logging from CHECK(). (Closed)
Patch Set: checkstring: rebase Created 4 years 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
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 net::QuicHttpResponseCache* g_quic_response_cache = nullptr; 34 net::QuicHttpResponseCache* g_quic_response_cache = nullptr;
35 net::QuicSimpleServer* g_quic_server = nullptr; 35 net::QuicSimpleServer* g_quic_server = nullptr;
36 36
37 void StartOnServerThread(const base::FilePath& test_files_root, 37 void StartOnServerThread(const base::FilePath& test_files_root,
38 const base::FilePath& test_data_dir) { 38 const base::FilePath& test_data_dir) {
39 DCHECK(g_quic_server_thread->task_runner()->BelongsToCurrentThread()); 39 DCHECK(g_quic_server_thread->task_runner()->BelongsToCurrentThread());
40 DCHECK(!g_quic_server); 40 DCHECK(!g_quic_server);
41 41
42 // Set up in-memory cache. 42 // Set up in-memory cache.
43 base::FilePath file_dir = test_files_root.Append("quic_data"); 43 base::FilePath file_dir = test_files_root.Append("quic_data");
44 CHECK(base::PathExists(file_dir)) << "Quic data does not exist"; 44 // Quic data does not exist
45 CHECK(base::PathExists(file_dir));
45 g_quic_response_cache = new net::QuicHttpResponseCache(); 46 g_quic_response_cache = new net::QuicHttpResponseCache();
46 g_quic_response_cache->InitializeFromDirectory(file_dir.value()); 47 g_quic_response_cache->InitializeFromDirectory(file_dir.value());
47 net::QuicConfig config; 48 net::QuicConfig config;
48 49
49 // Set up server certs. 50 // Set up server certs.
50 base::FilePath directory = test_data_dir.Append("net/data/ssl/certificates"); 51 base::FilePath directory = test_data_dir.Append("net/data/ssl/certificates");
51 std::unique_ptr<net::ProofSourceChromium> proof_source( 52 std::unique_ptr<net::ProofSourceChromium> proof_source(
52 new net::ProofSourceChromium()); 53 new net::ProofSourceChromium());
53 CHECK(proof_source->Initialize( 54 CHECK(proof_source->Initialize(
54 directory.Append("quic_test.example.com.crt"), 55 directory.Append("quic_test.example.com.crt"),
55 directory.Append("quic_test.example.com.key.pkcs8"), 56 directory.Append("quic_test.example.com.key.pkcs8"),
56 directory.Append("quic_test.example.com.key.sct"))); 57 directory.Append("quic_test.example.com.key.sct")));
57 g_quic_server = new net::QuicSimpleServer( 58 g_quic_server = new net::QuicSimpleServer(
58 std::move(proof_source), config, 59 std::move(proof_source), config,
59 net::QuicCryptoServerConfig::ConfigOptions(), net::AllSupportedVersions(), 60 net::QuicCryptoServerConfig::ConfigOptions(), net::AllSupportedVersions(),
60 g_quic_response_cache); 61 g_quic_response_cache);
61 62
62 // Start listening. 63 // Start listening.
63 int rv = g_quic_server->Listen( 64 int rv = g_quic_server->Listen(
64 net::IPEndPoint(net::IPAddress::IPv4AllZeros(), kServerPort)); 65 net::IPEndPoint(net::IPAddress::IPv4AllZeros(), kServerPort));
65 CHECK_GE(rv, 0) << "Quic server fails to start"; 66 // Quic server fails to start
67 CHECK_GE(rv, 0);
66 JNIEnv* env = base::android::AttachCurrentThread(); 68 JNIEnv* env = base::android::AttachCurrentThread();
67 Java_QuicTestServer_onServerStarted(env); 69 Java_QuicTestServer_onServerStarted(env);
68 } 70 }
69 71
70 void ShutdownOnServerThread() { 72 void ShutdownOnServerThread() {
71 DCHECK(g_quic_server_thread->task_runner()->BelongsToCurrentThread()); 73 DCHECK(g_quic_server_thread->task_runner()->BelongsToCurrentThread());
72 g_quic_server->Shutdown(); 74 g_quic_server->Shutdown();
73 delete g_quic_server; 75 delete g_quic_server;
74 delete g_quic_response_cache; 76 delete g_quic_response_cache;
75 } 77 }
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 111
110 int GetServerPort(JNIEnv* env, const JavaParamRef<jclass>& /*jcaller*/) { 112 int GetServerPort(JNIEnv* env, const JavaParamRef<jclass>& /*jcaller*/) {
111 return kServerPort; 113 return kServerPort;
112 } 114 }
113 115
114 bool RegisterQuicTestServer(JNIEnv* env) { 116 bool RegisterQuicTestServer(JNIEnv* env) {
115 return RegisterNativesImpl(env); 117 return RegisterNativesImpl(env);
116 } 118 }
117 119
118 } // namespace cronet 120 } // namespace cronet
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698