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

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

Issue 2740453006: Add QuicStringPiece which is actually StringPiece. (Closed)
Patch Set: fix compile error and rebase Created 3 years, 9 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
« no previous file with comments | « net/quic/test_tools/failing_proof_source.cc ('k') | net/quic/test_tools/fake_proof_source.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 (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 #ifndef NET_QUIC_TEST_TOOLS_FAKE_PROOF_SOURCE_H_ 5 #ifndef NET_QUIC_TEST_TOOLS_FAKE_PROOF_SOURCE_H_
6 #define NET_QUIC_TEST_TOOLS_FAKE_PROOF_SOURCE_H_ 6 #define NET_QUIC_TEST_TOOLS_FAKE_PROOF_SOURCE_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
11 11
12 #include "net/quic/core/crypto/proof_source.h" 12 #include "net/quic/core/crypto/proof_source.h"
13 #include "net/quic/platform/api/quic_string_piece.h"
13 14
14 namespace net { 15 namespace net {
15 namespace test { 16 namespace test {
16 17
17 // Implementation of ProofSource which delegates to a ProofSourceForTesting, 18 // Implementation of ProofSource which delegates to a ProofSourceForTesting,
18 // except that when the async GetProof is called, it captures the call and 19 // except that when the async GetProof is called, it captures the call and
19 // allows tests to see that a call is pending, which they can then cause to 20 // allows tests to see that a call is pending, which they can then cause to
20 // complete at a time of their choosing. 21 // complete at a time of their choosing.
21 class FakeProofSource : public ProofSource { 22 class FakeProofSource : public ProofSource {
22 public: 23 public:
23 FakeProofSource(); 24 FakeProofSource();
24 ~FakeProofSource() override; 25 ~FakeProofSource() override;
25 26
26 // Before this object is "active", all calls to GetProof will be delegated 27 // Before this object is "active", all calls to GetProof will be delegated
27 // immediately. Once "active", the async ones will be intercepted. This 28 // immediately. Once "active", the async ones will be intercepted. This
28 // distinction is necessary to ensure that GetProof can be called without 29 // distinction is necessary to ensure that GetProof can be called without
29 // interference during test case setup. 30 // interference during test case setup.
30 void Activate(); 31 void Activate();
31 32
32 // ProofSource interface 33 // ProofSource interface
33 void GetProof(const QuicSocketAddress& server_address, 34 void GetProof(const QuicSocketAddress& server_address,
34 const std::string& hostname, 35 const std::string& hostname,
35 const std::string& server_config, 36 const std::string& server_config,
36 QuicVersion quic_version, 37 QuicVersion quic_version,
37 base::StringPiece chlo_hash, 38 QuicStringPiece chlo_hash,
38 const QuicTagVector& connection_options, 39 const QuicTagVector& connection_options,
39 std::unique_ptr<ProofSource::Callback> callback) override; 40 std::unique_ptr<ProofSource::Callback> callback) override;
40 41
41 // Get the number of callbacks which are pending 42 // Get the number of callbacks which are pending
42 int NumPendingCallbacks() const; 43 int NumPendingCallbacks() const;
43 44
44 // Invoke a pending callback. The index refers to the position in params_ of 45 // Invoke a pending callback. The index refers to the position in params_ of
45 // the callback to be completed. 46 // the callback to be completed.
46 void InvokePendingCallback(int n); 47 void InvokePendingCallback(int n);
47 48
(...skipping 22 matching lines...) Expand all
70 std::unique_ptr<ProofSource::Callback> callback; 71 std::unique_ptr<ProofSource::Callback> callback;
71 }; 72 };
72 73
73 std::vector<Params> params_; 74 std::vector<Params> params_;
74 }; 75 };
75 76
76 } // namespace test 77 } // namespace test
77 } // namespace net 78 } // namespace net
78 79
79 #endif // NET_QUIC_TEST_TOOLS_FAKE_PROOF_SOURCE_H_ 80 #endif // NET_QUIC_TEST_TOOLS_FAKE_PROOF_SOURCE_H_
OLDNEW
« no previous file with comments | « net/quic/test_tools/failing_proof_source.cc ('k') | net/quic/test_tools/fake_proof_source.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698