Index: net/quic/core/crypto/crypto_server_test.cc |
diff --git a/net/quic/core/crypto/crypto_server_test.cc b/net/quic/core/crypto/crypto_server_test.cc |
index 43fad918f1d32e0542988c118cc5f99a26ee9f68..39305c1147f6b8c9f3a551b578cd7f61f291900e 100644 |
--- a/net/quic/core/crypto/crypto_server_test.cc |
+++ b/net/quic/core/crypto/crypto_server_test.cc |
@@ -271,33 +271,67 @@ class CryptoServerTest : public ::testing::TestWithParam<TestParams> { |
new ValidateCallback(this, false, error_substr, called))); |
} |
+ class ProcessCallback : public ProcessClientHelloResultCallback { |
+ public: |
+ ProcessCallback(scoped_refptr<ValidateCallback::Result> result, |
+ bool should_succeed, |
+ const char* error_substr, |
+ bool* called, |
+ CryptoHandshakeMessage* out) |
+ : result_(std::move(result)), |
+ should_succeed_(should_succeed), |
+ error_substr_(error_substr), |
+ called_(called), |
+ out_(out) { |
+ *called_ = false; |
+ } |
+ |
+ void Run( |
+ QuicErrorCode error, |
+ const string& error_details, |
+ std::unique_ptr<CryptoHandshakeMessage> message, |
+ std::unique_ptr<DiversificationNonce> diversification_nonce) override { |
+ if (should_succeed_) { |
+ ASSERT_EQ(error, QUIC_NO_ERROR) << "Message failed with error " |
+ << error_details << ": " |
+ << result_->client_hello.DebugString(); |
+ } else { |
+ ASSERT_NE(error, QUIC_NO_ERROR) << "Message didn't fail: " |
+ << result_->client_hello.DebugString(); |
+ |
+ EXPECT_TRUE(error_details.find(error_substr_) != string::npos) |
+ << error_substr_ << " not in " << error_details; |
+ } |
+ if (message != nullptr) { |
+ *out_ = *message; |
+ } |
+ *called_ = true; |
+ } |
+ |
+ private: |
+ const scoped_refptr<ValidateCallback::Result> result_; |
+ const bool should_succeed_; |
+ const char* const error_substr_; |
+ bool* called_; |
+ CryptoHandshakeMessage* out_; |
+ }; |
+ |
void ProcessValidationResult(scoped_refptr<ValidateCallback::Result> result, |
bool should_succeed, |
const char* error_substr) { |
IPAddress server_ip; |
- DiversificationNonce diversification_nonce; |
- string error_details; |
QuicConnectionId server_designated_connection_id = |
rand_for_id_generation_.RandUint64(); |
- QuicErrorCode error = config_.ProcessClientHello( |
+ bool called; |
+ config_.ProcessClientHello( |
result, /*reject_only=*/false, /*connection_id=*/1, server_ip, |
client_address_, supported_versions_.front(), supported_versions_, |
use_stateless_rejects_, server_designated_connection_id, &clock_, rand_, |
&compressed_certs_cache_, ¶ms_, &crypto_proof_, |
- /*total_framing_overhead=*/50, chlo_packet_size_, &out_, |
- &diversification_nonce, &error_details); |
- |
- if (should_succeed) { |
- ASSERT_EQ(error, QUIC_NO_ERROR) << "Message failed with error " |
- << error_details << ": " |
- << result->client_hello.DebugString(); |
- } else { |
- ASSERT_NE(error, QUIC_NO_ERROR) << "Message didn't fail: " |
- << result->client_hello.DebugString(); |
- |
- EXPECT_TRUE(error_details.find(error_substr) != string::npos) |
- << error_substr << " not in " << error_details; |
- } |
+ /*total_framing_overhead=*/50, chlo_packet_size_, |
+ std::unique_ptr<ProcessCallback>(new ProcessCallback( |
+ result, should_succeed, error_substr, &called, &out_))); |
+ EXPECT_TRUE(called); |
} |
string GenerateNonce() { |