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

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

Issue 192583004: QUIC - use QuicSessionKey tuple (host, port, is_https) instead of server_hostname (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix comments from Patch set 1 and 3 and merge with TOT Created 6 years, 9 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
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_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/quic_default_packet_writer.h" 16 #include "net/quic/quic_default_packet_writer.h"
17 #include "net/quic/test_tools/crypto_test_utils.h" 17 #include "net/quic/test_tools/crypto_test_utils.h"
18 #include "net/quic/test_tools/quic_client_session_peer.h" 18 #include "net/quic/test_tools/quic_client_session_peer.h"
19 #include "net/quic/test_tools/quic_test_utils.h" 19 #include "net/quic/test_tools/quic_test_utils.h"
20 #include "net/socket/socket_test_util.h" 20 #include "net/socket/socket_test_util.h"
21 #include "net/udp/datagram_client_socket.h" 21 #include "net/udp/datagram_client_socket.h"
22 22
23 using testing::_; 23 using testing::_;
24 24
25 namespace net { 25 namespace net {
26 namespace test { 26 namespace test {
27 namespace { 27 namespace {
28 28
29 const char kServerHostname[] = "www.example.com"; 29 const char kServerHostname[] = "www.example.com";
30 const uint16 kServerPort = 80;
30 31
31 class TestPacketWriter : public QuicDefaultPacketWriter { 32 class TestPacketWriter : public QuicDefaultPacketWriter {
32 public: 33 public:
33 TestPacketWriter() { 34 TestPacketWriter() {
34 } 35 }
35 36
36 // QuicPacketWriter 37 // QuicPacketWriter
37 virtual WriteResult WritePacket( 38 virtual WriteResult WritePacket(
38 const char* buffer, size_t buf_len, 39 const char* buffer, size_t buf_len,
39 const IPAddressNumber& self_address, 40 const IPAddressNumber& self_address,
(...skipping 20 matching lines...) Expand all
60 QuicPacketHeader header_; 61 QuicPacketHeader header_;
61 }; 62 };
62 63
63 class QuicClientSessionTest : public ::testing::TestWithParam<QuicVersion> { 64 class QuicClientSessionTest : public ::testing::TestWithParam<QuicVersion> {
64 protected: 65 protected:
65 QuicClientSessionTest() 66 QuicClientSessionTest()
66 : writer_(new TestPacketWriter()), 67 : writer_(new TestPacketWriter()),
67 connection_( 68 connection_(
68 new PacketSavingConnection(false, SupportedVersions(GetParam()))), 69 new PacketSavingConnection(false, SupportedVersions(GetParam()))),
69 session_(connection_, GetSocket().Pass(), writer_.Pass(), NULL, NULL, 70 session_(connection_, GetSocket().Pass(), writer_.Pass(), NULL, NULL,
70 kServerHostname, DefaultQuicConfig(), &crypto_config_, 71 kServerHostname, kServerPort, DefaultQuicConfig(),
71 &net_log_) { 72 &crypto_config_, &net_log_) {
72 session_.config()->SetDefaults(); 73 session_.config()->SetDefaults();
73 crypto_config_.SetDefaults(); 74 crypto_config_.SetDefaults();
74 } 75 }
75 76
76 virtual void TearDown() OVERRIDE { 77 virtual void TearDown() OVERRIDE {
77 session_.CloseSessionOnError(ERR_ABORTED); 78 session_.CloseSessionOnError(ERR_ABORTED);
78 } 79 }
79 80
80 scoped_ptr<DatagramClientSocket> GetSocket() { 81 scoped_ptr<DatagramClientSocket> GetSocket() {
81 socket_factory_.AddSocketDataProvider(&socket_data_); 82 socket_factory_.AddSocketDataProvider(&socket_data_);
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 158
158 // After receiving a GoAway, I should no longer be able to create outgoing 159 // After receiving a GoAway, I should no longer be able to create outgoing
159 // streams. 160 // streams.
160 session_.OnGoAway(QuicGoAwayFrame(QUIC_PEER_GOING_AWAY, 1u, "Going away.")); 161 session_.OnGoAway(QuicGoAwayFrame(QUIC_PEER_GOING_AWAY, 1u, "Going away."));
161 EXPECT_EQ(NULL, session_.CreateOutgoingDataStream()); 162 EXPECT_EQ(NULL, session_.CreateOutgoingDataStream());
162 } 163 }
163 164
164 } // namespace 165 } // namespace
165 } // namespace test 166 } // namespace test
166 } // namespace net 167 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698