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 #include "net/quic/test_tools/delayed_verify_strike_register_client.h"
7 using base::StringPiece
;
14 DelayedVerifyStrikeRegisterClient::DelayedVerifyStrikeRegisterClient(
16 uint32 current_time_external
,
19 StrikeRegister::StartupType startup
)
20 : LocalStrikeRegisterClient(max_entries
, current_time_external
,
21 window_secs
, orbit
, startup
),
22 delay_verifications_(false) {
25 DelayedVerifyStrikeRegisterClient::~DelayedVerifyStrikeRegisterClient() {}
27 void DelayedVerifyStrikeRegisterClient::VerifyNonceIsValidAndUnique(
31 if (delay_verifications_
) {
32 pending_verifications_
.push_back(VerifyArgs(nonce
, now
, cb
));
34 LocalStrikeRegisterClient::VerifyNonceIsValidAndUnique(nonce
, now
, cb
);
38 int DelayedVerifyStrikeRegisterClient::PendingVerifications() const {
39 return pending_verifications_
.size();
42 void DelayedVerifyStrikeRegisterClient::RunPendingVerifications() {
43 vector
<VerifyArgs
> pending
;
44 pending_verifications_
.swap(pending
);
45 for (vector
<VerifyArgs
>::const_iterator it
= pending
.begin(),
46 end
= pending
.end(); it
!= end
; ++it
) {
47 LocalStrikeRegisterClient::VerifyNonceIsValidAndUnique(
48 it
->nonce
, it
->now
, it
->cb
);