Index: net/quic/crypto/crypto_server_test.cc |
=================================================================== |
--- net/quic/crypto/crypto_server_test.cc (revision 250874) |
+++ net/quic/crypto/crypto_server_test.cc (working copy) |
@@ -8,6 +8,7 @@ |
#include "net/quic/crypto/crypto_utils.h" |
#include "net/quic/crypto/quic_crypto_server_config.h" |
#include "net/quic/crypto/quic_random.h" |
+#include "net/quic/quic_socket_address_coder.h" |
#include "net/quic/quic_utils.h" |
#include "net/quic/test_tools/crypto_test_utils.h" |
#include "net/quic/test_tools/delayed_verify_strike_register_client.h" |
@@ -127,6 +128,23 @@ |
bool* called_; |
}; |
+ void CheckServerHello(const CryptoHandshakeMessage& server_hello) { |
+ const QuicTag* versions; |
+ size_t num_versions; |
+ server_hello.GetTaglist(kVER, &versions, &num_versions); |
+ ASSERT_EQ(QuicSupportedVersions().size(), num_versions); |
+ for (size_t i = 0; i < num_versions; ++i) { |
+ EXPECT_EQ(QuicVersionToQuicTag(QuicSupportedVersions()[i]), versions[i]); |
+ } |
+ |
+ StringPiece address; |
+ ASSERT_TRUE(server_hello.GetStringPiece(kCADR, &address)); |
+ QuicSocketAddressCoder decoder; |
+ ASSERT_TRUE(decoder.Decode(address.data(), address.size())); |
+ EXPECT_EQ(client_address_.address(), decoder.ip()); |
+ EXPECT_EQ(client_address_.port(), decoder.port()); |
+ } |
+ |
void ShouldSucceed(const CryptoHandshakeMessage& message) { |
bool called = false; |
RunValidate(message, new ValidateCallback(this, true, "", &called)); |
@@ -333,17 +351,12 @@ |
ShouldSucceed(msg); |
// The message should be accepted now. |
ASSERT_EQ(kSHLO, out_.tag()); |
+ CheckServerHello(out_); |
ShouldSucceed(msg); |
// The message should accepted twice when replay protection is off. |
ASSERT_EQ(kSHLO, out_.tag()); |
- const QuicTag* versions; |
- size_t num_versions; |
- out_.GetTaglist(kVER, &versions, &num_versions); |
- ASSERT_EQ(QuicSupportedVersions().size(), num_versions); |
- for (size_t i = 0; i < num_versions; ++i) { |
- EXPECT_EQ(QuicVersionToQuicTag(QuicSupportedVersions()[i]), versions[i]); |
- } |
wtc
2014/02/13 02:04:10
It seems that this piece of code (lines 340-346) i
|
+ CheckServerHello(out_); |
} |
TEST(CryptoServerConfigGenerationTest, Determinism) { |