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

Unified Diff: net/quic/quic_session_test.cc

Issue 15074007: Land Recent QUIC changes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix for windows Created 7 years, 7 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/quic_session.cc ('k') | net/quic/quic_spdy_compressor.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/quic/quic_session_test.cc
diff --git a/net/quic/quic_session_test.cc b/net/quic/quic_session_test.cc
index 02b9853a3a8d8fe4b0ab4875a4cf57d6218852ab..338caed5f1b9cd63658fa1fde23d8e269ca1f504 100644
--- a/net/quic/quic_session_test.cc
+++ b/net/quic/quic_session_test.cc
@@ -3,12 +3,14 @@
// found in the LICENSE file.
#include "net/quic/quic_session.h"
-#include "net/quic/quic_connection.h"
#include <set>
#include "base/hash_tables.h"
#include "net/quic/crypto/crypto_handshake.h"
+#include "net/quic/quic_connection.h"
+#include "net/quic/quic_protocol.h"
+#include "net/quic/test_tools/quic_connection_peer.h"
#include "net/quic/test_tools/quic_test_utils.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -32,6 +34,12 @@ class TestCryptoStream : public QuicCryptoStream {
const CryptoHandshakeMessage& message) OVERRIDE {
encryption_established_ = true;
handshake_confirmed_ = true;
+ CryptoHandshakeMessage msg;
+ string error_details;
+ session()->config()->ToHandshakeMessage(&msg);
+ const QuicErrorCode error = session()->config()->ProcessClientHello(
+ msg, &error_details);
+ EXPECT_EQ(QUIC_NO_ERROR, error);
session()->OnCryptoHandshakeEvent(QuicSession::HANDSHAKE_CONFIRMED);
}
};
@@ -52,8 +60,9 @@ class TestStream : public ReliableQuicStream {
class TestSession : public QuicSession {
public:
TestSession(QuicConnection* connection, bool is_server)
- : QuicSession(connection, is_server),
+ : QuicSession(connection, QuicConfig(), is_server),
crypto_stream_(this) {
+ config()->SetDefaults();
}
virtual QuicCryptoStream* GetCryptoStream() OVERRIDE {
@@ -84,6 +93,7 @@ class TestSession : public QuicSession {
}
TestCryptoStream crypto_stream_;
+ QuicConfig config_;
};
class QuicSessionTest : public ::testing::Test {
@@ -166,6 +176,16 @@ TEST_F(QuicSessionTest, StreamIdTooLarge) {
session_.GetIncomingReliableStream(105);
}
+TEST_F(QuicSessionTest, DecompressionError) {
+ ReliableQuicStream* stream = session_.GetIncomingReliableStream(3);
+ EXPECT_CALL(*connection_, SendConnectionClose(QUIC_DECOMPRESSION_FAILURE));
+ const char data[] =
+ "\1\0\0\0" // headers id
+ "\0\0\0\4" // length
+ "abcd"; // invalid compressed data
+ stream->ProcessRawData(data, arraysize(data));
+}
+
TEST_F(QuicSessionTest, OnCanWrite) {
TestStream* stream2 = session_.CreateOutgoingReliableStream();
TestStream* stream4 = session_.CreateOutgoingReliableStream();
@@ -213,6 +233,15 @@ TEST_F(QuicSessionTest, SendGoAway) {
EXPECT_FALSE(session_.GetIncomingReliableStream(3u));
}
+TEST_F(QuicSessionTest, IncreasedTimeoutAfterCryptoHandshake) {
+ EXPECT_EQ(kDefaultInitialTimeoutSecs,
+ QuicConnectionPeer::GetTimeout(connection_).ToSeconds());
+ CryptoHandshakeMessage msg;
+ session_.crypto_stream_.OnHandshakeMessage(msg);
+ EXPECT_EQ(kDefaultTimeoutSecs,
+ QuicConnectionPeer::GetTimeout(connection_).ToSeconds());
+}
+
} // namespace
} // namespace test
} // namespace net
« no previous file with comments | « net/quic/quic_session.cc ('k') | net/quic/quic_spdy_compressor.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698