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

Unified Diff: net/quic/crypto/crypto_server_test.cc

Issue 159143007: Log QUIC public reset client address mismatch to a histogram. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Undo experimental changes Created 6 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
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) {

Powered by Google App Engine
This is Rietveld 408576698