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

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

Issue 12207020: Enhance net internals/net log output for QUIC. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix comments Created 7 years, 10 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/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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698