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

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

Issue 992733002: Remove //net (except for Android test stuff) and sdch (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 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
OLDNEW
(Empty)
1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef NET_QUIC_TEST_TOOLS_DELAYED_VERIFY_STRIKE_REGISTER_CLIENT_H_
6 #define NET_QUIC_TEST_TOOLS_DELAYED_VERIFY_STRIKE_REGISTER_CLIENT_H_
7
8 #include <string>
9 #include <vector>
10
11 #include "base/strings/string_piece.h"
12 #include "net/quic/crypto/local_strike_register_client.h"
13
14 namespace net {
15 namespace test {
16
17 // Test helper that allows delaying execution of nonce verification
18 // callbacks until a later time.
19 class DelayedVerifyStrikeRegisterClient : public LocalStrikeRegisterClient {
20 public:
21 DelayedVerifyStrikeRegisterClient(unsigned max_entries,
22 uint32 current_time_external,
23 uint32 window_secs,
24 const uint8 orbit[8],
25 StrikeRegister::StartupType startup);
26 ~DelayedVerifyStrikeRegisterClient() override;
27
28 void VerifyNonceIsValidAndUnique(base::StringPiece nonce,
29 QuicWallTime now,
30 ResultCallback* cb) override;
31
32 // Start queueing verifications instead of executing them immediately.
33 void StartDelayingVerification() {
34 delay_verifications_ = true;
35 }
36 // Number of verifications that are queued.
37 int PendingVerifications() const;
38 // Run all pending verifications.
39 void RunPendingVerifications();
40
41 private:
42 struct VerifyArgs {
43 VerifyArgs(base::StringPiece in_nonce,
44 QuicWallTime in_now,
45 ResultCallback* in_cb)
46 : nonce(in_nonce.as_string()),
47 now(in_now),
48 cb(in_cb) {
49 }
50
51 std::string nonce;
52 QuicWallTime now;
53 ResultCallback* cb;
54 };
55
56 bool delay_verifications_;
57 std::vector<VerifyArgs> pending_verifications_;
58
59 DISALLOW_COPY_AND_ASSIGN(DelayedVerifyStrikeRegisterClient);
60 };
61
62 } // namespace test
63 } // namespace net
64
65 #endif // NET_QUIC_TEST_TOOLS_DELAYED_VERIFY_STRIKE_REGISTER_CLIENT_H_
OLDNEW
« no previous file with comments | « net/quic/test_tools/crypto_test_utils_openssl.cc ('k') | net/quic/test_tools/delayed_verify_strike_register_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698