Index: net/quic/crypto/local_strike_register_client_test.cc |
diff --git a/net/quic/crypto/local_strike_register_client_test.cc b/net/quic/crypto/local_strike_register_client_test.cc |
index 322a106c375c48d82fd2f59ae402fcace32a9a9b..1a3b6f9ca5e590627d5849670077e574e3f02583 100644 |
--- a/net/quic/crypto/local_strike_register_client_test.cc |
+++ b/net/quic/crypto/local_strike_register_client_test.cc |
@@ -25,21 +25,27 @@ class RecordResultCallback : public StrikeRegisterClient::ResultCallback { |
// RecordResultCallback stores the argument to RunImpl in |
// |*saved_value| and sets |*called| to true. The callback is self |
// deleting. |
- RecordResultCallback(bool* called, bool* saved_value) |
+ RecordResultCallback(bool* called, |
+ bool* saved_value, |
+ InsertStatus* saved_nonce_error) |
: called_(called), |
- saved_value_(saved_value) { |
+ saved_value_(saved_value), |
+ saved_nonce_error_(saved_nonce_error) { |
*called_ = false; |
} |
protected: |
- virtual void RunImpl(bool nonce_is_valid_and_unique) OVERRIDE { |
+ virtual void RunImpl(bool nonce_is_valid_and_unique, |
+ InsertStatus nonce_error) OVERRIDE { |
*called_ = true; |
*saved_value_ = nonce_is_valid_and_unique; |
+ *saved_nonce_error_ = nonce_error; |
} |
private: |
bool* called_; |
bool* saved_value_; |
+ InsertStatus* saved_nonce_error_; |
DISALLOW_COPY_AND_ASSIGN(RecordResultCallback); |
}; |
@@ -85,39 +91,45 @@ TEST_F(LocalStrikeRegisterClientTest, IncorrectNonceLength) { |
// Validation fails if you remove a byte from the nonce. |
bool called = false; |
bool is_valid = false; |
+ InsertStatus nonce_error = NONCE_UNKNOWN_FAILURE; |
string short_nonce = valid_nonce.substr(0, valid_nonce.length() - 1); |
strike_register_->VerifyNonceIsValidAndUnique( |
short_nonce, |
QuicWallTime::FromUNIXSeconds(kCurrentTimeExternalSecs), |
- new RecordResultCallback(&called, &is_valid)); |
+ new RecordResultCallback(&called, &is_valid, &nonce_error)); |
EXPECT_TRUE(called); |
EXPECT_FALSE(is_valid); |
+ EXPECT_EQ(NONCE_INVALID_FAILURE, nonce_error); |
} |
{ |
// Validation fails if you add a byte to the nonce. |
bool called = false; |
bool is_valid = false; |
+ InsertStatus nonce_error = NONCE_UNKNOWN_FAILURE; |
string long_nonce(valid_nonce); |
long_nonce.append("a"); |
strike_register_->VerifyNonceIsValidAndUnique( |
long_nonce, |
QuicWallTime::FromUNIXSeconds(kCurrentTimeExternalSecs), |
- new RecordResultCallback(&called, &is_valid)); |
+ new RecordResultCallback(&called, &is_valid, &nonce_error)); |
EXPECT_TRUE(called); |
EXPECT_FALSE(is_valid); |
+ EXPECT_EQ(NONCE_INVALID_FAILURE, nonce_error); |
} |
{ |
// Verify that the base nonce validates was valid. |
bool called = false; |
bool is_valid = false; |
+ InsertStatus nonce_error = NONCE_UNKNOWN_FAILURE; |
strike_register_->VerifyNonceIsValidAndUnique( |
valid_nonce, |
QuicWallTime::FromUNIXSeconds(kCurrentTimeExternalSecs), |
- new RecordResultCallback(&called, &is_valid)); |
+ new RecordResultCallback(&called, &is_valid, &nonce_error)); |
EXPECT_TRUE(called); |
EXPECT_TRUE(is_valid); |
+ EXPECT_EQ(NONCE_OK, nonce_error); |
} |
} |