| Index: net/tools/quic/end_to_end_test.cc
|
| diff --git a/net/tools/quic/end_to_end_test.cc b/net/tools/quic/end_to_end_test.cc
|
| index e481330bfee15382be68ab9350e715a4cacac03b..f68dd0ea74b31f245498df704b6cc7123ef85b32 100644
|
| --- a/net/tools/quic/end_to_end_test.cc
|
| +++ b/net/tools/quic/end_to_end_test.cc
|
| @@ -254,7 +254,8 @@ class EndToEndTest : public ::testing::TestWithParam<TestParams> {
|
| server_started_(false),
|
| strike_register_no_startup_period_(false),
|
| chlo_multiplier_(0),
|
| - stream_factory_(nullptr) {
|
| + stream_factory_(nullptr),
|
| + support_server_push_(false) {
|
| client_supported_versions_ = GetParam().client_supported_versions;
|
| server_supported_versions_ = GetParam().server_supported_versions;
|
| negotiated_version_ = GetParam().negotiated_version;
|
| @@ -343,8 +344,9 @@ class EndToEndTest : public ::testing::TestWithParam<TestParams> {
|
| // TODO(nimia): Consider setting the congestion control algorithm for the
|
| // client as well according to the test parameter.
|
| copt.push_back(GetParam().congestion_control_tag);
|
| - copt.push_back(kSPSH);
|
| -
|
| + if (support_server_push_) {
|
| + copt.push_back(kSPSH);
|
| + }
|
| if (GetParam().client_supports_stateless_rejects) {
|
| copt.push_back(kSREJ);
|
| }
|
| @@ -523,6 +525,7 @@ class EndToEndTest : public ::testing::TestWithParam<TestParams> {
|
| bool strike_register_no_startup_period_;
|
| size_t chlo_multiplier_;
|
| QuicTestServer::StreamFactory* stream_factory_;
|
| + bool support_server_push_;
|
| };
|
|
|
| // Run all end to end tests with all supported versions.
|
| @@ -2300,6 +2303,7 @@ class EndToEndTestServerPush : public EndToEndTest {
|
| EndToEndTestServerPush() : EndToEndTest() {
|
| FLAGS_quic_supports_push_promise = true;
|
| client_config_.SetMaxStreamsPerConnection(kNumMaxStreams, kNumMaxStreams);
|
| + support_server_push_ = true;
|
| }
|
|
|
| // Add a request with its response and |num_resources| push resources into
|
| @@ -2547,6 +2551,37 @@ TEST_P(EndToEndTestServerPush, ServerPushOverLimitWithBlocking) {
|
| EXPECT_EQ(12u, client_->num_responses());
|
| }
|
|
|
| +TEST_P(EndToEndTestServerPush, DisabledWithoutConnectionOption) {
|
| + // Tests that server push won't be triggered when kSPSH is not set by client.
|
| + support_server_push_ = false;
|
| + ASSERT_TRUE(Initialize());
|
| +
|
| + // Add a response with headers, body, and push resources.
|
| + const string kBody = "body content";
|
| + size_t const kNumResources = 4;
|
| + string push_urls[] = {
|
| + "https://example.com/font.woff", "https://example.com/script.js",
|
| + "https://fonts.example.com/font.woff",
|
| + "https://example.com/logo-hires.jpg",
|
| + };
|
| + AddRequestAndResponseWithServerPush("example.com", "/push_example", kBody,
|
| + push_urls, kNumResources, 0);
|
| + client_->client()->set_response_listener(new TestResponseListener);
|
| + EXPECT_EQ(kBody, client_->SendSynchronousRequest(
|
| + "https://example.com/push_example"));
|
| +
|
| + for (const string& url : push_urls) {
|
| + // Sending subsequent requests will trigger sending real requests because
|
| + // client doesn't support server push.
|
| + const string expected_body = "This is server push response body for " + url;
|
| + const string response_body = client_->SendSynchronousRequest(url);
|
| + EXPECT_EQ(expected_body, response_body);
|
| + }
|
| + // Same number of requests are sent as that of responses received.
|
| + EXPECT_EQ(1 + kNumResources, client_->num_requests());
|
| + EXPECT_EQ(1 + kNumResources, client_->num_responses());
|
| +}
|
| +
|
| // TODO(fayang): this test seems to cause net_unittests timeouts :|
|
| TEST_P(EndToEndTest, DISABLED_TestHugePostWithPacketLoss) {
|
| // This test tests a huge post with introduced packet loss from client to
|
|
|