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/tools/quic/quic_client_session.h" | 5 #include "net/tools/quic/quic_client_session.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "net/base/ip_endpoint.h" | 9 #include "net/base/ip_endpoint.h" |
10 #include "net/quic/crypto/aes_128_gcm_12_encrypter.h" | 10 #include "net/quic/crypto/aes_128_gcm_12_encrypter.h" |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 CompleteCryptoHandshake(); | 52 CompleteCryptoHandshake(); |
53 } | 53 } |
54 | 54 |
55 TEST_F(ToolsQuicClientSessionTest, MaxNumStreams) { | 55 TEST_F(ToolsQuicClientSessionTest, MaxNumStreams) { |
56 session_->config()->set_max_streams_per_connection(1, 1); | 56 session_->config()->set_max_streams_per_connection(1, 1); |
57 // FLAGS_max_streams_per_connection = 1; | 57 // FLAGS_max_streams_per_connection = 1; |
58 // Initialize crypto before the client session will create a stream. | 58 // Initialize crypto before the client session will create a stream. |
59 CompleteCryptoHandshake(); | 59 CompleteCryptoHandshake(); |
60 | 60 |
61 QuicSpdyClientStream* stream = | 61 QuicSpdyClientStream* stream = |
62 session_->CreateOutgoingReliableStream(); | 62 session_->CreateOutgoingDataStream(); |
63 ASSERT_TRUE(stream); | 63 ASSERT_TRUE(stream); |
64 EXPECT_FALSE(session_->CreateOutgoingReliableStream()); | 64 EXPECT_FALSE(session_->CreateOutgoingDataStream()); |
65 | 65 |
66 // Close a stream and ensure I can now open a new one. | 66 // Close a stream and ensure I can now open a new one. |
67 session_->CloseStream(stream->id()); | 67 session_->CloseStream(stream->id()); |
68 stream = session_->CreateOutgoingReliableStream(); | 68 stream = session_->CreateOutgoingDataStream(); |
69 EXPECT_TRUE(stream); | 69 EXPECT_TRUE(stream); |
70 } | 70 } |
71 | 71 |
72 TEST_F(ToolsQuicClientSessionTest, GoAwayReceived) { | 72 TEST_F(ToolsQuicClientSessionTest, GoAwayReceived) { |
73 CompleteCryptoHandshake(); | 73 CompleteCryptoHandshake(); |
74 | 74 |
75 // After receiving a GoAway, I should no longer be able to create outgoing | 75 // After receiving a GoAway, I should no longer be able to create outgoing |
76 // streams. | 76 // streams. |
77 session_->OnGoAway(QuicGoAwayFrame(QUIC_PEER_GOING_AWAY, 1u, "Going away.")); | 77 session_->OnGoAway(QuicGoAwayFrame(QUIC_PEER_GOING_AWAY, 1u, "Going away.")); |
78 EXPECT_EQ(NULL, session_->CreateOutgoingReliableStream()); | 78 EXPECT_EQ(NULL, session_->CreateOutgoingDataStream()); |
79 } | 79 } |
80 | 80 |
81 } // namespace | 81 } // namespace |
82 } // namespace test | 82 } // namespace test |
83 } // namespace tools | 83 } // namespace tools |
84 } // namespace net | 84 } // namespace net |
OLD | NEW |