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

Side by Side Diff: net/quic/test_tools/fake_proof_source.cc

Issue 2611613003: Add quic_logging (Closed)
Patch Set: fix failed test? Created 3 years, 11 months 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 (c) 2016 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2016 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 "net/quic/platform/api/quic_logging.h"
5 #include "net/quic/test_tools/fake_proof_source.h" 6 #include "net/quic/test_tools/fake_proof_source.h"
6 #include "net/quic/test_tools/crypto_test_utils.h" 7 #include "net/quic/test_tools/crypto_test_utils.h"
7 8
8 using std::string; 9 using std::string;
9 10
10 namespace net { 11 namespace net {
11 namespace test { 12 namespace test {
12 13
13 FakeProofSource::FakeProofSource() 14 FakeProofSource::FakeProofSource()
14 : delegate_(CryptoTestUtils::ProofSourceForTesting()) {} 15 : delegate_(CryptoTestUtils::ProofSourceForTesting()) {}
(...skipping 28 matching lines...) Expand all
43 44
44 bool FakeProofSource::GetProof( 45 bool FakeProofSource::GetProof(
45 const QuicSocketAddress& server_address, 46 const QuicSocketAddress& server_address,
46 const string& hostname, 47 const string& hostname,
47 const string& server_config, 48 const string& server_config,
48 QuicVersion quic_version, 49 QuicVersion quic_version,
49 StringPiece chlo_hash, 50 StringPiece chlo_hash,
50 const QuicTagVector& connection_options, 51 const QuicTagVector& connection_options,
51 QuicReferenceCountedPointer<ProofSource::Chain>* out_chain, 52 QuicReferenceCountedPointer<ProofSource::Chain>* out_chain,
52 QuicCryptoProof* out_proof) { 53 QuicCryptoProof* out_proof) {
53 LOG(WARNING) << "Synchronous GetProof called"; 54 QUIC_LOG(WARNING) << "Synchronous GetProof called";
54 return delegate_->GetProof(server_address, hostname, server_config, 55 return delegate_->GetProof(server_address, hostname, server_config,
55 quic_version, chlo_hash, connection_options, 56 quic_version, chlo_hash, connection_options,
56 out_chain, out_proof); 57 out_chain, out_proof);
57 } 58 }
58 59
59 void FakeProofSource::GetProof( 60 void FakeProofSource::GetProof(
60 const QuicSocketAddress& server_address, 61 const QuicSocketAddress& server_address,
61 const string& hostname, 62 const string& hostname,
62 const string& server_config, 63 const string& server_config,
63 QuicVersion quic_version, 64 QuicVersion quic_version,
64 StringPiece chlo_hash, 65 StringPiece chlo_hash,
65 const QuicTagVector& connection_options, 66 const QuicTagVector& connection_options,
66 std::unique_ptr<ProofSource::Callback> callback) { 67 std::unique_ptr<ProofSource::Callback> callback) {
67 if (!active_) { 68 if (!active_) {
68 QuicReferenceCountedPointer<Chain> chain; 69 QuicReferenceCountedPointer<Chain> chain;
69 QuicCryptoProof proof; 70 QuicCryptoProof proof;
70 const bool ok = 71 const bool ok =
71 GetProof(server_address, hostname, server_config, quic_version, 72 GetProof(server_address, hostname, server_config, quic_version,
72 chlo_hash, connection_options, &chain, &proof); 73 chlo_hash, connection_options, &chain, &proof);
73 callback->Run(ok, chain, proof, /* details = */ nullptr); 74 callback->Run(ok, chain, proof, /* details = */ nullptr);
74 return; 75 return;
75 } 76 }
76 77
77 LOG(WARNING) << "Asynchronous GetProof called"; 78 QUIC_LOG(WARNING) << "Asynchronous GetProof called";
78 params_.push_back(Params{server_address, hostname, server_config, 79 params_.push_back(Params{server_address, hostname, server_config,
79 quic_version, chlo_hash.as_string(), 80 quic_version, chlo_hash.as_string(),
80 connection_options, std::move(callback)}); 81 connection_options, std::move(callback)});
81 } 82 }
82 83
83 int FakeProofSource::NumPendingCallbacks() const { 84 int FakeProofSource::NumPendingCallbacks() const {
84 return params_.size(); 85 return params_.size();
85 } 86 }
86 87
87 void FakeProofSource::InvokePendingCallback(int n) { 88 void FakeProofSource::InvokePendingCallback(int n) {
88 CHECK(NumPendingCallbacks() > n); 89 CHECK(NumPendingCallbacks() > n);
89 90
90 const Params& params = params_[n]; 91 const Params& params = params_[n];
91 92
92 QuicReferenceCountedPointer<ProofSource::Chain> chain; 93 QuicReferenceCountedPointer<ProofSource::Chain> chain;
93 QuicCryptoProof proof; 94 QuicCryptoProof proof;
94 const bool ok = delegate_->GetProof( 95 const bool ok = delegate_->GetProof(
95 params.server_address, params.hostname, params.server_config, 96 params.server_address, params.hostname, params.server_config,
96 params.quic_version, params.chlo_hash, params.connection_options, &chain, 97 params.quic_version, params.chlo_hash, params.connection_options, &chain,
97 &proof); 98 &proof);
98 99
99 params.callback->Run(ok, chain, proof, /* details = */ nullptr); 100 params.callback->Run(ok, chain, proof, /* details = */ nullptr);
100 auto it = params_.begin() + n; 101 auto it = params_.begin() + n;
101 params_.erase(it); 102 params_.erase(it);
102 } 103 }
103 104
104 } // namespace test 105 } // namespace test
105 } // namespace net 106 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/test_tools/crypto_test_utils.cc ('k') | net/quic/test_tools/quic_stream_sequencer_buffer_peer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698