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.
5 #ifndef NET_QUIC_TEST_TOOLS_DELAYED_VERIFY_STRIKE_REGISTER_CLIENT_H_
6 #define NET_QUIC_TEST_TOOLS_DELAYED_VERIFY_STRIKE_REGISTER_CLIENT_H_
11 #include "base/strings/string_piece.h"
12 #include "net/quic/crypto/local_strike_register_client.h"
17 // Test helper that allows delaying execution of nonce verification
18 // callbacks until a later time.
19 class DelayedVerifyStrikeRegisterClient
: public LocalStrikeRegisterClient
{
21 DelayedVerifyStrikeRegisterClient(unsigned max_entries
,
22 uint32 current_time_external
,
25 StrikeRegister::StartupType startup
);
26 ~DelayedVerifyStrikeRegisterClient() override
;
28 void VerifyNonceIsValidAndUnique(base::StringPiece nonce
,
30 ResultCallback
* cb
) override
;
32 // Start queueing verifications instead of executing them immediately.
33 void StartDelayingVerification() {
34 delay_verifications_
= true;
36 // Number of verifications that are queued.
37 int PendingVerifications() const;
38 // Run all pending verifications.
39 void RunPendingVerifications();
43 VerifyArgs(base::StringPiece in_nonce
,
45 ResultCallback
* in_cb
)
46 : nonce(in_nonce
.as_string()),
56 bool delay_verifications_
;
57 std::vector
<VerifyArgs
> pending_verifications_
;
59 DISALLOW_COPY_AND_ASSIGN(DelayedVerifyStrikeRegisterClient
);
65 #endif // NET_QUIC_TEST_TOOLS_DELAYED_VERIFY_STRIKE_REGISTER_CLIENT_H_