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 <stddef.h> | 5 #include <stddef.h> |
6 #include <sys/epoll.h> | 6 #include <sys/epoll.h> |
7 | 7 |
8 #include <cstdint> | 8 #include <cstdint> |
9 #include <list> | 9 #include <list> |
10 #include <memory> | 10 #include <memory> |
(...skipping 26 matching lines...) Expand all Loading... |
37 #include "net/quic/test_tools/quic_flow_controller_peer.h" | 37 #include "net/quic/test_tools/quic_flow_controller_peer.h" |
38 #include "net/quic/test_tools/quic_sent_packet_manager_peer.h" | 38 #include "net/quic/test_tools/quic_sent_packet_manager_peer.h" |
39 #include "net/quic/test_tools/quic_session_peer.h" | 39 #include "net/quic/test_tools/quic_session_peer.h" |
40 #include "net/quic/test_tools/quic_spdy_session_peer.h" | 40 #include "net/quic/test_tools/quic_spdy_session_peer.h" |
41 #include "net/quic/test_tools/quic_stream_peer.h" | 41 #include "net/quic/test_tools/quic_stream_peer.h" |
42 #include "net/quic/test_tools/quic_stream_sequencer_peer.h" | 42 #include "net/quic/test_tools/quic_stream_sequencer_peer.h" |
43 #include "net/quic/test_tools/quic_test_utils.h" | 43 #include "net/quic/test_tools/quic_test_utils.h" |
44 #include "net/test/gtest_util.h" | 44 #include "net/test/gtest_util.h" |
45 #include "net/tools/epoll_server/epoll_server.h" | 45 #include "net/tools/epoll_server/epoll_server.h" |
46 #include "net/tools/quic/quic_epoll_connection_helper.h" | 46 #include "net/tools/quic/quic_epoll_connection_helper.h" |
47 #include "net/tools/quic/quic_in_memory_cache.h" | 47 #include "net/tools/quic/quic_http_response_cache.h" |
48 #include "net/tools/quic/quic_packet_writer_wrapper.h" | 48 #include "net/tools/quic/quic_packet_writer_wrapper.h" |
49 #include "net/tools/quic/quic_server.h" | 49 #include "net/tools/quic/quic_server.h" |
50 #include "net/tools/quic/quic_simple_server_stream.h" | 50 #include "net/tools/quic/quic_simple_server_stream.h" |
51 #include "net/tools/quic/quic_socket_utils.h" | 51 #include "net/tools/quic/quic_socket_utils.h" |
52 #include "net/tools/quic/quic_spdy_client_stream.h" | 52 #include "net/tools/quic/quic_spdy_client_stream.h" |
53 #include "net/tools/quic/test_tools/packet_dropping_test_writer.h" | 53 #include "net/tools/quic/test_tools/packet_dropping_test_writer.h" |
54 #include "net/tools/quic/test_tools/packet_reordering_writer.h" | 54 #include "net/tools/quic/test_tools/packet_reordering_writer.h" |
55 #include "net/tools/quic/test_tools/quic_client_peer.h" | 55 #include "net/tools/quic/test_tools/quic_client_peer.h" |
56 #include "net/tools/quic/test_tools/quic_dispatcher_peer.h" | 56 #include "net/tools/quic/test_tools/quic_dispatcher_peer.h" |
57 #include "net/tools/quic/test_tools/quic_server_peer.h" | 57 #include "net/tools/quic/test_tools/quic_server_peer.h" |
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
422 << "case. Otherwise, your test will leak memory."; | 422 << "case. Otherwise, your test will leak memory."; |
423 StopServer(); | 423 StopServer(); |
424 } | 424 } |
425 | 425 |
426 void StartServer() { | 426 void StartServer() { |
427 FLAGS_quic_use_cheap_stateless_rejects = | 427 FLAGS_quic_use_cheap_stateless_rejects = |
428 GetParam().use_cheap_stateless_reject; | 428 GetParam().use_cheap_stateless_reject; |
429 | 429 |
430 auto test_server = new QuicTestServer( | 430 auto test_server = new QuicTestServer( |
431 CryptoTestUtils::ProofSourceForTesting(), server_config_, | 431 CryptoTestUtils::ProofSourceForTesting(), server_config_, |
432 server_supported_versions_, &in_memory_cache_); | 432 server_supported_versions_, &response_cache_); |
433 server_thread_.reset(new ServerThread(test_server, server_address_)); | 433 server_thread_.reset(new ServerThread(test_server, server_address_)); |
434 if (chlo_multiplier_ != 0) { | 434 if (chlo_multiplier_ != 0) { |
435 server_thread_->server()->SetChloMultiplier(chlo_multiplier_); | 435 server_thread_->server()->SetChloMultiplier(chlo_multiplier_); |
436 } | 436 } |
437 server_thread_->Initialize(); | 437 server_thread_->Initialize(); |
438 server_address_ = | 438 server_address_ = |
439 QuicSocketAddress(server_address_.host(), server_thread_->GetPort()); | 439 QuicSocketAddress(server_address_.host(), server_thread_->GetPort()); |
440 QuicDispatcher* dispatcher = | 440 QuicDispatcher* dispatcher = |
441 QuicServerPeer::GetDispatcher(server_thread_->server()); | 441 QuicServerPeer::GetDispatcher(server_thread_->server()); |
442 QuicDispatcherPeer::UseWriter(dispatcher, server_writer_); | 442 QuicDispatcherPeer::UseWriter(dispatcher, server_writer_); |
(...skipping 16 matching lines...) Expand all Loading... |
459 void StopServer() { | 459 void StopServer() { |
460 if (!server_started_) | 460 if (!server_started_) |
461 return; | 461 return; |
462 if (server_thread_.get()) { | 462 if (server_thread_.get()) { |
463 server_thread_->Quit(); | 463 server_thread_->Quit(); |
464 server_thread_->Join(); | 464 server_thread_->Join(); |
465 } | 465 } |
466 } | 466 } |
467 | 467 |
468 void AddToCache(StringPiece path, int response_code, StringPiece body) { | 468 void AddToCache(StringPiece path, int response_code, StringPiece body) { |
469 in_memory_cache_.AddSimpleResponse(server_hostname_, path, response_code, | 469 response_cache_.AddSimpleResponse(server_hostname_, path, response_code, |
470 body); | 470 body); |
471 } | 471 } |
472 | 472 |
473 void SetPacketLossPercentage(int32_t loss) { | 473 void SetPacketLossPercentage(int32_t loss) { |
474 // TODO(rtenneti): enable when we can do random packet loss tests in | 474 // TODO(rtenneti): enable when we can do random packet loss tests in |
475 // chrome's tree. | 475 // chrome's tree. |
476 if (loss != 0 && loss != 100) | 476 if (loss != 0 && loss != 100) |
477 return; | 477 return; |
478 client_writer_->set_fake_packet_loss_percentage(loss); | 478 client_writer_->set_fake_packet_loss_percentage(loss); |
479 server_writer_->set_fake_packet_loss_percentage(loss); | 479 server_writer_->set_fake_packet_loss_percentage(loss); |
480 } | 480 } |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
550 | 550 |
551 // Must be called before Initialize to have effect. | 551 // Must be called before Initialize to have effect. |
552 void SetSpdyStreamFactory(QuicTestServer::StreamFactory* factory) { | 552 void SetSpdyStreamFactory(QuicTestServer::StreamFactory* factory) { |
553 stream_factory_ = factory; | 553 stream_factory_ = factory; |
554 } | 554 } |
555 | 555 |
556 QuicFlagSaver flags_; // Save/restore all QUIC flag values. | 556 QuicFlagSaver flags_; // Save/restore all QUIC flag values. |
557 bool initialized_; | 557 bool initialized_; |
558 QuicSocketAddress server_address_; | 558 QuicSocketAddress server_address_; |
559 string server_hostname_; | 559 string server_hostname_; |
560 QuicInMemoryCache in_memory_cache_; | 560 QuicHttpResponseCache response_cache_; |
561 std::unique_ptr<ServerThread> server_thread_; | 561 std::unique_ptr<ServerThread> server_thread_; |
562 std::unique_ptr<QuicTestClient> client_; | 562 std::unique_ptr<QuicTestClient> client_; |
563 PacketDroppingTestWriter* client_writer_; | 563 PacketDroppingTestWriter* client_writer_; |
564 PacketDroppingTestWriter* server_writer_; | 564 PacketDroppingTestWriter* server_writer_; |
565 bool server_started_; | 565 bool server_started_; |
566 QuicConfig client_config_; | 566 QuicConfig client_config_; |
567 QuicConfig server_config_; | 567 QuicConfig server_config_; |
568 QuicVersionVector client_supported_versions_; | 568 QuicVersionVector client_supported_versions_; |
569 QuicVersionVector server_supported_versions_; | 569 QuicVersionVector server_supported_versions_; |
570 QuicVersion negotiated_version_; | 570 QuicVersion negotiated_version_; |
(...skipping 1556 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2127 // The connection should not be terminated. | 2127 // The connection should not be terminated. |
2128 EXPECT_EQ(kFooResponseBody, client_->SendSynchronousRequest("/foo")); | 2128 EXPECT_EQ(kFooResponseBody, client_->SendSynchronousRequest("/foo")); |
2129 EXPECT_EQ("200", client_->response_headers()->find(":status")->second); | 2129 EXPECT_EQ("200", client_->response_headers()->find(":status")->second); |
2130 } | 2130 } |
2131 | 2131 |
2132 // A test stream that gives |response_body_| as an error response body. | 2132 // A test stream that gives |response_body_| as an error response body. |
2133 class ServerStreamWithErrorResponseBody : public QuicSimpleServerStream { | 2133 class ServerStreamWithErrorResponseBody : public QuicSimpleServerStream { |
2134 public: | 2134 public: |
2135 ServerStreamWithErrorResponseBody(QuicStreamId id, | 2135 ServerStreamWithErrorResponseBody(QuicStreamId id, |
2136 QuicSpdySession* session, | 2136 QuicSpdySession* session, |
2137 QuicInMemoryCache* in_memory_cache, | 2137 QuicHttpResponseCache* response_cache, |
2138 string response_body) | 2138 string response_body) |
2139 : QuicSimpleServerStream(id, session, in_memory_cache), | 2139 : QuicSimpleServerStream(id, session, response_cache), |
2140 response_body_(std::move(response_body)) {} | 2140 response_body_(std::move(response_body)) {} |
2141 | 2141 |
2142 ~ServerStreamWithErrorResponseBody() override {} | 2142 ~ServerStreamWithErrorResponseBody() override {} |
2143 | 2143 |
2144 protected: | 2144 protected: |
2145 void SendErrorResponse() override { | 2145 void SendErrorResponse() override { |
2146 DVLOG(1) << "Sending error response for stream " << id(); | 2146 DVLOG(1) << "Sending error response for stream " << id(); |
2147 SpdyHeaderBlock headers; | 2147 SpdyHeaderBlock headers; |
2148 headers[":status"] = "500"; | 2148 headers[":status"] = "500"; |
2149 headers["content-length"] = base::UintToString(response_body_.size()); | 2149 headers["content-length"] = base::UintToString(response_body_.size()); |
2150 // This method must call CloseReadSide to cause the test case, StopReading | 2150 // This method must call CloseReadSide to cause the test case, StopReading |
2151 // is not sufficient. | 2151 // is not sufficient. |
2152 QuicStreamPeer::CloseReadSide(this); | 2152 QuicStreamPeer::CloseReadSide(this); |
2153 SendHeadersAndBody(std::move(headers), response_body_); | 2153 SendHeadersAndBody(std::move(headers), response_body_); |
2154 } | 2154 } |
2155 | 2155 |
2156 string response_body_; | 2156 string response_body_; |
2157 }; | 2157 }; |
2158 | 2158 |
2159 class StreamWithErrorFactory : public QuicTestServer::StreamFactory { | 2159 class StreamWithErrorFactory : public QuicTestServer::StreamFactory { |
2160 public: | 2160 public: |
2161 explicit StreamWithErrorFactory(string response_body) | 2161 explicit StreamWithErrorFactory(string response_body) |
2162 : response_body_(std::move(response_body)) {} | 2162 : response_body_(std::move(response_body)) {} |
2163 | 2163 |
2164 ~StreamWithErrorFactory() override {} | 2164 ~StreamWithErrorFactory() override {} |
2165 | 2165 |
2166 QuicSimpleServerStream* CreateStream( | 2166 QuicSimpleServerStream* CreateStream( |
2167 QuicStreamId id, | 2167 QuicStreamId id, |
2168 QuicSpdySession* session, | 2168 QuicSpdySession* session, |
2169 QuicInMemoryCache* in_memory_cache) override { | 2169 QuicHttpResponseCache* response_cache) override { |
2170 return new ServerStreamWithErrorResponseBody(id, session, in_memory_cache, | 2170 return new ServerStreamWithErrorResponseBody(id, session, response_cache, |
2171 response_body_); | 2171 response_body_); |
2172 } | 2172 } |
2173 | 2173 |
2174 private: | 2174 private: |
2175 string response_body_; | 2175 string response_body_; |
2176 }; | 2176 }; |
2177 | 2177 |
2178 // A test server stream that drops all received body. | 2178 // A test server stream that drops all received body. |
2179 class ServerStreamThatDropsBody : public QuicSimpleServerStream { | 2179 class ServerStreamThatDropsBody : public QuicSimpleServerStream { |
2180 public: | 2180 public: |
2181 ServerStreamThatDropsBody(QuicStreamId id, | 2181 ServerStreamThatDropsBody(QuicStreamId id, |
2182 QuicSpdySession* session, | 2182 QuicSpdySession* session, |
2183 QuicInMemoryCache* in_memory_cache) | 2183 QuicHttpResponseCache* response_cache) |
2184 : QuicSimpleServerStream(id, session, in_memory_cache) {} | 2184 : QuicSimpleServerStream(id, session, response_cache) {} |
2185 | 2185 |
2186 ~ServerStreamThatDropsBody() override {} | 2186 ~ServerStreamThatDropsBody() override {} |
2187 | 2187 |
2188 protected: | 2188 protected: |
2189 void OnDataAvailable() override { | 2189 void OnDataAvailable() override { |
2190 while (HasBytesToRead()) { | 2190 while (HasBytesToRead()) { |
2191 struct iovec iov; | 2191 struct iovec iov; |
2192 if (GetReadableRegions(&iov, 1) == 0) { | 2192 if (GetReadableRegions(&iov, 1) == 0) { |
2193 // No more data to read. | 2193 // No more data to read. |
2194 break; | 2194 break; |
(...skipping 21 matching lines...) Expand all Loading... |
2216 | 2216 |
2217 class ServerStreamThatDropsBodyFactory : public QuicTestServer::StreamFactory { | 2217 class ServerStreamThatDropsBodyFactory : public QuicTestServer::StreamFactory { |
2218 public: | 2218 public: |
2219 ServerStreamThatDropsBodyFactory() {} | 2219 ServerStreamThatDropsBodyFactory() {} |
2220 | 2220 |
2221 ~ServerStreamThatDropsBodyFactory() override{}; | 2221 ~ServerStreamThatDropsBodyFactory() override{}; |
2222 | 2222 |
2223 QuicSimpleServerStream* CreateStream( | 2223 QuicSimpleServerStream* CreateStream( |
2224 QuicStreamId id, | 2224 QuicStreamId id, |
2225 QuicSpdySession* session, | 2225 QuicSpdySession* session, |
2226 QuicInMemoryCache* in_memory_cache) override { | 2226 QuicHttpResponseCache* response_cache) override { |
2227 return new ServerStreamThatDropsBody(id, session, in_memory_cache); | 2227 return new ServerStreamThatDropsBody(id, session, response_cache); |
2228 } | 2228 } |
2229 }; | 2229 }; |
2230 | 2230 |
2231 // A test server stream that sends response with body size greater than 4GB. | 2231 // A test server stream that sends response with body size greater than 4GB. |
2232 class ServerStreamThatSendsHugeResponse : public QuicSimpleServerStream { | 2232 class ServerStreamThatSendsHugeResponse : public QuicSimpleServerStream { |
2233 public: | 2233 public: |
2234 ServerStreamThatSendsHugeResponse(QuicStreamId id, | 2234 ServerStreamThatSendsHugeResponse(QuicStreamId id, |
2235 QuicSpdySession* session, | 2235 QuicSpdySession* session, |
2236 QuicInMemoryCache* in_memory_cache, | 2236 QuicHttpResponseCache* response_cache, |
2237 int64_t body_bytes) | 2237 int64_t body_bytes) |
2238 : QuicSimpleServerStream(id, session, in_memory_cache), | 2238 : QuicSimpleServerStream(id, session, response_cache), |
2239 body_bytes_(body_bytes) {} | 2239 body_bytes_(body_bytes) {} |
2240 | 2240 |
2241 ~ServerStreamThatSendsHugeResponse() override {} | 2241 ~ServerStreamThatSendsHugeResponse() override {} |
2242 | 2242 |
2243 protected: | 2243 protected: |
2244 void SendResponse() override { | 2244 void SendResponse() override { |
2245 QuicInMemoryCache::Response response; | 2245 QuicHttpResponseCache::Response response; |
2246 string body(body_bytes_, 'a'); | 2246 string body(body_bytes_, 'a'); |
2247 response.set_body(body); | 2247 response.set_body(body); |
2248 SendHeadersAndBodyAndTrailers(response.headers().Clone(), response.body(), | 2248 SendHeadersAndBodyAndTrailers(response.headers().Clone(), response.body(), |
2249 response.trailers().Clone()); | 2249 response.trailers().Clone()); |
2250 } | 2250 } |
2251 | 2251 |
2252 private: | 2252 private: |
2253 // Use a explicit int64_t rather than size_t to simulate a 64-bit server | 2253 // Use a explicit int64_t rather than size_t to simulate a 64-bit server |
2254 // talking to a 32-bit client. | 2254 // talking to a 32-bit client. |
2255 int64_t body_bytes_; | 2255 int64_t body_bytes_; |
2256 }; | 2256 }; |
2257 | 2257 |
2258 class ServerStreamThatSendsHugeResponseFactory | 2258 class ServerStreamThatSendsHugeResponseFactory |
2259 : public QuicTestServer::StreamFactory { | 2259 : public QuicTestServer::StreamFactory { |
2260 public: | 2260 public: |
2261 explicit ServerStreamThatSendsHugeResponseFactory(int64_t body_bytes) | 2261 explicit ServerStreamThatSendsHugeResponseFactory(int64_t body_bytes) |
2262 : body_bytes_(body_bytes) {} | 2262 : body_bytes_(body_bytes) {} |
2263 | 2263 |
2264 ~ServerStreamThatSendsHugeResponseFactory() override{}; | 2264 ~ServerStreamThatSendsHugeResponseFactory() override{}; |
2265 | 2265 |
2266 QuicSimpleServerStream* CreateStream( | 2266 QuicSimpleServerStream* CreateStream( |
2267 QuicStreamId id, | 2267 QuicStreamId id, |
2268 QuicSpdySession* session, | 2268 QuicSpdySession* session, |
2269 QuicInMemoryCache* in_memory_cache) override { | 2269 QuicHttpResponseCache* response_cache) override { |
2270 return new ServerStreamThatSendsHugeResponse(id, session, in_memory_cache, | 2270 return new ServerStreamThatSendsHugeResponse(id, session, response_cache, |
2271 body_bytes_); | 2271 body_bytes_); |
2272 } | 2272 } |
2273 | 2273 |
2274 int64_t body_bytes_; | 2274 int64_t body_bytes_; |
2275 }; | 2275 }; |
2276 | 2276 |
2277 // A test client stream that drops all received body. | 2277 // A test client stream that drops all received body. |
2278 class ClientStreamThatDropsBody : public QuicSpdyClientStream { | 2278 class ClientStreamThatDropsBody : public QuicSpdyClientStream { |
2279 public: | 2279 public: |
2280 ClientStreamThatDropsBody(QuicStreamId id, QuicClientSession* session) | 2280 ClientStreamThatDropsBody(QuicStreamId id, QuicClientSession* session) |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2477 const string kBody = "body content"; | 2477 const string kBody = "body content"; |
2478 | 2478 |
2479 SpdyHeaderBlock headers; | 2479 SpdyHeaderBlock headers; |
2480 headers[":status"] = "200"; | 2480 headers[":status"] = "200"; |
2481 headers[":version"] = "HTTP/1.1"; | 2481 headers[":version"] = "HTTP/1.1"; |
2482 headers["content-length"] = IntToString(kBody.size()); | 2482 headers["content-length"] = IntToString(kBody.size()); |
2483 | 2483 |
2484 SpdyHeaderBlock trailers; | 2484 SpdyHeaderBlock trailers; |
2485 trailers["some-trailing-header"] = "trailing-header-value"; | 2485 trailers["some-trailing-header"] = "trailing-header-value"; |
2486 | 2486 |
2487 in_memory_cache_.AddResponse(server_hostname_, "/trailer_url", | 2487 response_cache_.AddResponse(server_hostname_, "/trailer_url", |
2488 std::move(headers), kBody, trailers.Clone()); | 2488 std::move(headers), kBody, trailers.Clone()); |
2489 | 2489 |
2490 EXPECT_EQ(kBody, client_->SendSynchronousRequest("/trailer_url")); | 2490 EXPECT_EQ(kBody, client_->SendSynchronousRequest("/trailer_url")); |
2491 EXPECT_EQ("200", client_->response_headers()->find(":status")->second); | 2491 EXPECT_EQ("200", client_->response_headers()->find(":status")->second); |
2492 EXPECT_EQ(trailers, client_->response_trailers()); | 2492 EXPECT_EQ(trailers, client_->response_trailers()); |
2493 } | 2493 } |
2494 | 2494 |
2495 class EndToEndTestServerPush : public EndToEndTest { | 2495 class EndToEndTestServerPush : public EndToEndTest { |
2496 protected: | 2496 protected: |
2497 const size_t kNumMaxStreams = 10; | 2497 const size_t kNumMaxStreams = 10; |
2498 | 2498 |
(...skipping 16 matching lines...) Expand all Loading... |
2515 string* push_urls, | 2515 string* push_urls, |
2516 const size_t num_resources, | 2516 const size_t num_resources, |
2517 const size_t resource_size) { | 2517 const size_t resource_size) { |
2518 bool use_large_response = resource_size != 0; | 2518 bool use_large_response = resource_size != 0; |
2519 string large_resource; | 2519 string large_resource; |
2520 if (use_large_response) { | 2520 if (use_large_response) { |
2521 // Generate a response common body larger than flow control window for | 2521 // Generate a response common body larger than flow control window for |
2522 // push response. | 2522 // push response. |
2523 large_resource = string(resource_size, 'a'); | 2523 large_resource = string(resource_size, 'a'); |
2524 } | 2524 } |
2525 std::list<QuicInMemoryCache::ServerPushInfo> push_resources; | 2525 std::list<QuicHttpResponseCache::ServerPushInfo> push_resources; |
2526 for (size_t i = 0; i < num_resources; ++i) { | 2526 for (size_t i = 0; i < num_resources; ++i) { |
2527 string url = push_urls[i]; | 2527 string url = push_urls[i]; |
2528 GURL resource_url(url); | 2528 GURL resource_url(url); |
2529 string body = use_large_response | 2529 string body = use_large_response |
2530 ? large_resource | 2530 ? large_resource |
2531 : "This is server push response body for " + url; | 2531 : "This is server push response body for " + url; |
2532 SpdyHeaderBlock response_headers; | 2532 SpdyHeaderBlock response_headers; |
2533 response_headers[":version"] = "HTTP/1.1"; | 2533 response_headers[":version"] = "HTTP/1.1"; |
2534 response_headers[":status"] = "200"; | 2534 response_headers[":status"] = "200"; |
2535 response_headers["content-length"] = IntToString(body.size()); | 2535 response_headers["content-length"] = IntToString(body.size()); |
2536 push_resources.push_back(QuicInMemoryCache::ServerPushInfo( | 2536 push_resources.push_back(QuicHttpResponseCache::ServerPushInfo( |
2537 resource_url, std::move(response_headers), kV3LowestPriority, body)); | 2537 resource_url, std::move(response_headers), kV3LowestPriority, body)); |
2538 } | 2538 } |
2539 | 2539 |
2540 in_memory_cache_.AddSimpleResponseWithServerPushResources( | 2540 response_cache_.AddSimpleResponseWithServerPushResources( |
2541 host, path, 200, response_body, push_resources); | 2541 host, path, 200, response_body, push_resources); |
2542 } | 2542 } |
2543 }; | 2543 }; |
2544 | 2544 |
2545 // Run all server push end to end tests with all supported versions. | 2545 // Run all server push end to end tests with all supported versions. |
2546 INSTANTIATE_TEST_CASE_P(EndToEndTestsServerPush, | 2546 INSTANTIATE_TEST_CASE_P(EndToEndTestsServerPush, |
2547 EndToEndTestServerPush, | 2547 EndToEndTestServerPush, |
2548 ::testing::ValuesIn(GetTestParams())); | 2548 ::testing::ValuesIn(GetTestParams())); |
2549 | 2549 |
2550 TEST_P(EndToEndTestServerPush, ServerPush) { | 2550 TEST_P(EndToEndTestServerPush, ServerPush) { |
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2940 client_->WaitForResponse(); | 2940 client_->WaitForResponse(); |
2941 EXPECT_EQ(kBarResponseBody, client_->response_body()); | 2941 EXPECT_EQ(kBarResponseBody, client_->response_body()); |
2942 QuicConnectionStats client_stats = | 2942 QuicConnectionStats client_stats = |
2943 client_->client()->session()->connection()->GetStats(); | 2943 client_->client()->session()->connection()->GetStats(); |
2944 EXPECT_EQ(0u, client_stats.packets_lost); | 2944 EXPECT_EQ(0u, client_stats.packets_lost); |
2945 EXPECT_EQ(1, client_->client()->GetNumSentClientHellos()); | 2945 EXPECT_EQ(1, client_->client()->GetNumSentClientHellos()); |
2946 } | 2946 } |
2947 } // namespace | 2947 } // namespace |
2948 } // namespace test | 2948 } // namespace test |
2949 } // namespace net | 2949 } // namespace net |
OLD | NEW |