| 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" |
| 11 #include "net/quic/test_tools/crypto_test_utils.h" | 11 #include "net/quic/test_tools/crypto_test_utils.h" |
| 12 #include "net/quic/test_tools/quic_test_utils.h" | 12 #include "net/quic/test_tools/quic_test_utils.h" |
| 13 #include "net/tools/quic/quic_reliable_client_stream.h" | 13 #include "net/tools/quic/quic_spdy_client_stream.h" |
| 14 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
| 15 | 15 |
| 16 using net::test::CryptoTestUtils; | 16 using net::test::CryptoTestUtils; |
| 17 using net::test::DefaultQuicConfig; | 17 using net::test::DefaultQuicConfig; |
| 18 using net::test::PacketSavingConnection; | 18 using net::test::PacketSavingConnection; |
| 19 using testing::_; | 19 using testing::_; |
| 20 | 20 |
| 21 namespace net { | 21 namespace net { |
| 22 namespace tools { | 22 namespace tools { |
| 23 namespace test { | 23 namespace test { |
| (...skipping 27 matching lines...) Expand all Loading... |
| 51 TEST_F(ToolsQuicClientSessionTest, CryptoConnect) { | 51 TEST_F(ToolsQuicClientSessionTest, CryptoConnect) { |
| 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 QuicReliableClientStream* stream = | 61 QuicSpdyClientStream* stream = |
| 62 session_->CreateOutgoingReliableStream(); | 62 session_->CreateOutgoingReliableStream(); |
| 63 ASSERT_TRUE(stream); | 63 ASSERT_TRUE(stream); |
| 64 EXPECT_FALSE(session_->CreateOutgoingReliableStream()); | 64 EXPECT_FALSE(session_->CreateOutgoingReliableStream()); |
| 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_->CreateOutgoingReliableStream(); |
| 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_->CreateOutgoingReliableStream()); |
| 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 |