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

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

Issue 11416058: Integrating the QuicStreamFactory into the network stack. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix static initializer Created 8 years 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
« no previous file with comments | « net/quic/quic_stream_factory.cc ('k') | net/quic/quic_utils.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_stream_factory.h" 5 #include "net/quic/quic_stream_factory.h"
6 6
7 #include "base/rand_util.h" 7 #include "base/rand_util.h"
8 #include "base/run_loop.h" 8 #include "base/run_loop.h"
9 #include "base/string_util.h" 9 #include "base/string_util.h"
10 #include "net/base/mock_host_resolver.h" 10 #include "net/base/mock_host_resolver.h"
11 #include "net/http/http_response_headers.h" 11 #include "net/http/http_response_headers.h"
12 #include "net/http/http_response_info.h" 12 #include "net/http/http_response_info.h"
13 #include "net/http/http_util.h" 13 #include "net/http/http_util.h"
14 #include "net/quic/quic_http_stream.h" 14 #include "net/quic/quic_http_stream.h"
15 #include "net/quic/test_tools/mock_clock.h" 15 #include "net/quic/test_tools/mock_clock.h"
16 #include "net/quic/test_tools/quic_test_utils.h" 16 #include "net/quic/test_tools/quic_test_utils.h"
17 #include "net/socket/socket_test_util.h" 17 #include "net/socket/socket_test_util.h"
18 #include "testing/gtest/include/gtest/gtest.h" 18 #include "testing/gtest/include/gtest/gtest.h"
19 19
20 namespace net { 20 namespace net {
21 21
22 namespace test { 22 namespace test {
23 23
24 class QuicStreamFactoryTest : public ::testing::Test { 24 class QuicStreamFactoryTest : public ::testing::Test {
25 protected: 25 protected:
26 QuicStreamFactoryTest() 26 QuicStreamFactoryTest()
27 : factory_(&host_resolver_, &socket_factory_, 27 : factory_(&host_resolver_, &socket_factory_,
28 base::Bind(&QuicStreamFactoryTest::GenerateGuid), &clock_), 28 base::Bind(&QuicStreamFactoryTest::GenerateGuid),
29 new MockClock()),
29 host_port_proxy_pair_(HostPortPair("www.google.com", 443), 30 host_port_proxy_pair_(HostPortPair("www.google.com", 443),
30 ProxyServer::Direct()) { 31 ProxyServer::Direct()) {
31 } 32 }
32 33
33 scoped_ptr<QuicEncryptedPacket> ConstructChlo() { 34 scoped_ptr<QuicEncryptedPacket> ConstructChlo() {
34 scoped_ptr<QuicPacket> chlo(ConstructHandshakePacket(0xDEADBEEF, kCHLO)); 35 scoped_ptr<QuicPacket> chlo(ConstructHandshakePacket(0xDEADBEEF, kCHLO));
35 QuicFramer framer(QuicDecrypter::Create(kNULL), 36 QuicFramer framer(QuicDecrypter::Create(kNULL),
36 QuicEncrypter::Create(kNULL)); 37 QuicEncrypter::Create(kNULL));
37 return scoped_ptr<QuicEncryptedPacket>(framer.EncryptPacket(*chlo)); 38 return scoped_ptr<QuicEncryptedPacket>(framer.EncryptPacket(*chlo));
38 } 39 }
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 frames.push_back(frame); 101 frames.push_back(frame);
101 QuicPacket* packet; 102 QuicPacket* packet;
102 framer.ConstructFrameDataPacket(header, frames, &packet); 103 framer.ConstructFrameDataPacket(header, frames, &packet);
103 QuicEncryptedPacket* encrypted = framer.EncryptPacket(*packet); 104 QuicEncryptedPacket* encrypted = framer.EncryptPacket(*packet);
104 delete packet; 105 delete packet;
105 return scoped_ptr<QuicEncryptedPacket>(encrypted); 106 return scoped_ptr<QuicEncryptedPacket>(encrypted);
106 } 107 }
107 108
108 MockHostResolver host_resolver_; 109 MockHostResolver host_resolver_;
109 MockClientSocketFactory socket_factory_; 110 MockClientSocketFactory socket_factory_;
110 MockClock clock_;
111 QuicStreamFactory factory_; 111 QuicStreamFactory factory_;
112 HostPortProxyPair host_port_proxy_pair_; 112 HostPortProxyPair host_port_proxy_pair_;
113 BoundNetLog net_log_; 113 BoundNetLog net_log_;
114 TestCompletionCallback callback_; 114 TestCompletionCallback callback_;
115 115
116 private: 116 private:
117 static uint64 GenerateGuid() { 117 static uint64 GenerateGuid() {
118 return 0xDEADBEEF; 118 return 0xDEADBEEF;
119 } 119 }
120 }; 120 };
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 EXPECT_TRUE(stream.get()); 223 EXPECT_TRUE(stream.get());
224 stream.reset(); 224 stream.reset();
225 225
226 EXPECT_TRUE(socket_data.at_read_eof()); 226 EXPECT_TRUE(socket_data.at_read_eof());
227 EXPECT_TRUE(socket_data.at_write_eof()); 227 EXPECT_TRUE(socket_data.at_write_eof());
228 } 228 }
229 229
230 } // namespace test 230 } // namespace test
231 231
232 } // namespace net 232 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_stream_factory.cc ('k') | net/quic/quic_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698