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

Unified Diff: net/quic/core/quic_crypto_client_stream_test.cc

Issue 2681793002: Landing Recent QUIC changes until 5:30 PM, Feb 3, 2017 UTC-5 (Closed)
Patch Set: sync and rebase Created 3 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/quic/core/quic_crypto_client_stream.h ('k') | net/quic/core/quic_crypto_server_stream.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/quic/core/quic_crypto_client_stream_test.cc
diff --git a/net/quic/core/quic_crypto_client_stream_test.cc b/net/quic/core/quic_crypto_client_stream_test.cc
index bbc2f37217a334cc2729a7b40c80a852b4153101..571ca249c749359ba0a58a2c8e2ce2b22cedcc81 100644
--- a/net/quic/core/quic_crypto_client_stream_test.cc
+++ b/net/quic/core/quic_crypto_client_stream_test.cc
@@ -36,7 +36,7 @@ class QuicCryptoClientStreamTest : public ::testing::Test {
public:
QuicCryptoClientStreamTest()
: server_id_(kServerHostname, kServerPort, PRIVACY_MODE_DISABLED),
- crypto_config_(CryptoTestUtils::ProofVerifierForTesting()) {
+ crypto_config_(crypto_test_utils::ProofVerifierForTesting()) {
CreateConnection();
}
@@ -53,9 +53,9 @@ class QuicCryptoClientStreamTest : public ::testing::Test {
void CompleteCryptoHandshake() {
stream()->CryptoConnect();
QuicConfig config;
- CryptoTestUtils::HandshakeWithFakeServer(&config, &server_helper_,
- &alarm_factory_, connection_,
- stream(), server_options_);
+ crypto_test_utils::HandshakeWithFakeServer(&config, &server_helper_,
+ &alarm_factory_, connection_,
+ stream(), server_options_);
}
void ConstructHandshakeMessage() {
@@ -74,7 +74,7 @@ class QuicCryptoClientStreamTest : public ::testing::Test {
CryptoHandshakeMessage message_;
std::unique_ptr<QuicData> message_data_;
QuicCryptoClientConfig crypto_config_;
- CryptoTestUtils::FakeServerOptions server_options_;
+ crypto_test_utils::FakeServerOptions server_options_;
};
TEST_F(QuicCryptoClientStreamTest, NotInitiallyConected) {
@@ -244,20 +244,40 @@ TEST_F(QuicCryptoClientStreamTest, ServerConfigUpdateWithCert) {
// Build a server config update message with certificates
QuicCryptoServerConfig crypto_config(
QuicCryptoServerConfig::TESTING, QuicRandom::GetInstance(),
- CryptoTestUtils::ProofSourceForTesting());
- CryptoTestUtils::FakeServerOptions options;
- CryptoTestUtils::SetupCryptoServerConfigForTest(
+ crypto_test_utils::ProofSourceForTesting());
+ crypto_test_utils::FakeServerOptions options;
+ crypto_test_utils::SetupCryptoServerConfigForTest(
connection_->clock(), QuicRandom::GetInstance(), &crypto_config, options);
SourceAddressTokens tokens;
QuicCompressedCertsCache cache(1);
CachedNetworkParameters network_params;
CryptoHandshakeMessage server_config_update;
- EXPECT_TRUE(crypto_config.BuildServerConfigUpdateMessage(
+
+ class Callback : public BuildServerConfigUpdateMessageResultCallback {
+ public:
+ Callback(bool* ok, CryptoHandshakeMessage* message)
+ : ok_(ok), message_(message) {}
+ void Run(bool ok, const CryptoHandshakeMessage& message) override {
+ *ok_ = ok;
+ *message_ = message;
+ }
+
+ private:
+ bool* ok_;
+ CryptoHandshakeMessage* message_;
+ };
+
+ // Note: relies on the callback being invoked synchronously
+ bool ok = false;
+ crypto_config.BuildServerConfigUpdateMessage(
session_->connection()->version(), stream()->chlo_hash(), tokens,
QuicSocketAddress(QuicIpAddress::Loopback6(), 1234),
QuicIpAddress::Loopback6(), connection_->clock(),
QuicRandom::GetInstance(), &cache, stream()->crypto_negotiated_params(),
- &network_params, QuicTagVector(), &server_config_update));
+ &network_params, QuicTagVector(),
+ std::unique_ptr<BuildServerConfigUpdateMessageResultCallback>(
+ new Callback(&ok, &server_config_update)));
+ EXPECT_TRUE(ok);
std::unique_ptr<QuicData> data(
CryptoFramer::ConstructHandshakeMessage(server_config_update));
@@ -334,10 +354,10 @@ TEST_F(QuicCryptoClientStreamTest, NoTokenBindingInPrivacyMode) {
class QuicCryptoClientStreamStatelessTest : public ::testing::Test {
public:
QuicCryptoClientStreamStatelessTest()
- : client_crypto_config_(CryptoTestUtils::ProofVerifierForTesting()),
+ : client_crypto_config_(crypto_test_utils::ProofVerifierForTesting()),
server_crypto_config_(QuicCryptoServerConfig::TESTING,
QuicRandom::GetInstance(),
- CryptoTestUtils::ProofSourceForTesting()),
+ crypto_test_utils::ProofSourceForTesting()),
server_compressed_certs_cache_(
QuicCompressedCertsCache::kQuicCompressedCertsCacheSize),
server_id_(kServerHostname, kServerPort, PRIVACY_MODE_DISABLED) {
@@ -358,9 +378,9 @@ class QuicCryptoClientStreamStatelessTest : public ::testing::Test {
void AdvanceHandshakeWithFakeServer() {
client_session_->GetCryptoStream()->CryptoConnect();
- CryptoTestUtils::AdvanceHandshake(client_connection_,
- client_session_->GetCryptoStream(), 0,
- server_connection_, server_stream(), 0);
+ crypto_test_utils::AdvanceHandshake(client_connection_,
+ client_session_->GetCryptoStream(), 0,
+ server_connection_, server_stream(), 0);
}
// Initializes the server_stream_ for stateless rejects.
@@ -373,8 +393,8 @@ class QuicCryptoClientStreamStatelessTest : public ::testing::Test {
&server_connection_, &server_session);
CHECK(server_session);
server_session_.reset(server_session);
- CryptoTestUtils::FakeServerOptions options;
- CryptoTestUtils::SetupCryptoServerConfigForTest(
+ crypto_test_utils::FakeServerOptions options;
+ crypto_test_utils::SetupCryptoServerConfigForTest(
server_connection_->clock(), server_connection_->random_generator(),
&server_crypto_config_, options);
FLAGS_quic_reloadable_flag_enable_quic_stateless_reject_support = true;
« no previous file with comments | « net/quic/core/quic_crypto_client_stream.h ('k') | net/quic/core/quic_crypto_server_stream.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698