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

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

Issue 14651009: Land Recent QUIC changes (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix integer constant is too large for 'unsigned long' type Created 7 years, 7 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
« no previous file with comments | « net/quic/quic_http_stream_test.cc ('k') | net/quic/quic_protocol.h » ('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 "base/basictypes.h" 5 #include "base/basictypes.h"
6 #include "base/compiler_specific.h" 6 #include "base/compiler_specific.h"
7 #include "base/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "net/base/test_completion_callback.h" 8 #include "net/base/test_completion_callback.h"
9 #include "net/cert/mock_cert_verifier.h" 9 #include "net/cert/mock_cert_verifier.h"
10 #include "net/dns/mock_host_resolver.h" 10 #include "net/dns/mock_host_resolver.h"
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 56
57 namespace net { 57 namespace net {
58 namespace test { 58 namespace test {
59 59
60 class QuicNetworkTransactionTest : public PlatformTest { 60 class QuicNetworkTransactionTest : public PlatformTest {
61 protected: 61 protected:
62 QuicNetworkTransactionTest() 62 QuicNetworkTransactionTest()
63 : clock_(new MockClock), 63 : clock_(new MockClock),
64 ssl_config_service_(new SSLConfigServiceDefaults), 64 ssl_config_service_(new SSLConfigServiceDefaults),
65 proxy_service_(ProxyService::CreateDirect()), 65 proxy_service_(ProxyService::CreateDirect()),
66 compressor_(new QuicSpdyCompressor()),
66 auth_handler_factory_( 67 auth_handler_factory_(
67 HttpAuthHandlerFactory::CreateDefault(&host_resolver_)) { 68 HttpAuthHandlerFactory::CreateDefault(&host_resolver_)) {
68 } 69 }
69 70
70 virtual void SetUp() { 71 virtual void SetUp() {
71 NetworkChangeNotifier::NotifyObserversOfIPAddressChangeForTests(); 72 NetworkChangeNotifier::NotifyObserversOfIPAddressChangeForTests();
72 MessageLoop::current()->RunUntilIdle(); 73 MessageLoop::current()->RunUntilIdle();
73 } 74 }
74 75
75 virtual void TearDown() { 76 virtual void TearDown() {
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 headers[":version"] = "HTTP/1.1"; 163 headers[":version"] = "HTTP/1.1";
163 return SerializeHeaderBlock(headers); 164 return SerializeHeaderBlock(headers);
164 } 165 }
165 166
166 std::string GetResponseString(const std::string& status, 167 std::string GetResponseString(const std::string& status,
167 const std::string& body) { 168 const std::string& body) {
168 SpdyHeaderBlock headers; 169 SpdyHeaderBlock headers;
169 headers[":status"] = status; 170 headers[":status"] = status;
170 headers[":version"] = "HTTP/1.1"; 171 headers[":version"] = "HTTP/1.1";
171 headers["content-type"] = "text/plain"; 172 headers["content-type"] = "text/plain";
172 return SerializeHeaderBlock(headers) + body; 173 return compressor_->CompressHeaders(headers) + body;
173 } 174 }
174 175
175 std::string SerializeHeaderBlock(const SpdyHeaderBlock& headers) { 176 std::string SerializeHeaderBlock(const SpdyHeaderBlock& headers) {
176 size_t len = SpdyFramer::GetSerializedLength(3, &headers); 177 size_t len = SpdyFramer::GetSerializedLength(3, &headers);
177 SpdyFrameBuilder builder(len); 178 SpdyFrameBuilder builder(len);
178 SpdyFramer::WriteHeaderBlock(&builder, 3, &headers); 179 SpdyFramer::WriteHeaderBlock(&builder, 3, &headers);
179 scoped_ptr<SpdyFrame> frame(builder.take()); 180 scoped_ptr<SpdyFrame> frame(builder.take());
180 return std::string(frame->data(), len); 181 return std::string(frame->data(), len);
181 } 182 }
182 183
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 235
235 QuicPacketHeader header_; 236 QuicPacketHeader header_;
236 scoped_refptr<HttpNetworkSession> session_; 237 scoped_refptr<HttpNetworkSession> session_;
237 MockClientSocketFactory socket_factory_; 238 MockClientSocketFactory socket_factory_;
238 MockCryptoClientStreamFactory crypto_client_stream_factory_; 239 MockCryptoClientStreamFactory crypto_client_stream_factory_;
239 MockClock* clock_; // Owned by QuicStreamFactory after CreateSession. 240 MockClock* clock_; // Owned by QuicStreamFactory after CreateSession.
240 MockHostResolver host_resolver_; 241 MockHostResolver host_resolver_;
241 MockCertVerifier cert_verifier_; 242 MockCertVerifier cert_verifier_;
242 scoped_refptr<SSLConfigServiceDefaults> ssl_config_service_; 243 scoped_refptr<SSLConfigServiceDefaults> ssl_config_service_;
243 scoped_ptr<ProxyService> proxy_service_; 244 scoped_ptr<ProxyService> proxy_service_;
245 scoped_ptr<QuicSpdyCompressor> compressor_;
244 scoped_ptr<HttpAuthHandlerFactory> auth_handler_factory_; 246 scoped_ptr<HttpAuthHandlerFactory> auth_handler_factory_;
245 MockRandom random_generator_; 247 MockRandom random_generator_;
246 HttpServerPropertiesImpl http_server_properties; 248 HttpServerPropertiesImpl http_server_properties;
247 HttpNetworkSession::Params params_; 249 HttpNetworkSession::Params params_;
248 }; 250 };
249 251
250 TEST_F(QuicNetworkTransactionTest, ForceQuic) { 252 TEST_F(QuicNetworkTransactionTest, ForceQuic) {
251 params_.origin_port_to_force_quic_on = 80; 253 params_.origin_port_to_force_quic_on = 80;
252 254
253 HttpRequestInfo request; 255 HttpRequestInfo request;
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after
637 ASSERT_TRUE(session_->http_server_properties()->HasAlternateProtocol( 639 ASSERT_TRUE(session_->http_server_properties()->HasAlternateProtocol(
638 HostPortPair::FromURL(request.url))); 640 HostPortPair::FromURL(request.url)));
639 const PortAlternateProtocolPair alternate = 641 const PortAlternateProtocolPair alternate =
640 session_->http_server_properties()->GetAlternateProtocol( 642 session_->http_server_properties()->GetAlternateProtocol(
641 HostPortPair::FromURL(request.url)); 643 HostPortPair::FromURL(request.url));
642 EXPECT_EQ(ALTERNATE_PROTOCOL_BROKEN, alternate.protocol); 644 EXPECT_EQ(ALTERNATE_PROTOCOL_BROKEN, alternate.protocol);
643 } 645 }
644 646
645 } // namespace test 647 } // namespace test
646 } // namespace net 648 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_http_stream_test.cc ('k') | net/quic/quic_protocol.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698