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

Unified Diff: net/tools/quic/end_to_end_test.cc

Issue 1911653003: Add a server push disabled test. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@119583512
Patch Set: Rebase Created 4 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 55e1bf43711c7b932491b296ddf5ea8c7e968610..fa56de6aeb1860efdb35bc528422b33ee71a8239 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);
}
@@ -520,6 +522,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.
@@ -2297,6 +2300,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
@@ -2544,6 +2548,38 @@ 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698