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

Side by Side Diff: net/quic/quic_session_test.cc

Issue 14718011: Land Recent QUIC Changes (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « net/quic/quic_session.cc ('k') | net/quic/quic_stream_factory_test.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/quic/quic_session.h" 5 #include "net/quic/quic_session.h"
6 #include "net/quic/quic_connection.h" 6 #include "net/quic/quic_connection.h"
7 7
8 #include <set> 8 #include <set>
9 9
10 #include "base/hash_tables.h" 10 #include "base/hash_tables.h"
(...skipping 12 matching lines...) Expand all
23 namespace { 23 namespace {
24 24
25 class TestCryptoStream : public QuicCryptoStream { 25 class TestCryptoStream : public QuicCryptoStream {
26 public: 26 public:
27 explicit TestCryptoStream(QuicSession* session) 27 explicit TestCryptoStream(QuicSession* session)
28 : QuicCryptoStream(session) { 28 : QuicCryptoStream(session) {
29 } 29 }
30 30
31 virtual void OnHandshakeMessage( 31 virtual void OnHandshakeMessage(
32 const CryptoHandshakeMessage& message) OVERRIDE { 32 const CryptoHandshakeMessage& message) OVERRIDE {
33 SetHandshakeComplete(QUIC_NO_ERROR); 33 encryption_established_ = true;
34 handshake_confirmed_ = true;
35 session()->OnCryptoHandshakeEvent(QuicSession::HANDSHAKE_CONFIRMED);
34 } 36 }
35 }; 37 };
36 38
37 class TestStream : public ReliableQuicStream { 39 class TestStream : public ReliableQuicStream {
38 public: 40 public:
39 TestStream(QuicStreamId id, QuicSession* session) 41 TestStream(QuicStreamId id, QuicSession* session)
40 : ReliableQuicStream(id, session) { 42 : ReliableQuicStream(id, session) {
41 } 43 }
42 44
43 virtual uint32 ProcessData(const char* data, uint32 data_len) { 45 virtual uint32 ProcessData(const char* data, uint32 data_len) {
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 } 110 }
109 111
110 QuicGuid guid_; 112 QuicGuid guid_;
111 MockConnection* connection_; 113 MockConnection* connection_;
112 TestSession session_; 114 TestSession session_;
113 QuicConnectionVisitorInterface* visitor_; 115 QuicConnectionVisitorInterface* visitor_;
114 hash_map<QuicStreamId, ReliableQuicStream*>* streams_; 116 hash_map<QuicStreamId, ReliableQuicStream*>* streams_;
115 set<QuicStreamId> closed_streams_; 117 set<QuicStreamId> closed_streams_;
116 }; 118 };
117 119
118 TEST_F(QuicSessionTest, IsCryptoHandshakeComplete) { 120 TEST_F(QuicSessionTest, IsCryptoHandshakeConfirmed) {
119 EXPECT_FALSE(session_.IsCryptoHandshakeComplete()); 121 EXPECT_FALSE(session_.IsCryptoHandshakeConfirmed());
120 CryptoHandshakeMessage message; 122 CryptoHandshakeMessage message;
121 session_.crypto_stream_.OnHandshakeMessage(message); 123 session_.crypto_stream_.OnHandshakeMessage(message);
122 EXPECT_TRUE(session_.IsCryptoHandshakeComplete()); 124 EXPECT_TRUE(session_.IsCryptoHandshakeConfirmed());
123 } 125 }
124 126
125 TEST_F(QuicSessionTest, IsClosedStreamDefault) { 127 TEST_F(QuicSessionTest, IsClosedStreamDefault) {
126 // Ensure that no streams are initially closed. 128 // Ensure that no streams are initially closed.
127 for (int i = kCryptoStreamId; i < 100; i++) { 129 for (int i = kCryptoStreamId; i < 100; i++) {
128 EXPECT_FALSE(session_.IsClosedStream(i)); 130 EXPECT_FALSE(session_.IsClosedStream(i));
129 } 131 }
130 } 132 }
131 133
132 TEST_F(QuicSessionTest, IsClosedStreamLocallyCreated) { 134 TEST_F(QuicSessionTest, IsClosedStreamLocallyCreated) {
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 SendGoAway(QUIC_PEER_GOING_AWAY, 0u, "Going Away.")); 208 SendGoAway(QUIC_PEER_GOING_AWAY, 0u, "Going Away."));
207 session_.SendGoAway(QUIC_PEER_GOING_AWAY, "Going Away."); 209 session_.SendGoAway(QUIC_PEER_GOING_AWAY, "Going Away.");
208 EXPECT_TRUE(session_.goaway_sent()); 210 EXPECT_TRUE(session_.goaway_sent());
209 211
210 EXPECT_CALL(*connection_, SendRstStream(3u, QUIC_STREAM_PEER_GOING_AWAY)); 212 EXPECT_CALL(*connection_, SendRstStream(3u, QUIC_STREAM_PEER_GOING_AWAY));
211 EXPECT_FALSE(session_.GetIncomingReliableStream(3u)); 213 EXPECT_FALSE(session_.GetIncomingReliableStream(3u));
212 } 214 }
213 } // namespace 215 } // namespace
214 } // namespace test 216 } // namespace test
215 } // namespace net 217 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_session.cc ('k') | net/quic/quic_stream_factory_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698