OLD | NEW |
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" |
| 11 #include "net/quic/crypto/crypto_handshake.h" |
11 #include "net/quic/test_tools/quic_test_utils.h" | 12 #include "net/quic/test_tools/quic_test_utils.h" |
12 #include "testing/gmock/include/gmock/gmock.h" | 13 #include "testing/gmock/include/gmock/gmock.h" |
13 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
14 | 15 |
15 using base::hash_map; | 16 using base::hash_map; |
16 using std::set; | 17 using std::set; |
17 using testing::_; | 18 using testing::_; |
18 using testing::InSequence; | 19 using testing::InSequence; |
19 | 20 |
20 namespace net { | 21 namespace net { |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 this->MarkWriteBlocked(2); | 81 this->MarkWriteBlocked(2); |
81 } | 82 } |
82 | 83 |
83 TestCryptoStream crypto_stream_; | 84 TestCryptoStream crypto_stream_; |
84 }; | 85 }; |
85 | 86 |
86 class QuicSessionTest : public ::testing::Test { | 87 class QuicSessionTest : public ::testing::Test { |
87 protected: | 88 protected: |
88 QuicSessionTest() | 89 QuicSessionTest() |
89 : guid_(1), | 90 : guid_(1), |
90 connection_(new MockConnection(guid_, IPEndPoint())), | 91 connection_(new MockConnection(guid_, IPEndPoint(), false)), |
91 session_(connection_, true) { | 92 session_(connection_, true) { |
92 } | 93 } |
93 | 94 |
94 void CheckClosedStreams() { | 95 void CheckClosedStreams() { |
95 for (int i = kCryptoStreamId; i < 100; i++) { | 96 for (int i = kCryptoStreamId; i < 100; i++) { |
96 if (closed_streams_.count(i) == 0) { | 97 if (closed_streams_.count(i) == 0) { |
97 EXPECT_FALSE(session_.IsClosedStream(i)) << " stream id: " << i; | 98 EXPECT_FALSE(session_.IsClosedStream(i)) << " stream id: " << i; |
98 } else { | 99 } else { |
99 EXPECT_TRUE(session_.IsClosedStream(i)) << " stream id: " << i; | 100 EXPECT_TRUE(session_.IsClosedStream(i)) << " stream id: " << i; |
100 } | 101 } |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 SendGoAway(QUIC_PEER_GOING_AWAY, 0u, "Going Away.")); | 206 SendGoAway(QUIC_PEER_GOING_AWAY, 0u, "Going Away.")); |
206 session_.SendGoAway(QUIC_PEER_GOING_AWAY, "Going Away."); | 207 session_.SendGoAway(QUIC_PEER_GOING_AWAY, "Going Away."); |
207 EXPECT_TRUE(session_.goaway_sent()); | 208 EXPECT_TRUE(session_.goaway_sent()); |
208 | 209 |
209 EXPECT_CALL(*connection_, SendRstStream(3u, QUIC_PEER_GOING_AWAY)); | 210 EXPECT_CALL(*connection_, SendRstStream(3u, QUIC_PEER_GOING_AWAY)); |
210 EXPECT_FALSE(session_.GetIncomingReliableStream(3u)); | 211 EXPECT_FALSE(session_.GetIncomingReliableStream(3u)); |
211 } | 212 } |
212 } // namespace | 213 } // namespace |
213 } // namespace test | 214 } // namespace test |
214 } // namespace net | 215 } // namespace net |
OLD | NEW |