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/stl_util.h" | 9 #include "base/stl_util.h" |
10 #include "net/base/capturing_net_log.h" | |
10 #include "net/base/test_completion_callback.h" | 11 #include "net/base/test_completion_callback.h" |
11 #include "net/quic/crypto/crypto_protocol.h" | 12 #include "net/quic/crypto/crypto_protocol.h" |
12 #include "net/quic/test_tools/quic_test_utils.h" | 13 #include "net/quic/test_tools/quic_test_utils.h" |
13 | 14 |
14 using testing::_; | 15 using testing::_; |
15 | 16 |
16 namespace net { | 17 namespace net { |
17 namespace test { | 18 namespace test { |
18 namespace { | 19 namespace { |
19 | 20 |
20 const char kServerHostname[] = "www.example.com"; | 21 const char kServerHostname[] = "www.example.com"; |
21 | 22 |
22 class QuicClientSessionTest : public ::testing::Test { | 23 class QuicClientSessionTest : public ::testing::Test { |
23 protected: | 24 protected: |
24 QuicClientSessionTest() | 25 QuicClientSessionTest() |
25 : guid_(1), | 26 : guid_(1), |
26 connection_(new PacketSavingConnection(guid_, IPEndPoint())), | 27 connection_(new PacketSavingConnection(guid_, IPEndPoint())), |
27 session_(connection_, NULL, NULL, kServerHostname) { | 28 session_(connection_, NULL, NULL, kServerHostname, &net_log_) { |
eroman
2013/02/05 23:52:40
You can also safely pass in NULL if you like.
Ryan Hamilton
2013/02/06 16:40:15
Done.
| |
28 } | 29 } |
29 | 30 |
30 QuicGuid guid_; | 31 QuicGuid guid_; |
31 PacketSavingConnection* connection_; | 32 PacketSavingConnection* connection_; |
33 CapturingNetLog net_log_; | |
32 QuicClientSession session_; | 34 QuicClientSession session_; |
33 QuicConnectionVisitorInterface* visitor_; | 35 QuicConnectionVisitorInterface* visitor_; |
34 TestCompletionCallback callback_; | 36 TestCompletionCallback callback_; |
35 }; | 37 }; |
36 | 38 |
37 TEST_F(QuicClientSessionTest, CryptoConnectSendsCorrectData) { | 39 TEST_F(QuicClientSessionTest, CryptoConnectSendsCorrectData) { |
38 EXPECT_EQ(ERR_IO_PENDING, session_.CryptoConnect(callback_.callback())); | 40 EXPECT_EQ(ERR_IO_PENDING, session_.CryptoConnect(callback_.callback())); |
39 ASSERT_EQ(1u, connection_->packets_.size()); | 41 ASSERT_EQ(1u, connection_->packets_.size()); |
40 scoped_ptr<QuicPacket> chlo(ConstructClientHelloPacket( | 42 scoped_ptr<QuicPacket> chlo(ConstructClientHelloPacket( |
41 guid_, connection_->clock(), connection_->random_generator(), | 43 guid_, connection_->clock(), connection_->random_generator(), |
(...skipping 28 matching lines...) Expand all Loading... | |
70 EXPECT_FALSE(session_.CreateOutgoingReliableStream()); | 72 EXPECT_FALSE(session_.CreateOutgoingReliableStream()); |
71 | 73 |
72 // Close a stream and ensure I can now open a new one. | 74 // Close a stream and ensure I can now open a new one. |
73 session_.CloseStream(streams[0]->id()); | 75 session_.CloseStream(streams[0]->id()); |
74 EXPECT_TRUE(session_.CreateOutgoingReliableStream()); | 76 EXPECT_TRUE(session_.CreateOutgoingReliableStream()); |
75 } | 77 } |
76 | 78 |
77 } // namespace | 79 } // namespace |
78 } // namespace test | 80 } // namespace test |
79 } // namespace net | 81 } // namespace net |
OLD | NEW |