Chromium Code Reviews| 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_client_session.h" | 5 #include "net/quic/quic_client_session.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/rand_util.h" | 9 #include "base/rand_util.h" |
| 10 #include "net/base/capturing_net_log.h" | 10 #include "net/base/capturing_net_log.h" |
| 11 #include "net/base/test_completion_callback.h" | 11 #include "net/base/test_completion_callback.h" |
| 12 #include "net/quic/crypto/aes_128_gcm_12_encrypter.h" | 12 #include "net/quic/crypto/aes_128_gcm_12_encrypter.h" |
| 13 #include "net/quic/crypto/crypto_protocol.h" | 13 #include "net/quic/crypto/crypto_protocol.h" |
| 14 #include "net/quic/crypto/quic_decrypter.h" | 14 #include "net/quic/crypto/quic_decrypter.h" |
| 15 #include "net/quic/crypto/quic_encrypter.h" | 15 #include "net/quic/crypto/quic_encrypter.h" |
| 16 #include "net/quic/crypto/quic_server_info.h" | 16 #include "net/quic/crypto/quic_server_info.h" |
| 17 #include "net/quic/quic_default_packet_writer.h" | 17 #include "net/quic/quic_default_packet_writer.h" |
| 18 #include "net/quic/test_tools/crypto_test_utils.h" | 18 #include "net/quic/test_tools/crypto_test_utils.h" |
| 19 #include "net/quic/test_tools/quic_client_session_peer.h" | 19 #include "net/quic/test_tools/quic_client_session_peer.h" |
| 20 #include "net/quic/test_tools/quic_test_utils.h" | 20 #include "net/quic/test_tools/quic_test_utils.h" |
| 21 #include "net/quic/test_tools/simple_quic_framer.h" | 21 #include "net/quic/test_tools/simple_quic_framer.h" |
| 22 #include "net/socket/socket_test_util.h" | 22 #include "net/socket/socket_test_util.h" |
| 23 #include "net/udp/datagram_client_socket.h" | 23 #include "net/udp/datagram_client_socket.h" |
| 24 | 24 |
| 25 using net::test::kInitialFlowControlWindowForTest; | |
|
wtc
2014/05/19 18:58:40
Nit: since the entire file is inside the net::test
ramant (doing other things)
2014/05/20 03:22:32
Done.
| |
| 25 using testing::_; | 26 using testing::_; |
| 26 | 27 |
| 27 namespace net { | 28 namespace net { |
| 28 namespace test { | 29 namespace test { |
| 29 namespace { | 30 namespace { |
| 30 | 31 |
| 31 const char kServerHostname[] = "www.example.com"; | 32 const char kServerHostname[] = "www.example.com"; |
| 32 const uint16 kServerPort = 80; | 33 const uint16 kServerPort = 80; |
| 33 | 34 |
| 34 class TestPacketWriter : public QuicDefaultPacketWriter { | 35 class TestPacketWriter : public QuicDefaultPacketWriter { |
| (...skipping 30 matching lines...) Expand all Loading... | |
| 65 class QuicClientSessionTest : public ::testing::TestWithParam<QuicVersion> { | 66 class QuicClientSessionTest : public ::testing::TestWithParam<QuicVersion> { |
| 66 protected: | 67 protected: |
| 67 QuicClientSessionTest() | 68 QuicClientSessionTest() |
| 68 : writer_(new TestPacketWriter(GetParam())), | 69 : writer_(new TestPacketWriter(GetParam())), |
| 69 connection_( | 70 connection_( |
| 70 new PacketSavingConnection(false, SupportedVersions(GetParam()))), | 71 new PacketSavingConnection(false, SupportedVersions(GetParam()))), |
| 71 session_(connection_, GetSocket().Pass(), writer_.Pass(), NULL, NULL, | 72 session_(connection_, GetSocket().Pass(), writer_.Pass(), NULL, NULL, |
| 72 make_scoped_ptr((QuicServerInfo*)NULL), | 73 make_scoped_ptr((QuicServerInfo*)NULL), |
| 73 QuicServerId(kServerHostname, kServerPort, false, | 74 QuicServerId(kServerHostname, kServerPort, false, |
| 74 PRIVACY_MODE_DISABLED), | 75 PRIVACY_MODE_DISABLED), |
| 75 DefaultQuicConfig(), &crypto_config_, &net_log_) { | 76 DefaultQuicConfig(), kInitialFlowControlWindowForTest, |
| 77 &crypto_config_, &net_log_) { | |
| 76 session_.config()->SetDefaults(); | 78 session_.config()->SetDefaults(); |
| 77 crypto_config_.SetDefaults(); | 79 crypto_config_.SetDefaults(); |
| 78 } | 80 } |
| 79 | 81 |
| 80 virtual void TearDown() OVERRIDE { | 82 virtual void TearDown() OVERRIDE { |
| 81 session_.CloseSessionOnError(ERR_ABORTED); | 83 session_.CloseSessionOnError(ERR_ABORTED); |
| 82 } | 84 } |
| 83 | 85 |
| 84 scoped_ptr<DatagramClientSocket> GetSocket() { | 86 scoped_ptr<DatagramClientSocket> GetSocket() { |
| 85 socket_factory_.AddSocketDataProvider(&socket_data_); | 87 socket_factory_.AddSocketDataProvider(&socket_data_); |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 161 | 163 |
| 162 // After receiving a GoAway, I should no longer be able to create outgoing | 164 // After receiving a GoAway, I should no longer be able to create outgoing |
| 163 // streams. | 165 // streams. |
| 164 session_.OnGoAway(QuicGoAwayFrame(QUIC_PEER_GOING_AWAY, 1u, "Going away.")); | 166 session_.OnGoAway(QuicGoAwayFrame(QUIC_PEER_GOING_AWAY, 1u, "Going away.")); |
| 165 EXPECT_EQ(NULL, session_.CreateOutgoingDataStream()); | 167 EXPECT_EQ(NULL, session_.CreateOutgoingDataStream()); |
| 166 } | 168 } |
| 167 | 169 |
| 168 } // namespace | 170 } // namespace |
| 169 } // namespace test | 171 } // namespace test |
| 170 } // namespace net | 172 } // namespace net |
| OLD | NEW |