[go: nahoru, domu]

Check full proxy chains in QUIC network transaction tests + clean-up

This CL updates several QUIC network transaction tests so that the
full proxy chain is checked instead of only checking the scheme of
the first proxy server. This will enable tests of multi-proxy chains
for IP Protection in the future. Decoupling the helper methods from
the type of proxy chain used also allows more tests to use them.

Also, this CL has some other no-op changes / clean-up:
 - Adds a new SendRequestAndExpectSpdyResponseFromProxy method
 - Refactors response data into const variables when it’s used in
   a check later. A convention seems to be that "hello!" is used
   for QUIC response data and "hello world" is used for HTTP
   response data, so this has been preserved in the naming of the
   variables.
 - Updates naming of several other const variables
 - Removes some unneeded code / comments

Bug: 1491092
Change-Id: Ic74efcb35ae4f4035b2492d29a6eca4c2b9b725c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5245174
Reviewed-by: Bence Béky <bnc@chromium.org>
Commit-Queue: Andrew Williams <awillia@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1254684}
diff --git a/net/quic/quic_network_transaction_unittest.cc b/net/quic/quic_network_transaction_unittest.cc
index 0eb30bb9..df237d9 100644
--- a/net/quic/quic_network_transaction_unittest.cc
+++ b/net/quic/quic_network_transaction_unittest.cc
@@ -5,6 +5,7 @@
 #include <algorithm>
 #include <ostream>
 #include <string>
+#include <string_view>
 #include <utility>
 #include <vector>
 
@@ -14,7 +15,6 @@
 #include "base/run_loop.h"
 #include "base/strings/strcat.h"
 #include "base/strings/string_number_conversions.h"
-#include "base/strings/string_piece.h"
 #include "base/strings/stringprintf.h"
 #include "base/test/metrics/histogram_tester.h"
 #include "base/test/scoped_feature_list.h"
@@ -115,6 +115,15 @@
 const char kDefaultServerHostName[] = "mail.example.org";
 const char kDifferentHostname[] = "different.example.com";
 
+constexpr std::string_view kQuic200RespStatusLine = "HTTP/1.1 200";
+
+// Response data used for QUIC requests in multiple tests.
+constexpr std::string_view kQuicRespData = "hello!";
+// Response data used for HTTP requests in multiple tests.
+// TODO(https://crbug.com/1523631): Once MockReadWrite accepts a
+// std::string_view parameter, we can use "constexpr std::string_view" for this.
+const char kHttpRespData[] = "hello world";
+
 struct TestParams {
   quic::ParsedQuicVersion version;
   bool priority_header_enabled;
@@ -208,11 +217,11 @@
   return params;
 }
 
-std::string ConstructDataFrameForVersion(base::StringPiece body,
+std::string ConstructDataFrameForVersion(std::string_view body,
                                          quic::ParsedQuicVersion version) {
   quiche::QuicheBuffer buffer = quic::HttpEncoder::SerializeDataFrameHeader(
       body.size(), quiche::SimpleBufferAllocator::Get());
-  return base::StrCat({base::StringPiece(buffer.data(), buffer.size()), body});
+  return base::StrCat({std::string_view(buffer.data(), buffer.size()), body});
 }
 
 }  // namespace
@@ -552,7 +561,7 @@
         packet_number, stream_id, fin, std::move(headers), nullptr);
   }
 
-  std::string ConstructDataFrame(base::StringPiece body) {
+  std::string ConstructDataFrame(std::string_view body) {
     return ConstructDataFrameForVersion(body, version_);
   }
 
@@ -587,7 +596,7 @@
   void CreateSession() { return CreateSession(supported_versions_); }
 
   void CheckWasQuicResponse(HttpNetworkTransaction* trans,
-                            const std::string& status_line,
+                            std::string_view status_line,
                             const quic::ParsedQuicVersion& version) {
     const HttpResponseInfo* response = trans->GetResponseInfo();
     ASSERT_TRUE(response != nullptr);
@@ -615,12 +624,12 @@
   }
 
   void CheckWasQuicResponse(HttpNetworkTransaction* trans,
-                            const std::string& status_line) {
+                            std::string_view status_line) {
     CheckWasQuicResponse(trans, status_line, version_);
   }
 
   void CheckWasQuicResponse(HttpNetworkTransaction* trans) {
-    CheckWasQuicResponse(trans, "HTTP/1.1 200", version_);
+    CheckWasQuicResponse(trans, kQuic200RespStatusLine, version_);
   }
 
   void CheckResponsePort(HttpNetworkTransaction* trans, uint16_t port) {
@@ -643,26 +652,20 @@
     const HttpResponseInfo* response = trans->GetResponseInfo();
     ASSERT_TRUE(response != nullptr);
     ASSERT_TRUE(response->headers.get() != nullptr);
-    EXPECT_EQ("HTTP/1.1 200", response->headers->GetStatusLine());
+    // SPDY and QUIC use the same 200 response format.
+    EXPECT_EQ(kQuic200RespStatusLine, response->headers->GetStatusLine());
     EXPECT_TRUE(response->was_fetched_via_spdy);
     EXPECT_TRUE(response->was_alpn_negotiated);
     EXPECT_EQ(HttpConnectionInfo::kHTTP2, response->connection_info);
   }
 
   void CheckResponseData(HttpNetworkTransaction* trans,
-                         const std::string& expected) {
+                         std::string_view expected) {
     std::string response_data;
     ASSERT_THAT(ReadTransaction(trans, &response_data), IsOk());
     EXPECT_EQ(expected, response_data);
   }
 
-  void CheckUsedQuicProxyServer(HttpNetworkTransaction* trans) {
-    const ProxyChain& proxy_chain = trans->GetResponseInfo()->proxy_chain;
-    EXPECT_TRUE(proxy_chain.IsValid());
-    ASSERT_FALSE(proxy_chain.is_direct());
-    EXPECT_TRUE(proxy_chain.GetProxyServer(/*chain_index=*/0).is_quic());
-  }
-
   void RunTransaction(HttpNetworkTransaction* trans) {
     TestCompletionCallback callback;
     int rv = trans->Start(&request_, callback.callback(), net_log_with_source_);
@@ -670,44 +673,58 @@
     EXPECT_THAT(callback.WaitForResult(), IsOk());
   }
 
-  void SendRequestAndExpectHttpResponse(const std::string& expected) {
+  void SendRequestAndExpectHttpResponse(std::string_view expected) {
     HttpNetworkTransaction trans(DEFAULT_PRIORITY, session_.get());
     RunTransaction(&trans);
     CheckWasHttpResponse(&trans);
     CheckResponseData(&trans, expected);
   }
 
-  void SendRequestAndExpectHttpResponseFromProxy(const std::string& expected,
-                                                 bool used_proxy,
-                                                 uint16_t port) {
+  void SendRequestAndExpectHttpResponseFromProxy(
+      std::string_view expected,
+      uint16_t port,
+      const ProxyChain& proxy_chain) {
     HttpNetworkTransaction trans(DEFAULT_PRIORITY, session_.get());
     RunTransaction(&trans);
     CheckWasHttpResponse(&trans);
     CheckResponsePort(&trans, port);
     CheckResponseData(&trans, expected);
-    if (used_proxy) {
-      const ProxyChain& proxy_chain = trans.GetResponseInfo()->proxy_chain;
-      EXPECT_TRUE(proxy_chain.IsValid());
-      ASSERT_FALSE(proxy_chain.is_direct());
-      EXPECT_TRUE(proxy_chain.GetProxyServer(/*chain_index=*/0).is_https());
-    } else {
-      EXPECT_TRUE(trans.GetResponseInfo()->proxy_chain.is_direct());
-    }
-  }
-  void SendRequestAndExpectQuicResponse(const std::string& expected,
-                                        const std::string& status_line) {
-    SendRequestAndExpectQuicResponseMaybeFromProxy(expected, false, 443,
-                                                   status_line);
+    EXPECT_EQ(trans.GetResponseInfo()->proxy_chain, proxy_chain);
+    ASSERT_TRUE(proxy_chain.IsValid());
+    ASSERT_FALSE(proxy_chain.is_direct());
   }
 
-  void SendRequestAndExpectQuicResponse(const std::string& expected) {
-    SendRequestAndExpectQuicResponseMaybeFromProxy(expected, false, 443);
+  void SendRequestAndExpectSpdyResponseFromProxy(
+      std::string_view expected,
+      uint16_t port,
+      const ProxyChain& proxy_chain) {
+    HttpNetworkTransaction trans(DEFAULT_PRIORITY, session_.get());
+    RunTransaction(&trans);
+    CheckWasSpdyResponse(&trans);
+    CheckResponsePort(&trans, port);
+    CheckResponseData(&trans, expected);
+    EXPECT_EQ(trans.GetResponseInfo()->proxy_chain, proxy_chain);
+    ASSERT_TRUE(proxy_chain.IsValid());
+    ASSERT_FALSE(proxy_chain.is_direct());
+  }
+
+  void SendRequestAndExpectQuicResponse(std::string_view expected,
+                                        std::string_view status_line) {
+    SendRequestAndExpectQuicResponseMaybeFromProxy(expected, 443, status_line,
+                                                   version_, std::nullopt);
+  }
+
+  void SendRequestAndExpectQuicResponse(std::string_view expected) {
+    SendRequestAndExpectQuicResponseMaybeFromProxy(
+        expected, 443, kQuic200RespStatusLine, version_, std::nullopt);
   }
 
   void SendRequestAndExpectQuicResponseFromProxyOnPort(
-      const std::string& expected,
-      uint16_t port) {
-    SendRequestAndExpectQuicResponseMaybeFromProxy(expected, true, port);
+      std::string_view expected,
+      uint16_t port,
+      const ProxyChain& proxy_chain) {
+    SendRequestAndExpectQuicResponseMaybeFromProxy(
+        expected, port, kQuic200RespStatusLine, version_, proxy_chain);
   }
 
   void AddQuicAlternateProtocolMapping(
@@ -893,18 +910,20 @@
   }
 
   void SendRequestAndExpectQuicResponseMaybeFromProxy(
-      const std::string& expected,
-      bool used_proxy,
+      std::string_view expected,
       uint16_t port,
-      const std::string& status_line,
-      const quic::ParsedQuicVersion& version) {
+      std::string_view status_line,
+      const quic::ParsedQuicVersion& version,
+      std::optional<ProxyChain> proxy_chain) {
     HttpNetworkTransaction trans(DEFAULT_PRIORITY, session_.get());
     RunTransaction(&trans);
     CheckWasQuicResponse(&trans, status_line, version);
     CheckResponsePort(&trans, port);
     CheckResponseData(&trans, expected);
-    if (used_proxy) {
-      CheckUsedQuicProxyServer(&trans);
+    if (proxy_chain.has_value()) {
+      EXPECT_EQ(trans.GetResponseInfo()->proxy_chain, *proxy_chain);
+      ASSERT_TRUE(proxy_chain->IsValid());
+      ASSERT_FALSE(proxy_chain->is_direct());
       // DNS aliases should be empty when using a proxy.
       EXPECT_TRUE(trans.GetResponseInfo()->dns_aliases.empty());
     } else {
@@ -982,24 +1001,6 @@
   SSLSocketDataProvider ssl_data_;
   std::unique_ptr<ScopedMockNetworkChangeNotifier> scoped_mock_change_notifier_;
   base::test::ScopedFeatureList feature_list_;
-
- private:
-  void SendRequestAndExpectQuicResponseMaybeFromProxy(
-      const std::string& expected,
-      bool used_proxy,
-      uint16_t port,
-      const std::string& status_line) {
-    SendRequestAndExpectQuicResponseMaybeFromProxy(expected, used_proxy, port,
-                                                   status_line, version_);
-  }
-
-  void SendRequestAndExpectQuicResponseMaybeFromProxy(
-      const std::string& expected,
-      bool used_proxy,
-      uint16_t port) {
-    SendRequestAndExpectQuicResponseMaybeFromProxy(expected, used_proxy, port,
-                                                   "HTTP/1.1 200", version_);
-  }
 };
 
 INSTANTIATE_TEST_SUITE_P(VersionIncludeStreamDependencySequence,
@@ -1087,7 +1088,7 @@
   mock_quic_data.AddRead(
       ASYNC, ConstructServerDataPacket(
                  2, GetNthClientInitiatedBidirectionalStreamId(0), true,
-                 ConstructDataFrame("hello!")));
+                 ConstructDataFrame(kQuicRespData)));
   mock_quic_data.AddWrite(SYNCHRONOUS,
                           ConstructClientAckPacket(packet_num++, 2, 1));
   mock_quic_data.AddRead(SYNCHRONOUS, ERR_IO_PENDING);  // No more data to read
@@ -1099,7 +1100,7 @@
 
   EXPECT_FALSE(
       test_socket_performance_watcher_factory_.rtt_notification_received());
-  SendRequestAndExpectQuicResponse("hello!");
+  SendRequestAndExpectQuicResponse(kQuicRespData);
   EXPECT_TRUE(
       test_socket_performance_watcher_factory_.rtt_notification_received());
 }
@@ -1124,7 +1125,7 @@
   mock_quic_data.AddRead(
       ASYNC, ConstructServerDataPacket(
                  2, GetNthClientInitiatedBidirectionalStreamId(0), true,
-                 ConstructDataFrame("hello!")));
+                 ConstructDataFrame(kQuicRespData)));
   mock_quic_data.AddWrite(SYNCHRONOUS,
                           ConstructClientAckPacket(packet_num++, 2, 1));
   mock_quic_data.AddRead(SYNCHRONOUS, ERR_IO_PENDING);  // No more data to read
@@ -1136,7 +1137,7 @@
 
   EXPECT_FALSE(
       test_socket_performance_watcher_factory_.rtt_notification_received());
-  SendRequestAndExpectQuicResponse("hello!");
+  SendRequestAndExpectQuicResponse(kQuicRespData);
   EXPECT_FALSE(
       test_socket_performance_watcher_factory_.rtt_notification_received());
 }
@@ -1161,7 +1162,7 @@
   mock_quic_data.AddRead(
       ASYNC, ConstructServerDataPacket(
                  2, GetNthClientInitiatedBidirectionalStreamId(0), true,
-                 ConstructDataFrame("hello!")));
+                 ConstructDataFrame(kQuicRespData)));
   mock_quic_data.AddWrite(SYNCHRONOUS,
                           ConstructClientAckPacket(packet_num++, 2, 1));
   mock_quic_data.AddRead(SYNCHRONOUS, ERR_IO_PENDING);  // No more data to read
@@ -1170,7 +1171,7 @@
 
   CreateSession();
 
-  SendRequestAndExpectQuicResponse("hello!");
+  SendRequestAndExpectQuicResponse(kQuicRespData);
 
   // Check that the NetLog was filled reasonably.
   auto entries = net_log_observer_.GetEntries();
@@ -1304,7 +1305,7 @@
   mock_quic_data.AddRead(
       ASYNC, ConstructServerDataPacket(
                  packet_number, GetNthClientInitiatedBidirectionalStreamId(0),
-                 true, ConstructDataFrame("hello!")));
+                 true, ConstructDataFrame(kQuicRespData)));
   mock_quic_data.AddRead(SYNCHRONOUS, ERR_IO_PENDING);  // No more data to read
   mock_quic_data.AddWrite(ASYNC, ConstructClientAckPacket(packet_num++, 2, 1));
   mock_quic_data.AddWrite(
@@ -1314,7 +1315,7 @@
 
   CreateSession();
 
-  SendRequestAndExpectQuicResponse("hello!");
+  SendRequestAndExpectQuicResponse(kQuicRespData);
   EXPECT_TRUE(mock_quic_data.AllReadDataConsumed());
   EXPECT_TRUE(mock_quic_data.AllWriteDataConsumed());
 }
@@ -1451,7 +1452,7 @@
   mock_quic_data.AddRead(
       ASYNC, ConstructServerDataPacket(
                  2, GetNthClientInitiatedBidirectionalStreamId(0), true,
-                 ConstructDataFrame("hello!")));
+                 ConstructDataFrame(kQuicRespData)));
   mock_quic_data.AddWrite(SYNCHRONOUS,
                           ConstructClientAckPacket(packet_num++, 2, 1));
   mock_quic_data.AddRead(SYNCHRONOUS, ERR_IO_PENDING);  // No more data to read
@@ -1460,7 +1461,7 @@
 
   CreateSession();
 
-  SendRequestAndExpectQuicResponse("hello!");
+  SendRequestAndExpectQuicResponse(kQuicRespData);
   EXPECT_TRUE(
       test_socket_performance_watcher_factory_.rtt_notification_received());
 }
@@ -1487,7 +1488,7 @@
   mock_quic_data.AddRead(
       ASYNC, ConstructServerDataPacket(
                  2, GetNthClientInitiatedBidirectionalStreamId(0), true,
-                 ConstructDataFrame("hello!")));
+                 ConstructDataFrame(kQuicRespData)));
   mock_quic_data.AddWrite(SYNCHRONOUS,
                           ConstructClientAckPacket(packet_num++, 2, 1));
   mock_quic_data.AddRead(SYNCHRONOUS, ERR_IO_PENDING);  // No more data to read
@@ -1496,16 +1497,18 @@
 
   CreateSession();
 
-  SendRequestAndExpectQuicResponse("hello!", "HTTP/1.1 408");
+  SendRequestAndExpectQuicResponse(kQuicRespData, "HTTP/1.1 408");
 }
 
 TEST_P(QuicNetworkTransactionTest, QuicProxy) {
   session_params_.enable_quic = true;
+
+  const auto kQuicProxyChain =
+      ProxyChain::ForIpProtection({ProxyServer::FromSchemeHostAndPort(
+          ProxyServer::SCHEME_QUIC, "mail.example.org", 70)});
   proxy_resolution_service_ =
       ConfiguredProxyResolutionService::CreateFixedFromProxyChainsForTest(
-          {ProxyChain::ForIpProtection({ProxyServer::FromSchemeHostAndPort(
-              ProxyServer::SCHEME_QUIC, "mail.example.org", 70)})},
-          TRAFFIC_ANNOTATION_FOR_TESTS);
+          {kQuicProxyChain}, TRAFFIC_ANNOTATION_FOR_TESTS);
 
   MockQuicData mock_quic_data(version_);
   int packet_num = 1;
@@ -1523,7 +1526,7 @@
   mock_quic_data.AddRead(
       ASYNC, ConstructServerDataPacket(
                  2, GetNthClientInitiatedBidirectionalStreamId(0), true,
-                 ConstructDataFrame("hello!")));
+                 ConstructDataFrame(kQuicRespData)));
   mock_quic_data.AddWrite(SYNCHRONOUS,
                           ConstructClientAckPacket(packet_num++, 2, 1));
   mock_quic_data.AddRead(ASYNC, ERR_IO_PENDING);  // No more data to read
@@ -1539,7 +1542,10 @@
   request_.url = GURL("http://mail.example.org/");
   CreateSession();
 
-  SendRequestAndExpectQuicResponseFromProxyOnPort("hello!", 70);
+  SendRequestAndExpectQuicResponseFromProxyOnPort(
+      kQuicRespData,
+      kQuicProxyChain.GetProxyServer(/*chain_index=*/0).GetPort(),
+      kQuicProxyChain);
   EXPECT_TRUE(
       test_socket_performance_watcher_factory_.rtt_notification_received());
 }
@@ -1548,17 +1554,19 @@
 // connection through a QUIC proxy, the certificate exhibited by the proxy is
 // checked against the proxy hostname, not the origin hostname.
 TEST_P(QuicNetworkTransactionTest, QuicProxyWithCert) {
-  const std::string origin_host = "mail.example.com";
-  const std::string proxy_host = "www.example.org";
+  const std::string kOriginHost = "mail.example.com";
+  const std::string kProxyHost = "proxy.example.org";
 
   session_params_.enable_quic = true;
+  const auto kQuicProxyChain =
+      ProxyChain::ForIpProtection({ProxyServer::FromSchemeHostAndPort(
+          ProxyServer::SCHEME_QUIC, kProxyHost, 70)});
   proxy_resolution_service_ =
       ConfiguredProxyResolutionService::CreateFixedFromProxyChainsForTest(
-          {ProxyChain::ForIpProtection({ProxyServer::FromSchemeHostAndPort(
-              ProxyServer::SCHEME_QUIC, proxy_host, 70)})},
-          TRAFFIC_ANNOTATION_FOR_TESTS);
+          {kQuicProxyChain}, TRAFFIC_ANNOTATION_FOR_TESTS);
 
-  client_maker_->set_hostname(origin_host);
+  client_maker_->set_hostname(kOriginHost);
+
   MockQuicData mock_quic_data(version_);
   int packet_num = 1;
   mock_quic_data.AddWrite(SYNCHRONOUS,
@@ -1575,7 +1583,7 @@
   mock_quic_data.AddRead(
       ASYNC, ConstructServerDataPacket(
                  2, GetNthClientInitiatedBidirectionalStreamId(0), true,
-                 ConstructDataFrame("hello!")));
+                 ConstructDataFrame(kQuicRespData)));
   mock_quic_data.AddWrite(SYNCHRONOUS,
                           ConstructClientAckPacket(packet_num++, 2, 1));
   mock_quic_data.AddRead(ASYNC, ERR_IO_PENDING);  // No more data to read
@@ -1586,8 +1594,8 @@
       ImportCertFromFile(GetTestCertsDirectory(), "wildcard.pem"));
   ASSERT_TRUE(cert.get());
   // This certificate is valid for the proxy, but not for the origin.
-  EXPECT_TRUE(cert->VerifyNameMatch(proxy_host));
-  EXPECT_FALSE(cert->VerifyNameMatch(origin_host));
+  EXPECT_TRUE(cert->VerifyNameMatch(kProxyHost));
+  EXPECT_FALSE(cert->VerifyNameMatch(kOriginHost));
   ProofVerifyDetailsChromium verify_details;
   verify_details.cert_verify_result.verified_cert = cert;
   crypto_client_stream_factory_.AddProofVerifyDetails(&verify_details);
@@ -1595,11 +1603,14 @@
   verify_details2.cert_verify_result.verified_cert = cert;
   crypto_client_stream_factory_.AddProofVerifyDetails(&verify_details2);
 
-  request_.url = GURL("http://" + origin_host);
+  request_.url = GURL("http://" + kOriginHost);
   AddHangingNonAlternateProtocolSocketData();
   CreateSession();
   AddQuicAlternateProtocolMapping(MockCryptoClientStream::CONFIRM_HANDSHAKE);
-  SendRequestAndExpectQuicResponseFromProxyOnPort("hello!", 70);
+  SendRequestAndExpectQuicResponseFromProxyOnPort(
+      kQuicRespData,
+      kQuicProxyChain.GetProxyServer(/*chain_index=*/0).GetPort(),
+      kQuicProxyChain);
 }
 
 TEST_P(QuicNetworkTransactionTest, AlternativeServicesDifferentHost) {
@@ -1637,7 +1648,7 @@
   mock_quic_data.AddRead(
       ASYNC, ConstructServerDataPacket(
                  2, GetNthClientInitiatedBidirectionalStreamId(0), true,
-                 ConstructDataFrame("hello!")));
+                 ConstructDataFrame(kQuicRespData)));
   mock_quic_data.AddWrite(SYNCHRONOUS,
                           ConstructClientAckPacket(packet_num++, 2, 1));
   mock_quic_data.AddRead(ASYNC, ERR_IO_PENDING);  // No more data to read
@@ -1650,7 +1661,7 @@
   AddHangingNonAlternateProtocolSocketData();
   CreateSession();
 
-  SendRequestAndExpectQuicResponse("hello!");
+  SendRequestAndExpectQuicResponse(kQuicRespData);
 }
 
 TEST_P(QuicNetworkTransactionTest, DoNotUseQuicForUnsupportedVersion) {
@@ -1700,7 +1711,7 @@
       MockRead("HTTP/1.1 200 OK\r\n"),
       MockRead(altsvc_header.c_str()),
       MockRead("\r\n"),
-      MockRead("hello world"),
+      MockRead(kHttpRespData),
       MockRead(SYNCHRONOUS, ERR_TEST_PEER_CLOSE_AFTER_NEXT_MOCK_READ),
       MockRead(ASYNC, OK)};
 
@@ -1727,7 +1738,7 @@
   mock_quic_data.AddRead(
       ASYNC, ConstructServerDataPacket(
                  2, GetNthClientInitiatedBidirectionalStreamId(0), true,
-                 ConstructDataFrame("hello!")));
+                 ConstructDataFrame(kQuicRespData)));
   mock_quic_data.AddWrite(SYNCHRONOUS,
                           ConstructClientAckPacket(packet_num++, 2, 1));
   mock_quic_data.AddRead(ASYNC, ERR_IO_PENDING);  // No more data to read
@@ -1739,8 +1750,8 @@
 
   CreateSession(supported_versions_);
 
-  SendRequestAndExpectHttpResponse("hello world");
-  SendRequestAndExpectQuicResponse("hello!");
+  SendRequestAndExpectHttpResponse(kHttpRespData);
+  SendRequestAndExpectQuicResponse(kQuicRespData);
 
   // Check alternative service list is updated with new versions.
   alt_svc_info_vector =
@@ -1800,7 +1811,8 @@
                         MockWrite(ASYNC, 1, "Host: mail.example.org\r\n"),
                         MockWrite(ASYNC, 2, "Connection: keep-alive\r\n\r\n")};
   MockRead reads[] = {MockRead(ASYNC, 3, "HTTP/1.1 200 OK\r\n\r\n"),
-                      MockRead(ASYNC, 4, "hello!"), MockRead(ASYNC, OK, 5)};
+                      MockRead(ASYNC, 4, kHttpRespData),
+                      MockRead(ASYNC, OK, 5)};
   SequencedSocketData http_data(MockConnect(ASYNC, ERR_IO_PENDING) /* pause */,
                                 reads, writes);
   socket_factory_.AddSocketDataProvider(&http_data);
@@ -1827,7 +1839,7 @@
   EXPECT_THAT(callback.WaitForResult(), IsOk());
   CheckWasHttpResponse(&trans);
   CheckResponsePort(&trans, 443);
-  CheckResponseData(&trans, "hello!");
+  CheckResponseData(&trans, kHttpRespData);
 }
 
 TEST_P(QuicNetworkTransactionTest, ForceQuicWithErrorConnecting) {
@@ -1870,7 +1882,7 @@
       HostPortPair::FromString("www.google.com:443"));
 
   MockRead http_reads[] = {
-      MockRead("HTTP/1.1 200 OK\r\n\r\n"), MockRead("hello world"),
+      MockRead("HTTP/1.1 200 OK\r\n\r\n"), MockRead(kHttpRespData),
       MockRead(SYNCHRONOUS, ERR_TEST_PEER_CLOSE_AFTER_NEXT_MOCK_READ),
       MockRead(ASYNC, OK)};
 
@@ -1881,7 +1893,7 @@
 
   CreateSession();
 
-  SendRequestAndExpectHttpResponse("hello world");
+  SendRequestAndExpectHttpResponse(kHttpRespData);
   EXPECT_EQ(0U, test_socket_performance_watcher_factory_.watcher_count());
 }
 
@@ -1892,7 +1904,7 @@
   }
   MockRead http_reads[] = {
       MockRead("HTTP/1.1 200 OK\r\n"), MockRead(alt_svc_header_.data()),
-      MockRead("hello world"),
+      MockRead(kHttpRespData),
       MockRead(SYNCHRONOUS, ERR_TEST_PEER_CLOSE_AFTER_NEXT_MOCK_READ),
       MockRead(ASYNC, OK)};
 
@@ -1917,7 +1929,7 @@
   mock_quic_data.AddRead(
       ASYNC, ConstructServerDataPacket(
                  2, GetNthClientInitiatedBidirectionalStreamId(0), true,
-                 ConstructDataFrame("hello!")));
+                 ConstructDataFrame(kQuicRespData)));
   mock_quic_data.AddWrite(SYNCHRONOUS,
                           ConstructClientAckPacket(packet_num++, 2, 1));
   mock_quic_data.AddRead(ASYNC, ERR_IO_PENDING);  // No more data to read
@@ -1928,8 +1940,8 @@
   AddHangingNonAlternateProtocolSocketData();
   CreateSession();
 
-  SendRequestAndExpectHttpResponse("hello world");
-  SendRequestAndExpectQuicResponse("hello!");
+  SendRequestAndExpectHttpResponse(kHttpRespData);
+  SendRequestAndExpectQuicResponse(kQuicRespData);
 }
 
 TEST_P(QuicNetworkTransactionTest, UseIetfAlternativeServiceForQuic) {
@@ -1941,7 +1953,7 @@
       "Alt-Svc: " + quic::AlpnForVersion(version_) + "=\":443\"\r\n\r\n";
   MockRead http_reads[] = {
       MockRead("HTTP/1.1 200 OK\r\n"), MockRead(alt_svc_header.data()),
-      MockRead("hello world"),
+      MockRead(kHttpRespData),
       MockRead(SYNCHRONOUS, ERR_TEST_PEER_CLOSE_AFTER_NEXT_MOCK_READ),
       MockRead(ASYNC, OK)};
 
@@ -1966,7 +1978,7 @@
   mock_quic_data.AddRead(
       ASYNC, ConstructServerDataPacket(
                  2, GetNthClientInitiatedBidirectionalStreamId(0), true,
-                 ConstructDataFrame("hello!")));
+                 ConstructDataFrame(kQuicRespData)));
   mock_quic_data.AddWrite(SYNCHRONOUS,
                           ConstructClientAckPacket(packet_num++, 2, 1));
   mock_quic_data.AddRead(ASYNC, ERR_IO_PENDING);  // No more data to read
@@ -1977,8 +1989,8 @@
   AddHangingNonAlternateProtocolSocketData();
   CreateSession();
 
-  SendRequestAndExpectHttpResponse("hello world");
-  SendRequestAndExpectQuicResponse("hello!");
+  SendRequestAndExpectHttpResponse(kHttpRespData);
+  SendRequestAndExpectQuicResponse(kQuicRespData);
 }
 
 // Much like above, but makes sure NetworkAnonymizationKey is respected.
@@ -2011,7 +2023,7 @@
 
   MockRead http_reads[] = {
       MockRead("HTTP/1.1 200 OK\r\n"), MockRead(alt_svc_header_.data()),
-      MockRead("hello world"),
+      MockRead(kHttpRespData),
       MockRead(SYNCHRONOUS, ERR_TEST_PEER_CLOSE_AFTER_NEXT_MOCK_READ),
       MockRead(ASYNC, OK)};
 
@@ -2050,7 +2062,7 @@
   mock_quic_data.AddRead(
       ASYNC, ConstructServerDataPacket(
                  2, GetNthClientInitiatedBidirectionalStreamId(0), true,
-                 ConstructDataFrame("hello!")));
+                 ConstructDataFrame(kQuicRespData)));
   mock_quic_data.AddWrite(SYNCHRONOUS,
                           ConstructClientAckPacket(packet_num++, 2, 1));
   mock_quic_data.AddRead(ASYNC, ERR_IO_PENDING);  // No more data to read
@@ -2066,19 +2078,19 @@
   // empty one.
   request_.network_isolation_key = NetworkIsolationKey();
   request_.network_anonymization_key = NetworkAnonymizationKey();
-  SendRequestAndExpectHttpResponse("hello world");
+  SendRequestAndExpectHttpResponse(kHttpRespData);
   request_.network_isolation_key = kNetworkIsolationKey1;
   request_.network_anonymization_key = kNetworkAnonymizationKey1;
-  SendRequestAndExpectHttpResponse("hello world");
+  SendRequestAndExpectHttpResponse(kHttpRespData);
   request_.network_isolation_key = kNetworkIsolationKey2;
   request_.network_anonymization_key = kNetworkAnonymizationKey2;
-  SendRequestAndExpectHttpResponse("hello world");
+  SendRequestAndExpectHttpResponse(kHttpRespData);
 
   // Only use QUIC when using a NetworkAnonymizationKey which has been used when
   // alternative service information was received.
   request_.network_isolation_key = kNetworkIsolationKey1;
   request_.network_anonymization_key = kNetworkAnonymizationKey1;
-  SendRequestAndExpectQuicResponse("hello!");
+  SendRequestAndExpectQuicResponse(kQuicRespData);
 }
 
 TEST_P(QuicNetworkTransactionTest, UseAlternativeServiceWithVersionForQuic1) {
@@ -2125,7 +2137,7 @@
 
   MockRead http_reads[] = {
       MockRead("HTTP/1.1 200 OK\r\n"),
-      MockRead(QuicAltSvcWithVersionHeader.c_str()), MockRead("hello world"),
+      MockRead(QuicAltSvcWithVersionHeader.c_str()), MockRead(kHttpRespData),
       MockRead(SYNCHRONOUS, ERR_TEST_PEER_CLOSE_AFTER_NEXT_MOCK_READ),
       MockRead(ASYNC, OK)};
 
@@ -2150,7 +2162,7 @@
   mock_quic_data.AddRead(
       ASYNC, ConstructServerDataPacket(
                  2, GetNthClientInitiatedBidirectionalStreamId(0), true,
-                 ConstructDataFrame("hello!")));
+                 ConstructDataFrame(kQuicRespData)));
   mock_quic_data.AddWrite(SYNCHRONOUS,
                           ConstructClientAckPacket(packet_num++, 2, 1));
   mock_quic_data.AddRead(ASYNC, ERR_IO_PENDING);  // No more data to read
@@ -2161,8 +2173,8 @@
   AddHangingNonAlternateProtocolSocketData();
   CreateSession(supported_versions_);
 
-  SendRequestAndExpectHttpResponse("hello world");
-  SendRequestAndExpectQuicResponse("hello!");
+  SendRequestAndExpectHttpResponse(kHttpRespData);
+  SendRequestAndExpectQuicResponse(kQuicRespData);
 }
 
 TEST_P(QuicNetworkTransactionTest,
@@ -2205,7 +2217,7 @@
 
   MockRead http_reads[] = {
       MockRead("HTTP/1.1 200 OK\r\n"),
-      MockRead(QuicAltSvcWithVersionHeader.c_str()), MockRead("hello world"),
+      MockRead(QuicAltSvcWithVersionHeader.c_str()), MockRead(kHttpRespData),
       MockRead(SYNCHRONOUS, ERR_TEST_PEER_CLOSE_AFTER_NEXT_MOCK_READ),
       MockRead(ASYNC, OK)};
 
@@ -2249,7 +2261,7 @@
   mock_quic_data.AddRead(
       ASYNC, server_maker.MakeDataPacket(
                  2, client_stream_0, true,
-                 ConstructDataFrameForVersion("hello!", picked_version)));
+                 ConstructDataFrameForVersion(kQuicRespData, picked_version)));
   mock_quic_data.AddWrite(SYNCHRONOUS,
                           ConstructClientAckPacket(packet_num++, 2, 1));
   mock_quic_data.AddRead(ASYNC, ERR_IO_PENDING);  // No more data to read
@@ -2260,9 +2272,9 @@
   AddHangingNonAlternateProtocolSocketData();
   CreateSession(supported_versions_);
 
-  SendRequestAndExpectHttpResponse("hello world");
+  SendRequestAndExpectHttpResponse(kHttpRespData);
   SendRequestAndExpectQuicResponseMaybeFromProxy(
-      "hello!", false, 443, "HTTP/1.1 200", picked_version);
+      kQuicRespData, 443, kQuic200RespStatusLine, picked_version, std::nullopt);
 }
 
 TEST_P(QuicNetworkTransactionTest, SetAlternativeServiceWithScheme) {
@@ -2276,7 +2288,7 @@
        GenerateQuicAltSvcHeaderValue({version_}, 444), "\r\n\r\n"});
   MockRead http_reads[] = {
       MockRead("HTTP/1.1 200 OK\r\n"), MockRead(alt_svc_header.data()),
-      MockRead("hello world"),
+      MockRead(kHttpRespData),
       MockRead(SYNCHRONOUS, ERR_TEST_PEER_CLOSE_AFTER_NEXT_MOCK_READ),
       MockRead(ASYNC, OK)};
 
@@ -2289,7 +2301,7 @@
   // Send https request, ignore alternative service advertising if response
   // header advertises alternative service for mail.example.org.
   request_.url = GURL("https://mail.example.org:443");
-  SendRequestAndExpectHttpResponse("hello world");
+  SendRequestAndExpectHttpResponse(kHttpRespData);
   HttpServerProperties* http_server_properties =
       session_->http_server_properties();
   url::SchemeHostPort http_server("http", "mail.example.org", 443);
@@ -2316,7 +2328,7 @@
        GenerateQuicAltSvcHeaderValue({version_}, 444), "\r\n\r\n"});
   MockRead http_reads[] = {
       MockRead("HTTP/1.1 200 OK\r\n"), MockRead(alt_svc_header.data()),
-      MockRead("hello world"),
+      MockRead(kHttpRespData),
       MockRead(SYNCHRONOUS, ERR_TEST_PEER_CLOSE_AFTER_NEXT_MOCK_READ),
       MockRead(ASYNC, OK)};
 
@@ -2332,7 +2344,7 @@
 
   // Send https request and set alternative services if response header
   // advertises alternative service for mail.example.org.
-  SendRequestAndExpectHttpResponse("hello world");
+  SendRequestAndExpectHttpResponse(kHttpRespData);
   HttpServerProperties* http_server_properties =
       session_->http_server_properties();
 
@@ -2346,7 +2358,7 @@
   // Send http request to the same origin but with diffrent scheme, should not
   // use QUIC.
   request_.url = GURL("http://mail.example.org:443");
-  SendRequestAndExpectHttpResponse("hello world");
+  SendRequestAndExpectHttpResponse(kHttpRespData);
 }
 
 TEST_P(QuicNetworkTransactionTest,
@@ -2364,7 +2376,7 @@
       MockRead("HTTP/1.1 200 OK\r\n"),
       MockRead(altsvc_header.c_str()),
       MockRead("\r\n"),
-      MockRead("hello world"),
+      MockRead(kHttpRespData),
       MockRead(SYNCHRONOUS, ERR_TEST_PEER_CLOSE_AFTER_NEXT_MOCK_READ),
       MockRead(ASYNC, OK)};
 
@@ -2389,7 +2401,7 @@
   mock_quic_data.AddRead(
       ASYNC, ConstructServerDataPacket(
                  2, GetNthClientInitiatedBidirectionalStreamId(0), true,
-                 ConstructDataFrame("hello!")));
+                 ConstructDataFrame(kQuicRespData)));
   mock_quic_data.AddWrite(SYNCHRONOUS,
                           ConstructClientAckPacket(packet_num++, 2, 1));
   mock_quic_data.AddRead(ASYNC, ERR_IO_PENDING);  // No more data to read
@@ -2401,8 +2413,8 @@
 
   CreateSession(supported_versions_);
 
-  SendRequestAndExpectHttpResponse("hello world");
-  SendRequestAndExpectQuicResponse("hello!");
+  SendRequestAndExpectHttpResponse(kHttpRespData);
+  SendRequestAndExpectQuicResponse(kQuicRespData);
 
   // Alt-Svc header contains all possible versions, so alternative services
   // should contain all of |supported_versions_|.
@@ -2423,7 +2435,7 @@
       "Alt-Svc: %s=\":443\"\r\n\r\n", quic::AlpnForVersion(version_).c_str());
   MockRead http_reads[] = {
       MockRead("HTTP/1.1 200 OK\r\n"), MockRead(altsvc_header.c_str()),
-      MockRead("hello world"),
+      MockRead(kHttpRespData),
       MockRead(SYNCHRONOUS, ERR_TEST_PEER_CLOSE_AFTER_NEXT_MOCK_READ),
       MockRead(ASYNC, OK)};
 
@@ -2448,7 +2460,7 @@
   mock_quic_data.AddRead(
       ASYNC, ConstructServerDataPacket(
                  2, GetNthClientInitiatedBidirectionalStreamId(0), true,
-                 ConstructDataFrame("hello!")));
+                 ConstructDataFrame(kQuicRespData)));
   mock_quic_data.AddWrite(SYNCHRONOUS,
                           ConstructClientAckPacket(packet_num++, 2, 1));
   mock_quic_data.AddRead(ASYNC, ERR_IO_PENDING);  // No more data to read
@@ -2459,8 +2471,8 @@
   AddHangingNonAlternateProtocolSocketData();
   CreateSession();
 
-  SendRequestAndExpectHttpResponse("hello world");
-  SendRequestAndExpectQuicResponse("hello!");
+  SendRequestAndExpectHttpResponse(kHttpRespData);
+  SendRequestAndExpectQuicResponse(kQuicRespData);
 }
 
 // Verify that if a QUIC connection times out, the QuicHttpStream will
@@ -2691,7 +2703,7 @@
 
   MockRead http_reads[] = {MockRead(SYNCHRONOUS, 3, "HTTP/1.1 200 OK\r\n"),
                            MockRead(SYNCHRONOUS, 4, alt_svc_header_.data()),
-                           MockRead(SYNCHRONOUS, 5, "hello world"),
+                           MockRead(SYNCHRONOUS, 5, kHttpRespData),
                            MockRead(SYNCHRONOUS, OK, 6)};
   SequencedSocketData http_data(http_reads, http_writes);
   socket_factory_.AddSocketDataProvider(&http_data);
@@ -2740,7 +2752,7 @@
   ASSERT_FALSE(http_data.AllReadDataConsumed());
 
   // Read the response body over TCP.
-  CheckResponseData(&trans, "hello world");
+  CheckResponseData(&trans, kHttpRespData);
   ExpectBrokenAlternateProtocolMapping();
   ASSERT_TRUE(http_data.AllWriteDataConsumed());
   ASSERT_TRUE(http_data.AllReadDataConsumed());
@@ -2792,7 +2804,7 @@
 
   MockRead http_reads[] = {MockRead(SYNCHRONOUS, 3, "HTTP/1.1 200 OK\r\n"),
                            MockRead(SYNCHRONOUS, 4, alt_svc_header_.data()),
-                           MockRead(SYNCHRONOUS, 5, "hello world"),
+                           MockRead(SYNCHRONOUS, 5, kHttpRespData),
                            MockRead(SYNCHRONOUS, OK, 6)};
   SequencedSocketData http_data(http_reads, http_writes);
   socket_factory_.AddSocketDataProvider(&http_data);
@@ -2837,7 +2849,7 @@
   ASSERT_FALSE(http_data.AllReadDataConsumed());
 
   // Read the response body over TCP.
-  CheckResponseData(&trans, "hello world");
+  CheckResponseData(&trans, kHttpRespData);
   ExpectBrokenAlternateProtocolMapping();
   ASSERT_TRUE(http_data.AllWriteDataConsumed());
   ASSERT_TRUE(http_data.AllReadDataConsumed());
@@ -2909,7 +2921,7 @@
 
   MockRead http_reads[] = {MockRead(SYNCHRONOUS, 3, "HTTP/1.1 200 OK\r\n"),
                            MockRead(SYNCHRONOUS, 4, alt_svc_header_.data()),
-                           MockRead(SYNCHRONOUS, 5, "hello world"),
+                           MockRead(SYNCHRONOUS, 5, kHttpRespData),
                            MockRead(SYNCHRONOUS, OK, 6)};
   SequencedSocketData http_data(http_reads, http_writes);
   socket_factory_.AddSocketDataProvider(&http_data);
@@ -2956,7 +2968,7 @@
   ASSERT_FALSE(http_data.AllReadDataConsumed());
 
   // Read the response body over TCP.
-  CheckResponseData(&trans, "hello world");
+  CheckResponseData(&trans, kHttpRespData);
   ASSERT_TRUE(http_data.AllWriteDataConsumed());
   ASSERT_TRUE(http_data.AllReadDataConsumed());
 
@@ -3019,7 +3031,7 @@
 
   MockRead http_reads[] = {MockRead(SYNCHRONOUS, 3, "HTTP/1.1 200 OK\r\n"),
                            MockRead(SYNCHRONOUS, 4, alt_svc_header_.data()),
-                           MockRead(SYNCHRONOUS, 5, "hello world"),
+                           MockRead(SYNCHRONOUS, 5, kHttpRespData),
                            MockRead(SYNCHRONOUS, OK, 6)};
   SequencedSocketData http_data(http_reads, http_writes);
   socket_factory_.AddSocketDataProvider(&http_data);
@@ -3070,7 +3082,7 @@
   ASSERT_FALSE(http_data.AllReadDataConsumed());
 
   // Read the response body over TCP.
-  CheckResponseData(&trans, "hello world");
+  CheckResponseData(&trans, kHttpRespData);
   ExpectBrokenAlternateProtocolMapping();
   ASSERT_TRUE(http_data.AllWriteDataConsumed());
   ASSERT_TRUE(http_data.AllReadDataConsumed());
@@ -3123,7 +3135,7 @@
 
   MockRead http_reads[] = {MockRead(SYNCHRONOUS, 3, "HTTP/1.1 200 OK\r\n"),
                            MockRead(SYNCHRONOUS, 4, alt_svc_header_.data()),
-                           MockRead(SYNCHRONOUS, 5, "hello world"),
+                           MockRead(SYNCHRONOUS, 5, kHttpRespData),
                            MockRead(SYNCHRONOUS, OK, 6)};
   SequencedSocketData http_data(http_reads, http_writes);
   socket_factory_.AddSocketDataProvider(&http_data);
@@ -3167,7 +3179,7 @@
   ASSERT_FALSE(http_data.AllReadDataConsumed());
 
   // Read the response body over TCP.
-  CheckResponseData(&trans, "hello world");
+  CheckResponseData(&trans, kHttpRespData);
   ExpectBrokenAlternateProtocolMapping();
   ASSERT_TRUE(http_data.AllWriteDataConsumed());
   ASSERT_TRUE(http_data.AllReadDataConsumed());
@@ -3210,7 +3222,7 @@
   mock_quic_data.AddRead(
       ASYNC, ConstructServerDataPacket(
                  2, GetNthClientInitiatedBidirectionalStreamId(0), true,
-                 ConstructDataFrame("hello!")));
+                 ConstructDataFrame(kQuicRespData)));
   mock_quic_data.AddWrite(SYNCHRONOUS,
                           ConstructClientAckPacket(packet_num++, 2, 1));
   mock_quic_data.AddRead(ASYNC, ERR_IO_PENDING);  // No more data to read
@@ -3243,7 +3255,7 @@
   http_server_properties_->MarkAlternativeServiceBroken(
       local_alternative, NetworkAnonymizationKey());
 
-  SendRequestAndExpectQuicResponse("hello!");
+  SendRequestAndExpectQuicResponse(kQuicRespData);
 }
 
 // Verify that when multiple alternatives are broken,
@@ -3258,7 +3270,7 @@
 
   MockRead http_reads[] = {
       MockRead("HTTP/1.1 200 OK\r\n"), MockRead(alt_svc_header_.data()),
-      MockRead("hello world"),
+      MockRead(kHttpRespData),
       MockRead(SYNCHRONOUS, ERR_TEST_PEER_CLOSE_AFTER_NEXT_MOCK_READ),
       MockRead(ASYNC, OK)};
 
@@ -3299,7 +3311,7 @@
   http_server_properties_->MarkAlternativeServiceBroken(
       local_alternative, NetworkAnonymizationKey());
 
-  SendRequestAndExpectHttpResponse("hello world");
+  SendRequestAndExpectHttpResponse(kHttpRespData);
 
   histogram_tester.ExpectBucketCount("Net.AlternateProtocolUsage",
                                      ALTERNATE_PROTOCOL_USAGE_BROKEN, 1);
@@ -3350,7 +3362,7 @@
   mock_quic_data.AddRead(
       ASYNC, ConstructServerDataPacket(
                  2, GetNthClientInitiatedBidirectionalStreamId(0), true,
-                 ConstructDataFrame("hello!")));
+                 ConstructDataFrame(kQuicRespData)));
   mock_quic_data.AddWrite(SYNCHRONOUS,
                           ConstructClientAckPacket(packet_num++, 2, 1));
 
@@ -3394,7 +3406,7 @@
 
   MockRead http_reads[] = {MockRead(SYNCHRONOUS, 3, "HTTP/1.1 200 OK\r\n"),
                            MockRead(SYNCHRONOUS, 4, alt_svc_header_.data()),
-                           MockRead(SYNCHRONOUS, 5, "hello world"),
+                           MockRead(SYNCHRONOUS, 5, kHttpRespData),
                            MockRead(SYNCHRONOUS, OK, 6)};
   SequencedSocketData http_data(http_reads, http_writes);
   socket_factory_.AddSocketDataProvider(&http_data);
@@ -3423,15 +3435,15 @@
       url::SchemeHostPort(origin2), NetworkAnonymizationKey(), alternative2,
       expiration, supported_versions_);
 
-  // First request opens connection to |destination1|
+  // First request opens connection to `kDestination1`
   // with quic::QuicServerId.host() == origin1.host().
-  SendRequestAndExpectQuicResponse("hello!");
+  SendRequestAndExpectQuicResponse(kQuicRespData);
 
   // Second request pools to existing connection with same destination,
   // because certificate matches, even though quic::QuicServerId is different.
   // After it is reset, it will fail back to TCP and mark QUIC as broken.
   request_.url = origin2;
-  SendRequestAndExpectHttpResponse("hello world");
+  SendRequestAndExpectHttpResponse(kHttpRespData);
   EXPECT_FALSE(http_server_properties_->IsAlternativeServiceBroken(
       alternative1, NetworkAnonymizationKey()))
       << alternative1.ToString();
@@ -3441,7 +3453,7 @@
 
   // The third request should use a new TCP connection, not the broken
   // QUIC connection.
-  SendRequestAndExpectHttpResponse("hello world");
+  SendRequestAndExpectHttpResponse(kHttpRespData);
 }
 
 TEST_P(QuicNetworkTransactionTest,
@@ -3455,7 +3467,7 @@
                          version_.transport_version - 1);
   MockRead http_reads[] = {
       MockRead("HTTP/1.1 200 OK\r\n"), MockRead(altsvc_header.c_str()),
-      MockRead("hello world"),
+      MockRead(kHttpRespData),
       MockRead(SYNCHRONOUS, ERR_TEST_PEER_CLOSE_AFTER_NEXT_MOCK_READ),
       MockRead(ASYNC, OK)};
 
@@ -3467,8 +3479,8 @@
 
   CreateSession();
 
-  SendRequestAndExpectHttpResponse("hello world");
-  SendRequestAndExpectHttpResponse("hello world");
+  SendRequestAndExpectHttpResponse(kHttpRespData);
+  SendRequestAndExpectHttpResponse(kHttpRespData);
 }
 
 // When multiple alternative services are advertised, HttpStreamFactory should
@@ -3487,7 +3499,7 @@
        GenerateQuicAltSvcHeaderValue({version_}, 444), "\r\n\r\n"});
   MockRead http_reads[] = {
       MockRead("HTTP/1.1 200 OK\r\n"), MockRead(alt_svc_header.data()),
-      MockRead("hello world"),
+      MockRead(kHttpRespData),
       MockRead(SYNCHRONOUS, ERR_TEST_PEER_CLOSE_AFTER_NEXT_MOCK_READ),
       MockRead(ASYNC, OK)};
 
@@ -3520,7 +3532,7 @@
   mock_quic_data.AddRead(
       ASYNC, ConstructServerDataPacket(
                  2, GetNthClientInitiatedBidirectionalStreamId(0), true,
-                 ConstructDataFrame("hello!")));
+                 ConstructDataFrame(kQuicRespData)));
   mock_quic_data.AddWrite(SYNCHRONOUS,
                           ConstructClientAckPacket(packet_num++, 2, 1));
 
@@ -3539,7 +3551,7 @@
   mock_quic_data.AddRead(
       ASYNC, ConstructServerDataPacket(
                  4, GetNthClientInitiatedBidirectionalStreamId(1), true,
-                 ConstructDataFrame("hello!")));
+                 ConstructDataFrame(kQuicRespData)));
   mock_quic_data.AddWrite(SYNCHRONOUS,
                           ConstructClientAckPacket(packet_num++, 4, 3));
   mock_quic_data.AddRead(ASYNC, ERR_IO_PENDING);  // No more data to read
@@ -3554,10 +3566,10 @@
       std::make_unique<QuicChromiumAlarmFactory>(quic_task_runner_.get(),
                                                  context_.clock()));
 
-  SendRequestAndExpectHttpResponse("hello world");
+  SendRequestAndExpectHttpResponse(kHttpRespData);
 
-  SendRequestAndExpectQuicResponse("hello!");
-  SendRequestAndExpectQuicResponse("hello!");
+  SendRequestAndExpectQuicResponse(kQuicRespData);
+  SendRequestAndExpectQuicResponse(kQuicRespData);
 }
 
 // Pool to existing session with matching quic::QuicServerId
@@ -3582,7 +3594,7 @@
   mock_quic_data.AddRead(
       ASYNC, ConstructServerDataPacket(
                  2, GetNthClientInitiatedBidirectionalStreamId(0), true,
-                 ConstructDataFrame("hello!")));
+                 ConstructDataFrame(kQuicRespData)));
   mock_quic_data.AddWrite(SYNCHRONOUS,
                           ConstructClientAckPacket(packet_num++, 2, 1));
 
@@ -3599,7 +3611,7 @@
   mock_quic_data.AddRead(
       ASYNC, ConstructServerDataPacket(
                  4, GetNthClientInitiatedBidirectionalStreamId(1), true,
-                 ConstructDataFrame("hello!")));
+                 ConstructDataFrame(kQuicRespData)));
   mock_quic_data.AddWrite(SYNCHRONOUS,
                           ConstructClientAckPacket(packet_num++, 4, 3));
   mock_quic_data.AddRead(ASYNC, ERR_IO_PENDING);  // No more data to read
@@ -3616,28 +3628,28 @@
       std::make_unique<QuicChromiumAlarmFactory>(quic_task_runner_.get(),
                                                  context_.clock()));
 
-  const char destination1[] = "first.example.com";
-  const char destination2[] = "second.example.com";
+  const char kDestination1[] = "first.example.com";
+  const char kDestination2[] = "second.example.com";
 
-  // Set up alternative service entry to destination1.
+  // Set up alternative service entry to `kDestination1`.
   url::SchemeHostPort server(request_.url);
-  AlternativeService alternative_service(kProtoQUIC, destination1, 443);
+  AlternativeService alternative_service(kProtoQUIC, kDestination1, 443);
   base::Time expiration = base::Time::Now() + base::Days(1);
   http_server_properties_->SetQuicAlternativeService(
       server, NetworkAnonymizationKey(), alternative_service, expiration,
       supported_versions_);
-  // First request opens connection to |destination1|
+  // First request opens connection to `kDestination1`
   // with quic::QuicServerId.host() == kDefaultServerHostName.
-  SendRequestAndExpectQuicResponse("hello!");
+  SendRequestAndExpectQuicResponse(kQuicRespData);
 
   // Set up alternative service entry to a different destination.
-  alternative_service = AlternativeService(kProtoQUIC, destination2, 443);
+  alternative_service = AlternativeService(kProtoQUIC, kDestination2, 443);
   http_server_properties_->SetQuicAlternativeService(
       server, NetworkAnonymizationKey(), alternative_service, expiration,
       supported_versions_);
   // Second request pools to existing connection with same quic::QuicServerId,
   // even though alternative service destination is different.
-  SendRequestAndExpectQuicResponse("hello!");
+  SendRequestAndExpectQuicResponse(kQuicRespData);
 }
 
 // Pool to existing session with matching destination and matching certificate
@@ -3667,7 +3679,7 @@
   mock_quic_data.AddRead(
       ASYNC, ConstructServerDataPacket(
                  2, GetNthClientInitiatedBidirectionalStreamId(0), true,
-                 ConstructDataFrame("hello!")));
+                 ConstructDataFrame(kQuicRespData)));
   mock_quic_data.AddWrite(SYNCHRONOUS,
                           ConstructClientAckPacket(packet_num++, 2, 1));
 
@@ -3692,7 +3704,7 @@
   mock_quic_data.AddRead(
       ASYNC, ConstructServerDataPacket(
                  4, GetNthClientInitiatedBidirectionalStreamId(1), true,
-                 ConstructDataFrame("hello!")));
+                 ConstructDataFrame(kQuicRespData)));
   mock_quic_data.AddWrite(SYNCHRONOUS,
                           ConstructClientAckPacket(packet_num++, 4, 3));
   mock_quic_data.AddRead(ASYNC, ERR_IO_PENDING);  // No more data to read
@@ -3709,11 +3721,11 @@
       std::make_unique<QuicChromiumAlarmFactory>(quic_task_runner_.get(),
                                                  context_.clock()));
 
-  const char destination1[] = "first.example.com";
-  const char destination2[] = "second.example.com";
+  const char kDestination1[] = "first.example.com";
+  const char kDestination2[] = "second.example.com";
 
   // Set up alternative service for |origin1|.
-  AlternativeService alternative_service1(kProtoQUIC, destination1, 443);
+  AlternativeService alternative_service1(kProtoQUIC, kDestination1, 443);
   base::Time expiration = base::Time::Now() + base::Days(1);
   http_server_properties_->SetQuicAlternativeService(
       url::SchemeHostPort(origin1), NetworkAnonymizationKey(),
@@ -3723,7 +3735,7 @@
   // the first one with a different destination as for |origin1|,
   // the second one with the same.  The second one should be used,
   // because the request can be pooled to that one.
-  AlternativeService alternative_service2(kProtoQUIC, destination2, 443);
+  AlternativeService alternative_service2(kProtoQUIC, kDestination2, 443);
   AlternativeServiceInfoVector alternative_services;
   alternative_services.push_back(
       AlternativeServiceInfo::CreateQuicAlternativeServiceInfo(
@@ -3736,15 +3748,15 @@
   http_server_properties_->SetAlternativeServices(url::SchemeHostPort(origin2),
                                                   NetworkAnonymizationKey(),
                                                   alternative_services);
-  // First request opens connection to |destination1|
+  // First request opens connection to `kDestination1`
   // with quic::QuicServerId.host() == origin1.host().
-  SendRequestAndExpectQuicResponse("hello!");
+  SendRequestAndExpectQuicResponse(kQuicRespData);
 
   // Second request pools to existing connection with same destination,
   // because certificate matches, even though quic::QuicServerId is different.
   request_.url = origin2;
 
-  SendRequestAndExpectQuicResponse("hello!");
+  SendRequestAndExpectQuicResponse(kQuicRespData);
 }
 
 // Multiple origins have listed the same alternative services. When there's a
@@ -3761,9 +3773,10 @@
   // Default cert is valid for *.example.org
 
   // HTTP data for request to www.example.org.
+  const char kWwwHttpRespData[] = "hello world from www.example.org";
   MockRead http_reads[] = {
       MockRead("HTTP/1.1 200 OK\r\n"), MockRead(alt_svc_header_.data()),
-      MockRead("hello world from www.example.org"),
+      MockRead(kWwwHttpRespData),
       MockRead(SYNCHRONOUS, ERR_TEST_PEER_CLOSE_AFTER_NEXT_MOCK_READ),
       MockRead(ASYNC, OK)};
 
@@ -3777,9 +3790,10 @@
       {"Alt-Svc: ", GenerateQuicAltSvcHeaderValue({version_}, 444), ",",
        GenerateQuicAltSvcHeaderValue({version_}, "www.example.org", 443),
        "\r\n\r\n"});
+  const char kMailHttpRespData[] = "hello world from mail.example.org";
   MockRead http_reads2[] = {
       MockRead("HTTP/1.1 200 OK\r\n"), MockRead(alt_svc_header2.data()),
-      MockRead("hello world from mail.example.org"),
+      MockRead(kMailHttpRespData),
       MockRead(SYNCHRONOUS, ERR_TEST_PEER_CLOSE_AFTER_NEXT_MOCK_READ),
       MockRead(ASYNC, OK)};
 
@@ -3808,10 +3822,11 @@
       ASYNC, ConstructServerResponseHeadersPacket(
                  1, GetNthClientInitiatedBidirectionalStreamId(0), false,
                  GetResponseHeaders("200")));
+  const char kMailQuicRespData[] = "hello from mail QUIC!";
   mock_quic_data.AddRead(
       ASYNC, ConstructServerDataPacket(
                  2, GetNthClientInitiatedBidirectionalStreamId(0), true,
-                 ConstructDataFrame("hello from mail QUIC!")));
+                 ConstructDataFrame(kMailQuicRespData)));
   mock_quic_data.AddWrite(SYNCHRONOUS,
                           ConstructClientAckPacket(packet_num++, 2, 1));
   // Second QUIC request data.
@@ -3827,7 +3842,7 @@
   mock_quic_data.AddRead(
       ASYNC, ConstructServerDataPacket(
                  4, GetNthClientInitiatedBidirectionalStreamId(1), true,
-                 ConstructDataFrame("hello from mail QUIC!")));
+                 ConstructDataFrame(kMailQuicRespData)));
   mock_quic_data.AddWrite(SYNCHRONOUS,
                           ConstructClientAckPacket(packet_num++, 4, 3));
   mock_quic_data.AddRead(ASYNC, ERR_IO_PENDING);  // No more data to read
@@ -3844,18 +3859,18 @@
 
   // Send two HTTP requests, responses set up alt-svc lists for the origins.
   request_.url = GURL("https://www.example.org/");
-  SendRequestAndExpectHttpResponse("hello world from www.example.org");
+  SendRequestAndExpectHttpResponse(kWwwHttpRespData);
   request_.url = GURL("https://mail.example.org/");
-  SendRequestAndExpectHttpResponse("hello world from mail.example.org");
+  SendRequestAndExpectHttpResponse(kMailHttpRespData);
 
   // Open a QUIC session to mail.example.org:443 when making request
   // to mail.example.org.
   request_.url = GURL("https://www.example.org/");
-  SendRequestAndExpectQuicResponse("hello from mail QUIC!");
+  SendRequestAndExpectQuicResponse(kMailQuicRespData);
 
   // Uses the existing QUIC session when making request to www.example.org.
   request_.url = GURL("https://mail.example.org/");
-  SendRequestAndExpectQuicResponse("hello from mail QUIC!");
+  SendRequestAndExpectQuicResponse(kMailQuicRespData);
 }
 
 TEST_P(QuicNetworkTransactionTest, AlternativeServiceDifferentPort) {
@@ -3868,7 +3883,7 @@
                     "\r\n\r\n"});
   MockRead http_reads[] = {
       MockRead("HTTP/1.1 200 OK\r\n"), MockRead(alt_svc_header.data()),
-      MockRead("hello world"),
+      MockRead(kHttpRespData),
       MockRead(SYNCHRONOUS, ERR_TEST_PEER_CLOSE_AFTER_NEXT_MOCK_READ),
       MockRead(ASYNC, OK)};
 
@@ -3880,7 +3895,7 @@
   AddHangingNonAlternateProtocolSocketData();
   CreateSession();
 
-  SendRequestAndExpectHttpResponse("hello world");
+  SendRequestAndExpectHttpResponse(kHttpRespData);
 
   url::SchemeHostPort http_server("https", kDefaultServerHostName, 443);
   AlternativeServiceInfoVector alternative_service_info_vector =
@@ -3901,7 +3916,7 @@
   }
   MockRead http_reads[] = {
       MockRead("HTTP/1.1 200 OK\r\n"), MockRead(alt_svc_header_.data()),
-      MockRead("hello world"),
+      MockRead(kHttpRespData),
       MockRead(SYNCHRONOUS, ERR_TEST_PEER_CLOSE_AFTER_NEXT_MOCK_READ),
       MockRead(ASYNC, OK)};
 
@@ -3926,7 +3941,7 @@
   mock_quic_data.AddRead(
       ASYNC, ConstructServerDataPacket(
                  2, GetNthClientInitiatedBidirectionalStreamId(0), true,
-                 ConstructDataFrame("hello!")));
+                 ConstructDataFrame(kQuicRespData)));
   mock_quic_data.AddWrite(SYNCHRONOUS,
                           ConstructClientAckPacket(packet_num++, 2, 1));
   mock_quic_data.AddRead(ASYNC, ERR_IO_PENDING);  // No more data to read
@@ -3944,8 +3959,8 @@
   EXPECT_TRUE(http_server_properties_->WasAlternativeServiceRecentlyBroken(
       alternative_service, NetworkAnonymizationKey()));
 
-  SendRequestAndExpectHttpResponse("hello world");
-  SendRequestAndExpectQuicResponse("hello!");
+  SendRequestAndExpectHttpResponse(kHttpRespData);
+  SendRequestAndExpectQuicResponse(kQuicRespData);
 
   mock_quic_data.Resume();
 
@@ -3984,7 +3999,7 @@
 
   MockRead http_reads[] = {
       MockRead("HTTP/1.1 200 OK\r\n"), MockRead(alt_svc_header_.data()),
-      MockRead("hello world"),
+      MockRead(kHttpRespData),
       MockRead(SYNCHRONOUS, ERR_TEST_PEER_CLOSE_AFTER_NEXT_MOCK_READ),
       MockRead(ASYNC, OK)};
 
@@ -4009,7 +4024,7 @@
   mock_quic_data.AddRead(
       ASYNC, ConstructServerDataPacket(
                  2, GetNthClientInitiatedBidirectionalStreamId(0), true,
-                 ConstructDataFrame("hello!")));
+                 ConstructDataFrame(kQuicRespData)));
   mock_quic_data.AddWrite(SYNCHRONOUS,
                           ConstructClientAckPacket(packet_num++, 2, 1));
   mock_quic_data.AddRead(ASYNC, ERR_IO_PENDING);  // No more data to read
@@ -4032,8 +4047,8 @@
 
   request_.network_isolation_key = kNetworkIsolationKey1;
   request_.network_anonymization_key = kNetworkAnonymizationKey1;
-  SendRequestAndExpectHttpResponse("hello world");
-  SendRequestAndExpectQuicResponse("hello!");
+  SendRequestAndExpectHttpResponse(kHttpRespData);
+  SendRequestAndExpectQuicResponse(kQuicRespData);
 
   mock_quic_data.Resume();
 
@@ -4056,7 +4071,7 @@
   }
   MockRead http_reads[] = {
       MockRead("HTTP/1.1 200 OK\r\n"), MockRead(alt_svc_header_.data()),
-      MockRead("hello world"),
+      MockRead(kHttpRespData),
       MockRead(SYNCHRONOUS, ERR_TEST_PEER_CLOSE_AFTER_NEXT_MOCK_READ),
       MockRead(ASYNC, OK)};
 
@@ -4091,7 +4106,7 @@
   CreateSession();
 
   // TODO(rtenneti): Test QUIC over HTTPS, GetSSLInfo().
-  SendRequestAndExpectHttpResponse("hello world");
+  SendRequestAndExpectHttpResponse(kHttpRespData);
 }
 
 TEST_P(QuicNetworkTransactionTest, HungAlternativeService) {
@@ -4109,7 +4124,7 @@
 
   MockRead http_reads[] = {MockRead(SYNCHRONOUS, 3, "HTTP/1.1 200 OK\r\n"),
                            MockRead(SYNCHRONOUS, 4, alt_svc_header_.data()),
-                           MockRead(SYNCHRONOUS, 5, "hello world"),
+                           MockRead(SYNCHRONOUS, 5, kHttpRespData),
                            MockRead(SYNCHRONOUS, OK, 6)};
 
   SequencedSocketData http_data(http_reads, http_writes);
@@ -4133,13 +4148,13 @@
   CreateSession();
 
   // Run the first request.
-  SendRequestAndExpectHttpResponse("hello world");
+  SendRequestAndExpectHttpResponse(kHttpRespData);
   ASSERT_TRUE(http_data.AllReadDataConsumed());
   ASSERT_TRUE(http_data.AllWriteDataConsumed());
 
   // Now run the second request in which the QUIC socket hangs,
   // and verify the the transaction continues over HTTP.
-  SendRequestAndExpectHttpResponse("hello world");
+  SendRequestAndExpectHttpResponse(kHttpRespData);
   base::RunLoop().RunUntilIdle();
 
   ASSERT_TRUE(http_data2.AllReadDataConsumed());
@@ -4167,7 +4182,7 @@
   mock_quic_data.AddRead(
       ASYNC, ConstructServerDataPacket(
                  2, GetNthClientInitiatedBidirectionalStreamId(0), true,
-                 ConstructDataFrame("hello!")));
+                 ConstructDataFrame(kQuicRespData)));
   mock_quic_data.AddWrite(SYNCHRONOUS,
                           ConstructClientAckPacket(packet_num++, 2, 1));
   mock_quic_data.AddRead(ASYNC, ERR_IO_PENDING);  // No more data to read
@@ -4201,7 +4216,7 @@
   EXPECT_THAT(callback.WaitForResult(), IsOk());
 
   CheckWasQuicResponse(&trans);
-  CheckResponseData(&trans, "hello!");
+  CheckResponseData(&trans, kQuicRespData);
 
   EXPECT_EQ(nullptr, http_server_properties_->GetServerNetworkStats(
                          url::SchemeHostPort("https", request_.url.host(), 443),
@@ -4228,7 +4243,7 @@
   mock_quic_data.AddRead(
       ASYNC, ConstructServerDataPacket(
                  2, GetNthClientInitiatedBidirectionalStreamId(0), true,
-                 ConstructDataFrame("hello!")));
+                 ConstructDataFrame(kQuicRespData)));
   mock_quic_data.AddWrite(SYNCHRONOUS,
                           ConstructClientAckPacket(packet_number++, 2, 1));
   mock_quic_data.AddRead(ASYNC, ERR_IO_PENDING);  // No more data to read
@@ -4265,7 +4280,7 @@
   EXPECT_THAT(callback.WaitForResult(), IsOk());
 
   CheckWasQuicResponse(&trans);
-  CheckResponseData(&trans, "hello!");
+  CheckResponseData(&trans, kQuicRespData);
 }
 
 TEST_P(QuicNetworkTransactionTest, ZeroRTTWithProxy) {
@@ -4287,7 +4302,7 @@
 
   MockRead http_reads[] = {MockRead(SYNCHRONOUS, 3, "HTTP/1.1 200 OK\r\n"),
                            MockRead(SYNCHRONOUS, 4, alt_svc_header_.data()),
-                           MockRead(SYNCHRONOUS, 5, "hello world"),
+                           MockRead(SYNCHRONOUS, 5, kHttpRespData),
                            MockRead(SYNCHRONOUS, OK, 6)};
 
   StaticSocketDataProvider http_data(http_reads, http_writes);
@@ -4303,7 +4318,7 @@
   request_.url = GURL("http://mail.example.org/");
   CreateSession();
   AddQuicAlternateProtocolMapping(MockCryptoClientStream::ZERO_RTT);
-  SendRequestAndExpectHttpResponse("hello world");
+  SendRequestAndExpectHttpResponse(kHttpRespData);
 }
 
 TEST_P(QuicNetworkTransactionTest, ZeroRTTWithConfirmationRequired) {
@@ -4325,7 +4340,7 @@
   mock_quic_data.AddRead(
       ASYNC, ConstructServerDataPacket(
                  2, GetNthClientInitiatedBidirectionalStreamId(0), true,
-                 ConstructDataFrame("hello!")));
+                 ConstructDataFrame(kQuicRespData)));
   mock_quic_data.AddWrite(SYNCHRONOUS,
                           ConstructClientAckPacket(packet_num++, 2, 1));
   mock_quic_data.AddRead(SYNCHRONOUS, ERR_IO_PENDING);  // No more data to read
@@ -4359,7 +4374,7 @@
   EXPECT_THAT(callback.WaitForResult(), IsOk());
 
   CheckWasQuicResponse(&trans);
-  CheckResponseData(&trans, "hello!");
+  CheckResponseData(&trans, kQuicRespData);
 }
 
 TEST_P(QuicNetworkTransactionTest, ZeroRTTWithTooEarlyResponse) {
@@ -4401,7 +4416,7 @@
   mock_quic_data.AddRead(
       ASYNC, ConstructServerDataPacket(
                  3, GetNthClientInitiatedBidirectionalStreamId(1), true,
-                 ConstructDataFrame("hello!")));
+                 ConstructDataFrame(kQuicRespData)));
   mock_quic_data.AddWrite(SYNCHRONOUS,
                           ConstructClientAckPacket(packet_number++, 3, 1));
   mock_quic_data.AddRead(ASYNC, ERR_IO_PENDING);  // No more data to read
@@ -4441,7 +4456,7 @@
 
   EXPECT_THAT(callback.WaitForResult(), IsOk());
   CheckWasQuicResponse(&trans);
-  CheckResponseData(&trans, "hello!");
+  CheckResponseData(&trans, kQuicRespData);
 }
 
 TEST_P(QuicNetworkTransactionTest, ZeroRTTWithMultipleTooEarlyResponse) {
@@ -4715,7 +4730,7 @@
   const HttpResponseInfo* response = trans.GetResponseInfo();
   ASSERT_TRUE(response != nullptr);
   ASSERT_TRUE(response->headers.get() != nullptr);
-  EXPECT_EQ("HTTP/1.1 200", response->headers->GetStatusLine());
+  EXPECT_EQ(kQuic200RespStatusLine, response->headers->GetStatusLine());
   EXPECT_TRUE(response->was_fetched_via_spdy);
   EXPECT_TRUE(response->was_alpn_negotiated);
   EXPECT_EQ(QuicHttpStream::ConnectionInfoFromQuicVersion(version_),
@@ -4954,7 +4969,7 @@
   mock_quic_data.AddRead(
       ASYNC, ConstructServerDataPacket(
                  2, GetNthClientInitiatedBidirectionalStreamId(0), true,
-                 ConstructDataFrame("hello!")));
+                 ConstructDataFrame(kQuicRespData)));
   mock_quic_data.AddWrite(SYNCHRONOUS,
                           ConstructClientAckPacket(packet_number++, 2, 1));
   mock_quic_data.AddRead(ASYNC, ERR_IO_PENDING);  // No more data to read
@@ -4995,7 +5010,7 @@
   EXPECT_THAT(callback.WaitForResult(), IsOk());
 
   CheckWasQuicResponse(&trans);
-  CheckResponseData(&trans, "hello!");
+  CheckResponseData(&trans, kQuicRespData);
 }
 
 TEST_P(QuicNetworkTransactionTest,
@@ -5027,7 +5042,7 @@
   mock_quic_data.AddRead(
       ASYNC, ConstructServerDataPacket(
                  2, GetNthClientInitiatedBidirectionalStreamId(0), true,
-                 ConstructDataFrame("hello!")));
+                 ConstructDataFrame(kQuicRespData)));
   mock_quic_data.AddWrite(SYNCHRONOUS,
                           ConstructClientAckPacket(packet_num++, 2, 1));
   mock_quic_data.AddRead(SYNCHRONOUS, ERR_IO_PENDING);  // No more data to read
@@ -5059,7 +5074,7 @@
   EXPECT_THAT(callback.WaitForResult(), IsOk());
 
   CheckWasQuicResponse(&trans);
-  CheckResponseData(&trans, "hello!");
+  CheckResponseData(&trans, kQuicRespData);
 }
 
 TEST_P(QuicNetworkTransactionTest, NetErrorDetailsSetBeforeHandshake) {
@@ -5250,7 +5265,7 @@
   // When the QUIC connection fails, we will try the request again over HTTP.
   MockRead http_reads[] = {
       MockRead("HTTP/1.1 200 OK\r\n"), MockRead(alt_svc_header_.data()),
-      MockRead("hello world"),
+      MockRead(kHttpRespData),
       MockRead(SYNCHRONOUS, ERR_TEST_PEER_CLOSE_AFTER_NEXT_MOCK_READ),
       MockRead(ASYNC, OK)};
 
@@ -5269,7 +5284,7 @@
   // TODO(rch): Check if we need a 0RTT version of ConnectionCloseDuringConnect
   AddQuicAlternateProtocolMapping(
       MockCryptoClientStream::COLD_START_WITH_CHLO_SENT);
-  SendRequestAndExpectHttpResponse("hello world");
+  SendRequestAndExpectHttpResponse(kHttpRespData);
 }
 
 TEST_P(QuicNetworkTransactionTest, ConnectionCloseDuringConnectProxy) {
@@ -5290,7 +5305,7 @@
   // When the QUIC connection fails, we will try the request again over HTTP.
   MockRead http_reads[] = {
       MockRead("HTTP/1.1 200 OK\r\n"), MockRead(alt_svc_header_.data()),
-      MockRead("hello world"),
+      MockRead(kHttpRespData),
       MockRead(SYNCHRONOUS, ERR_TEST_PEER_CLOSE_AFTER_NEXT_MOCK_READ),
       MockRead(ASYNC, OK)};
 
@@ -5298,32 +5313,32 @@
   socket_factory_.AddSocketDataProvider(&http_data);
   socket_factory_.AddSSLSocketDataProvider(&ssl_data_);
 
-  const HostPortPair host_port_pair("myproxy.org", 443);
-
-  auto quic_proxy_chain =
+  const char kProxyHost[] = "myproxy.org";
+  const auto kQuicProxyChain =
       ProxyChain::ForIpProtection({ProxyServer::FromSchemeHostAndPort(
-          ProxyServer::SCHEME_QUIC, "myproxy.org", 443)});
-
+          ProxyServer::SCHEME_QUIC, kProxyHost, 443)});
+  const auto kHttpsProxyChain = ProxyChain::FromSchemeHostAndPort(
+      ProxyServer::SCHEME_HTTPS, kProxyHost, 443);
   proxy_resolution_service_ =
       ConfiguredProxyResolutionService::CreateFixedFromProxyChainsForTest(
-          {quic_proxy_chain,
-           ProxyChain::FromSchemeHostAndPort(ProxyServer::SCHEME_HTTPS,
-                                             "myproxy.org", 443)},
-          TRAFFIC_ANNOTATION_FOR_TESTS);
+          {kQuicProxyChain, kHttpsProxyChain}, TRAFFIC_ANNOTATION_FOR_TESTS);
   request_.url = GURL("http://mail.example.org/");
 
   // In order for a new QUIC session to be established via alternate-protocol
   // without racing an HTTP connection, we need the host resolution to happen
   // synchronously.
   host_resolver_.set_synchronous_mode(true);
-  host_resolver_.rules()->AddIPLiteralRule("myproxy.org", "192.168.0.1", "");
+  host_resolver_.rules()->AddIPLiteralRule(kProxyHost, "192.168.0.1", "");
 
   CreateSession();
   crypto_client_stream_factory_.set_handshake_mode(
       MockCryptoClientStream::COLD_START_WITH_CHLO_SENT);
-  SendRequestAndExpectHttpResponseFromProxy("hello world", true, 443);
+  SendRequestAndExpectHttpResponseFromProxy(
+      kHttpRespData,
+      kHttpsProxyChain.GetProxyServer(/*chain_index=*/0).GetPort(),
+      kHttpsProxyChain);
   EXPECT_THAT(session_->proxy_resolution_service()->proxy_retry_info(),
-              ElementsAre(Key(quic_proxy_chain)));
+              ElementsAre(Key(kQuicProxyChain)));
 }
 
 TEST_P(QuicNetworkTransactionTest, SecureResourceOverSecureQuic) {
@@ -5346,7 +5361,7 @@
   mock_quic_data.AddRead(
       ASYNC, ConstructServerDataPacket(
                  2, GetNthClientInitiatedBidirectionalStreamId(0), true,
-                 ConstructDataFrame("hello!")));
+                 ConstructDataFrame(kQuicRespData)));
   mock_quic_data.AddWrite(SYNCHRONOUS,
                           ConstructClientAckPacket(packet_num++, 2, 1));
   mock_quic_data.AddRead(SYNCHRONOUS, ERR_IO_PENDING);  // No more read data.
@@ -5356,7 +5371,7 @@
   AddHangingNonAlternateProtocolSocketData();
   CreateSession();
   AddQuicAlternateProtocolMapping(MockCryptoClientStream::CONFIRM_HANDSHAKE);
-  SendRequestAndExpectQuicResponse("hello!");
+  SendRequestAndExpectQuicResponse(kQuicRespData);
   EXPECT_TRUE(
       test_socket_performance_watcher_factory_.rtt_notification_received());
 }
@@ -5370,12 +5385,6 @@
   mock_quic_data.AddWrite(SYNCHRONOUS, ERR_FAILED);
   mock_quic_data.AddSocketDataToFactory(&socket_factory_);
 
-  /*MockRead reads[] = {MockRead(SYNCHRONOUS, ERR_IO_PENDING, 0)};
-  //MockWrite writes[] = {MockWrite(SYNCHRONOUS, ERR_FAILED, 1)};
-  MockWrite writes[] = {};
-  SequencedSocketData socket_data(reads, writes);
-  socket_factory_.AddSocketDataProvider(&socket_data);*/
-
   // The non-alternate protocol job needs to hang in order to guarantee that
   // the alternate-protocol job will "win".
   AddHangingNonAlternateProtocolSocketData();
@@ -5470,7 +5479,7 @@
   socket_data.AddRead(
       ASYNC, ConstructServerDataPacket(
                  2, GetNthClientInitiatedBidirectionalStreamId(0), true,
-                 ConstructDataFrame("hello!")));
+                 ConstructDataFrame(kQuicRespData)));
   socket_data.AddWrite(SYNCHRONOUS,
                        ConstructClientAckPacket(packet_num++, 2, 1));
   socket_data.AddRead(SYNCHRONOUS, ERR_IO_PENDING);  // No more data to read
@@ -5483,7 +5492,7 @@
 
   CreateSession();
 
-  SendRequestAndExpectQuicResponse("hello!");
+  SendRequestAndExpectQuicResponse(kQuicRespData);
   session_.reset();
 }
 
@@ -5508,7 +5517,7 @@
   socket_data.AddRead(
       ASYNC, ConstructServerDataPacket(
                  2, GetNthClientInitiatedBidirectionalStreamId(0), true,
-                 ConstructDataFrame("hello!")));
+                 ConstructDataFrame(kQuicRespData)));
   socket_data.AddWrite(SYNCHRONOUS,
                        ConstructClientAckPacket(packet_num++, 2, 1));
   socket_data.AddRead(SYNCHRONOUS, ERR_IO_PENDING);  // No more data to read
@@ -5521,7 +5530,7 @@
 
   CreateSession();
 
-  SendRequestAndExpectQuicResponse("hello!");
+  SendRequestAndExpectQuicResponse(kQuicRespData);
   session_.reset();
 }
 
@@ -5660,7 +5669,7 @@
   mock_quic_data.AddRead(
       ASYNC, ConstructServerDataPacket(
                  2, GetNthClientInitiatedBidirectionalStreamId(0), true,
-                 ConstructDataFrame("hello!")));
+                 ConstructDataFrame(kQuicRespData)));
 
   mock_quic_data.AddWrite(SYNCHRONOUS,
                           ConstructClientAckPacket(write_packet_index++, 2, 1));
@@ -5680,7 +5689,7 @@
 
   request_.upload_data_stream = &upload_data;
 
-  SendRequestAndExpectQuicResponse("hello!");
+  SendRequestAndExpectQuicResponse(kQuicRespData);
 }
 
 TEST_P(QuicNetworkTransactionTest, HostInAllowlist) {
@@ -5692,7 +5701,7 @@
 
   MockRead http_reads[] = {
       MockRead("HTTP/1.1 200 OK\r\n"), MockRead(alt_svc_header_.data()),
-      MockRead("hello world"),
+      MockRead(kHttpRespData),
       MockRead(SYNCHRONOUS, ERR_TEST_PEER_CLOSE_AFTER_NEXT_MOCK_READ),
       MockRead(ASYNC, OK)};
 
@@ -5717,7 +5726,7 @@
   mock_quic_data.AddRead(
       ASYNC, ConstructServerDataPacket(
                  2, GetNthClientInitiatedBidirectionalStreamId(0), true,
-                 ConstructDataFrame("hello!")));
+                 ConstructDataFrame(kQuicRespData)));
   mock_quic_data.AddWrite(SYNCHRONOUS,
                           ConstructClientAckPacket(packet_num++, 2, 1));
   mock_quic_data.AddRead(ASYNC, ERR_IO_PENDING);  // No more data to read
@@ -5728,8 +5737,8 @@
   AddHangingNonAlternateProtocolSocketData();
   CreateSession();
 
-  SendRequestAndExpectHttpResponse("hello world");
-  SendRequestAndExpectQuicResponse("hello!");
+  SendRequestAndExpectHttpResponse(kHttpRespData);
+  SendRequestAndExpectQuicResponse(kQuicRespData);
 }
 
 TEST_P(QuicNetworkTransactionTest, HostNotInAllowlist) {
@@ -5741,7 +5750,7 @@
 
   MockRead http_reads[] = {
       MockRead("HTTP/1.1 200 OK\r\n"), MockRead(alt_svc_header_.data()),
-      MockRead("hello world"),
+      MockRead(kHttpRespData),
       MockRead(SYNCHRONOUS, ERR_TEST_PEER_CLOSE_AFTER_NEXT_MOCK_READ),
       MockRead(ASYNC, OK)};
 
@@ -5756,8 +5765,8 @@
   AddHangingNonAlternateProtocolSocketData();
   CreateSession();
 
-  SendRequestAndExpectHttpResponse("hello world");
-  SendRequestAndExpectHttpResponse("hello world");
+  SendRequestAndExpectHttpResponse(kHttpRespData);
+  SendRequestAndExpectHttpResponse(kHttpRespData);
 }
 
 class QuicNetworkTransactionWithDestinationTest
@@ -5942,7 +5951,7 @@
     const HttpResponseInfo* response = trans.GetResponseInfo();
     ASSERT_TRUE(response != nullptr);
     ASSERT_TRUE(response->headers.get() != nullptr);
-    EXPECT_EQ("HTTP/1.1 200", response->headers->GetStatusLine());
+    EXPECT_EQ(kQuic200RespStatusLine, response->headers->GetStatusLine());
     EXPECT_TRUE(response->was_fetched_via_spdy);
     EXPECT_TRUE(response->was_alpn_negotiated);
     EXPECT_EQ(QuicHttpStream::ConnectionInfoFromQuicVersion(version_),
@@ -6243,11 +6252,13 @@
   DisablePriorityHeader();
   session_params_.enable_quic = true;
   session_params_.enable_quic_proxies_for_https_urls = true;
+
+  const auto kQuicProxyChain =
+      ProxyChain::ForIpProtection({ProxyServer::FromSchemeHostAndPort(
+          ProxyServer::SCHEME_QUIC, "proxy.example.org", 70)});
   proxy_resolution_service_ =
       ConfiguredProxyResolutionService::CreateFixedFromProxyChainsForTest(
-          {ProxyChain::ForIpProtection({ProxyServer::FromSchemeHostAndPort(
-              ProxyServer::SCHEME_QUIC, "proxy.example.org", 70)})},
-          TRAFFIC_ANNOTATION_FOR_TESTS);
+          {kQuicProxyChain}, TRAFFIC_ANNOTATION_FOR_TESTS);
 
   MockQuicData mock_quic_data(version_);
   int packet_num = 1;
@@ -6270,7 +6281,7 @@
                  1, GetNthClientInitiatedBidirectionalStreamId(0), false,
                  GetResponseHeaders("200")));
 
-  const char get_request[] =
+  const char kGetRequest[] =
       "GET / HTTP/1.1\r\n"
       "Host: mail.example.org\r\n"
       "Connection: keep-alive\r\n\r\n";
@@ -6278,19 +6289,22 @@
       SYNCHRONOUS,
       ConstructClientAckAndDataPacket(
           packet_num++, GetNthClientInitiatedBidirectionalStreamId(0), 1, 1,
-          false, ConstructDataFrame(get_request)));
+          false, ConstructDataFrame(kGetRequest)));
 
-  const char get_response[] =
+  const char kGetResponse[] =
       "HTTP/1.1 200 OK\r\n"
       "Content-Length: 10\r\n\r\n";
+  const char kRespData[] = "0123456789";
+
   mock_quic_data.AddRead(
       ASYNC, ConstructServerDataPacket(
                  2, GetNthClientInitiatedBidirectionalStreamId(0), false,
-                 ConstructDataFrame(get_response)));
+                 ConstructDataFrame(kGetResponse)));
+
   mock_quic_data.AddRead(
       SYNCHRONOUS, ConstructServerDataPacket(
                        3, GetNthClientInitiatedBidirectionalStreamId(0), false,
-                       ConstructDataFrame("0123456789")));
+                       ConstructDataFrame(kRespData)));
   mock_quic_data.AddWrite(SYNCHRONOUS,
                           ConstructClientAckPacket(packet_num++, 3, 2));
   mock_quic_data.AddRead(SYNCHRONOUS, ERR_IO_PENDING);  // No more data to read
@@ -6314,15 +6328,9 @@
 
   request_.url = GURL("https://mail.example.org/");
   AddQuicAlternateProtocolMapping(MockCryptoClientStream::CONFIRM_HANDSHAKE);
-  HttpNetworkTransaction trans(DEFAULT_PRIORITY, session_.get());
-  RunTransaction(&trans);
-  CheckWasHttpResponse(&trans);
-  CheckResponsePort(&trans, 70);
-  CheckResponseData(&trans, "0123456789");
-  CheckUsedQuicProxyServer(&trans);
-
-  // DNS aliases should be empty when using a proxy.
-  EXPECT_TRUE(trans.GetResponseInfo()->dns_aliases.empty());
+  SendRequestAndExpectHttpResponseFromProxy(
+      kRespData, kQuicProxyChain.GetProxyServer(/*chain_index=*/0).GetPort(),
+      kQuicProxyChain);
 
   // Causes MockSSLClientSocket to disconnect, which causes the underlying QUIC
   // proxy socket to disconnect.
@@ -6338,11 +6346,13 @@
   DisablePriorityHeader();
   session_params_.enable_quic = true;
   session_params_.enable_quic_proxies_for_https_urls = true;
+
+  const auto kQuicProxyChain =
+      ProxyChain::ForIpProtection({ProxyServer::FromSchemeHostAndPort(
+          ProxyServer::SCHEME_QUIC, "proxy.example.org", 70)});
   proxy_resolution_service_ =
       ConfiguredProxyResolutionService::CreateFixedFromProxyChainsForTest(
-          {ProxyChain::ForIpProtection({ProxyServer::FromSchemeHostAndPort(
-              ProxyServer::SCHEME_QUIC, "proxy.example.org", 70)})},
-          TRAFFIC_ANNOTATION_FOR_TESTS);
+          {kQuicProxyChain}, TRAFFIC_ANNOTATION_FOR_TESTS);
 
   MockQuicData mock_quic_data(version_);
   int packet_num = 1;
@@ -6381,8 +6391,9 @@
                  2, GetNthClientInitiatedBidirectionalStreamId(0), false,
                  ConstructDataFrame({resp_frame.data(), resp_frame.size()})));
 
+  const char kRespData[] = "0123456789";
   spdy::SpdySerializedFrame data_frame =
-      spdy_util.ConstructSpdyDataFrame(1, "0123456789", true);
+      spdy_util.ConstructSpdyDataFrame(1, kRespData, true);
   mock_quic_data.AddRead(
       SYNCHRONOUS,
       ConstructServerDataPacket(
@@ -6412,15 +6423,12 @@
   CreateSession();
 
   request_.url = GURL("https://mail.example.org/");
-  HttpNetworkTransaction trans(DEFAULT_PRIORITY, session_.get());
-  RunTransaction(&trans);
-  CheckWasSpdyResponse(&trans);
-  CheckResponsePort(&trans, 70);
-  CheckResponseData(&trans, "0123456789");
-  CheckUsedQuicProxyServer(&trans);
+  SendRequestAndExpectSpdyResponseFromProxy(
+      kRespData, kQuicProxyChain.GetProxyServer(/*chain_index=*/0).GetPort(),
+      kQuicProxyChain);
 
-  // Causes MockSSLClientSocket to disconproxyconnecthttpnect, which causes the
-  // underlying QUIC proxy socket to disconnect.
+  // Causes MockSSLClientSocket to disconnect, which causes the underlying QUIC
+  // proxy socket to disconnect.
   NetworkChangeNotifier::NotifyObserversOfIPAddressChangeForTests();
 
   base::RunLoop().RunUntilIdle();
@@ -6434,11 +6442,13 @@
   DisablePriorityHeader();
   session_params_.enable_quic = true;
   session_params_.enable_quic_proxies_for_https_urls = true;
+
+  const auto kQuicProxyChain =
+      ProxyChain::ForIpProtection({ProxyServer::FromSchemeHostAndPort(
+          ProxyServer::SCHEME_QUIC, "proxy.example.org", 70)});
   proxy_resolution_service_ =
       ConfiguredProxyResolutionService::CreateFixedFromProxyChainsForTest(
-          {ProxyChain::ForIpProtection({ProxyServer::FromSchemeHostAndPort(
-              ProxyServer::SCHEME_QUIC, "proxy.example.org", 70)})},
-          TRAFFIC_ANNOTATION_FOR_TESTS);
+          {kQuicProxyChain}, TRAFFIC_ANNOTATION_FOR_TESTS);
 
   MockQuicData mock_quic_data(version_);
   int write_packet_index = 1;
@@ -6461,7 +6471,7 @@
                  1, GetNthClientInitiatedBidirectionalStreamId(0), false,
                  GetResponseHeaders("200")));
 
-  const char get_request_1[] =
+  const char kGetRequest1[] =
       "GET / HTTP/1.1\r\n"
       "Host: mail.example.org\r\n"
       "Connection: keep-alive\r\n\r\n";
@@ -6469,25 +6479,27 @@
       SYNCHRONOUS,
       ConstructClientAckAndDataPacket(
           write_packet_index++, GetNthClientInitiatedBidirectionalStreamId(0),
-          1, 1, false, ConstructDataFrame(get_request_1)));
+          1, 1, false, ConstructDataFrame(kGetRequest1)));
 
-  const char get_response_1[] =
+  const char kGetResponse1[] =
       "HTTP/1.1 200 OK\r\n"
       "Content-Length: 10\r\n\r\n";
+  const char kRespData1[] = "0123456789";
+
   mock_quic_data.AddRead(
       ASYNC, ConstructServerDataPacket(
                  2, GetNthClientInitiatedBidirectionalStreamId(0), false,
-                 ConstructDataFrame(get_response_1)));
+                 ConstructDataFrame(kGetResponse1)));
 
   mock_quic_data.AddRead(
       SYNCHRONOUS, ConstructServerDataPacket(
                        3, GetNthClientInitiatedBidirectionalStreamId(0), false,
-                       ConstructDataFrame("0123456789")));
+                       ConstructDataFrame(kRespData1)));
 
   mock_quic_data.AddWrite(SYNCHRONOUS,
                           ConstructClientAckPacket(write_packet_index++, 3, 2));
 
-  const char get_request_2[] =
+  const char kGetRequest2[] =
       "GET /2 HTTP/1.1\r\n"
       "Host: mail.example.org\r\n"
       "Connection: keep-alive\r\n\r\n";
@@ -6495,20 +6507,22 @@
       SYNCHRONOUS,
       ConstructClientDataPacket(write_packet_index++,
                                 GetNthClientInitiatedBidirectionalStreamId(0),
-                                false, ConstructDataFrame(get_request_2)));
+                                false, ConstructDataFrame(kGetRequest2)));
 
-  const char get_response_2[] =
+  const char kGetResponse2[] =
       "HTTP/1.1 200 OK\r\n"
       "Content-Length: 7\r\n\r\n";
+  const char kRespData2[] = "0123456";
+
   mock_quic_data.AddRead(
       ASYNC, ConstructServerDataPacket(
                  4, GetNthClientInitiatedBidirectionalStreamId(0), false,
-                 ConstructDataFrame(get_response_2)));
+                 ConstructDataFrame(kGetResponse2)));
 
   mock_quic_data.AddRead(
       SYNCHRONOUS, ConstructServerDataPacket(
                        5, GetNthClientInitiatedBidirectionalStreamId(0), false,
-                       ConstructDataFrame("0123456")));
+                       ConstructDataFrame(kRespData2)));
 
   mock_quic_data.AddWrite(SYNCHRONOUS,
                           ConstructClientAckPacket(write_packet_index++, 5, 4));
@@ -6532,20 +6546,14 @@
   CreateSession();
 
   request_.url = GURL("https://mail.example.org/");
-  HttpNetworkTransaction trans_1(DEFAULT_PRIORITY, session_.get());
-  RunTransaction(&trans_1);
-  CheckWasHttpResponse(&trans_1);
-  CheckResponsePort(&trans_1, 70);
-  CheckResponseData(&trans_1, "0123456789");
-  CheckUsedQuicProxyServer(&trans_1);
+  SendRequestAndExpectHttpResponseFromProxy(
+      kRespData1, kQuicProxyChain.GetProxyServer(/*chain_index=*/0).GetPort(),
+      kQuicProxyChain);
 
   request_.url = GURL("https://mail.example.org/2");
-  HttpNetworkTransaction trans_2(DEFAULT_PRIORITY, session_.get());
-  RunTransaction(&trans_2);
-  CheckWasHttpResponse(&trans_2);
-  CheckResponsePort(&trans_2, 70);
-  CheckResponseData(&trans_2, "0123456");
-  CheckUsedQuicProxyServer(&trans_2);
+  SendRequestAndExpectHttpResponseFromProxy(
+      kRespData2, kQuicProxyChain.GetProxyServer(/*chain_index=*/0).GetPort(),
+      kQuicProxyChain);
 
   // Causes MockSSLClientSocket to disconnect, which causes the underlying QUIC
   // proxy socket to disconnect.
@@ -6563,11 +6571,13 @@
   DisablePriorityHeader();
   session_params_.enable_quic = true;
   session_params_.enable_quic_proxies_for_https_urls = true;
+
+  const auto kQuicProxyChain =
+      ProxyChain::ForIpProtection({ProxyServer::FromSchemeHostAndPort(
+          ProxyServer::SCHEME_QUIC, "proxy.example.org", 70)});
   proxy_resolution_service_ =
       ConfiguredProxyResolutionService::CreateFixedFromProxyChainsForTest(
-          {ProxyChain::ForIpProtection({ProxyServer::FromSchemeHostAndPort(
-              ProxyServer::SCHEME_QUIC, "proxy.example.org", 70)})},
-          TRAFFIC_ANNOTATION_FOR_TESTS);
+          {kQuicProxyChain}, TRAFFIC_ANNOTATION_FOR_TESTS);
 
   MockQuicData mock_quic_data(version_);
   int packet_num = 1;
@@ -6593,7 +6603,7 @@
                  GetResponseHeaders("200")));
 
   // GET request, response, and data over QUIC tunnel for first request
-  const char get_request[] =
+  const char kGetRequest[] =
       "GET / HTTP/1.1\r\n"
       "Host: mail.example.org\r\n"
       "Connection: keep-alive\r\n\r\n";
@@ -6601,19 +6611,21 @@
       SYNCHRONOUS,
       ConstructClientAckAndDataPacket(
           packet_num++, GetNthClientInitiatedBidirectionalStreamId(0), 1, 1,
-          false, ConstructDataFrame(get_request)));
+          false, ConstructDataFrame(kGetRequest)));
 
-  const char get_response[] =
+  const char kGetResponse[] =
       "HTTP/1.1 200 OK\r\n"
       "Content-Length: 10\r\n\r\n";
+  const char kRespData1[] = "0123456789";
+
   mock_quic_data.AddRead(
       ASYNC, ConstructServerDataPacket(
                  2, GetNthClientInitiatedBidirectionalStreamId(0), false,
-                 ConstructDataFrame(get_response)));
+                 ConstructDataFrame(kGetResponse)));
   mock_quic_data.AddRead(
       SYNCHRONOUS, ConstructServerDataPacket(
                        3, GetNthClientInitiatedBidirectionalStreamId(0), false,
-                       ConstructDataFrame("0123456789")));
+                       ConstructDataFrame(kRespData1)));
   mock_quic_data.AddWrite(SYNCHRONOUS,
                           ConstructClientAckPacket(packet_num++, 3, 2));
 
@@ -6651,8 +6663,9 @@
                  5, GetNthClientInitiatedBidirectionalStreamId(1), false,
                  ConstructDataFrame({resp_frame.data(), resp_frame.size()})));
 
+  const char kRespData2[] = "0123456";
   spdy::SpdySerializedFrame data_frame =
-      spdy_util.ConstructSpdyDataFrame(1, "0123456", true);
+      spdy_util.ConstructSpdyDataFrame(1, kRespData2, true);
   mock_quic_data.AddRead(
       ASYNC, ConstructServerDataPacket(
                  6, GetNthClientInitiatedBidirectionalStreamId(1), false,
@@ -6692,20 +6705,14 @@
   CreateSession();
 
   request_.url = GURL("https://mail.example.org/");
-  HttpNetworkTransaction trans_1(DEFAULT_PRIORITY, session_.get());
-  RunTransaction(&trans_1);
-  CheckWasHttpResponse(&trans_1);
-  CheckResponsePort(&trans_1, 70);
-  CheckResponseData(&trans_1, "0123456789");
-  CheckUsedQuicProxyServer(&trans_1);
+  SendRequestAndExpectHttpResponseFromProxy(
+      kRespData1, kQuicProxyChain.GetProxyServer(/*chain_index=*/0).GetPort(),
+      kQuicProxyChain);
 
   request_.url = GURL("https://different.example.org/");
-  HttpNetworkTransaction trans_2(DEFAULT_PRIORITY, session_.get());
-  RunTransaction(&trans_2);
-  CheckWasSpdyResponse(&trans_2);
-  CheckResponsePort(&trans_2, 70);
-  CheckResponseData(&trans_2, "0123456");
-  CheckUsedQuicProxyServer(&trans_2);
+  SendRequestAndExpectSpdyResponseFromProxy(
+      kRespData2, kQuicProxyChain.GetProxyServer(/*chain_index=*/0).GetPort(),
+      kQuicProxyChain);
 
   // Causes MockSSLClientSocket to disconnect, which causes the underlying QUIC
   // proxy socket to disconnect.
@@ -6759,7 +6766,7 @@
                  1, GetNthClientInitiatedBidirectionalStreamId(0), false,
                  GetResponseHeaders("200")));
 
-  const char get_request_1[] =
+  const char kGetRequest1[] =
       "GET / HTTP/1.1\r\n"
       "Host: mail.example.org\r\n"
       "Connection: keep-alive\r\n\r\n";
@@ -6767,17 +6774,18 @@
       SYNCHRONOUS,
       ConstructClientAckAndDataPacket(
           write_packet_index++, GetNthClientInitiatedBidirectionalStreamId(0),
-          1, 1, false, ConstructDataFrame(get_request_1)));
+          1, 1, false, ConstructDataFrame(kGetRequest1)));
 
-  const char get_response_1[] =
+  const char kGetResponse1[] =
       "HTTP/1.1 200 OK\r\n"
       "Content-Length: 10\r\n\r\n";
+  const char kTrans1RespData[] = "0123456789";
+
   mock_quic_data_1.AddRead(
       ASYNC, ConstructServerDataPacket(
                  2, GetNthClientInitiatedBidirectionalStreamId(0), false,
-                 ConstructDataFrame(get_response_1)));
+                 ConstructDataFrame(kGetResponse1)));
 
-  const char kTrans1RespData[] = "0123456789";
   mock_quic_data_1.AddRead(
       SYNCHRONOUS, ConstructServerDataPacket(
                        3, GetNthClientInitiatedBidirectionalStreamId(0), false,
@@ -6806,12 +6814,8 @@
   CreateSession();
 
   request_.url = GURL("https://mail.example.org/");
-  HttpNetworkTransaction trans_1(DEFAULT_PRIORITY, session_.get());
-  RunTransaction(&trans_1);
-  CheckWasHttpResponse(&trans_1);
-  CheckResponsePort(&trans_1, kQuicProxyServer.GetPort());
-  CheckResponseData(&trans_1, kTrans1RespData);
-  CheckUsedQuicProxyServer(&trans_1);
+  SendRequestAndExpectHttpResponseFromProxy(kTrans1RespData, 443,
+                                            kQuicProxyChain);
 
   proxy_delegate_->set_proxy_chain(ProxyChain::Direct());
 
@@ -6868,14 +6872,7 @@
 
   request_.url =
       GURL(base::StrCat({"https://", kQuicProxyServer.GetHost(), "/"}));
-  HttpNetworkTransaction trans_2(DEFAULT_PRIORITY, session_.get());
-  RunTransaction(&trans_2);
-  CheckWasQuicResponse(&trans_2);
-  CheckResponsePort(&trans_2, 443);
-  CheckResponseData(&trans_2, kTrans2RespData);
-  const ProxyChain& proxy_chain = trans_2.GetResponseInfo()->proxy_chain;
-  EXPECT_TRUE(proxy_chain.IsValid());
-  ASSERT_TRUE(proxy_chain.is_direct());
+  SendRequestAndExpectQuicResponse(kTrans2RespData);
 
   // Causes MockSSLClientSocket to disconnect, which causes the underlying QUIC
   // proxy socket to disconnect.
@@ -6992,11 +6989,13 @@
   DisablePriorityHeader();
   session_params_.enable_quic = true;
   session_params_.enable_quic_proxies_for_https_urls = true;
+
+  const auto kQuicProxyChain =
+      ProxyChain::ForIpProtection({ProxyServer::FromSchemeHostAndPort(
+          ProxyServer::SCHEME_QUIC, "proxy.example.org", 70)});
   proxy_resolution_service_ =
       ConfiguredProxyResolutionService::CreateFixedFromProxyChainsForTest(
-          {ProxyChain::ForIpProtection({ProxyServer::FromSchemeHostAndPort(
-              ProxyServer::SCHEME_QUIC, "proxy.example.org", 70)})},
-          TRAFFIC_ANNOTATION_FOR_TESTS);
+          {kQuicProxyChain}, TRAFFIC_ANNOTATION_FOR_TESTS);
 
   MockQuicData mock_quic_data(version_);
   int packet_num = 1;
@@ -7044,7 +7043,7 @@
                  2, GetNthClientInitiatedBidirectionalStreamId(1), false,
                  GetResponseHeaders("200")));
 
-  const char get_request[] =
+  const char kGetRequest[] =
       "GET / HTTP/1.1\r\n"
       "Host: mail.example.org\r\n"
       "Connection: keep-alive\r\n\r\n";
@@ -7052,19 +7051,22 @@
       SYNCHRONOUS,
       ConstructClientAckAndDataPacket(
           packet_num++, GetNthClientInitiatedBidirectionalStreamId(1), 2, 2,
-          false, ConstructDataFrame(get_request)));
-  const char get_response[] =
+          false, ConstructDataFrame(kGetRequest)));
+
+  const char kGetResponse[] =
       "HTTP/1.1 200 OK\r\n"
       "Content-Length: 10\r\n\r\n";
+  const char kRespData[] = "0123456789";
+
   mock_quic_data.AddRead(
       ASYNC, ConstructServerDataPacket(
                  3, GetNthClientInitiatedBidirectionalStreamId(1), false,
-                 ConstructDataFrame(get_response)));
+                 ConstructDataFrame(kGetResponse)));
 
   mock_quic_data.AddRead(
       SYNCHRONOUS, ConstructServerDataPacket(
                        4, GetNthClientInitiatedBidirectionalStreamId(1), false,
-                       ConstructDataFrame("0123456789")));
+                       ConstructDataFrame(kRespData)));
   mock_quic_data.AddWrite(SYNCHRONOUS,
                           ConstructClientAckPacket(packet_num++, 4, 3));
   mock_quic_data.AddRead(SYNCHRONOUS, ERR_IO_PENDING);  // No more data to read
@@ -7101,9 +7103,10 @@
   EXPECT_EQ(OK, callback.WaitForResult());
 
   CheckWasHttpResponse(&trans);
-  CheckResponsePort(&trans, 70);
-  CheckResponseData(&trans, "0123456789");
-  CheckUsedQuicProxyServer(&trans);
+  CheckResponsePort(
+      &trans, kQuicProxyChain.GetProxyServer(/*chain_index=*/0).GetPort());
+  CheckResponseData(&trans, kRespData);
+  EXPECT_EQ(trans.GetResponseInfo()->proxy_chain, kQuicProxyChain);
 
   // Causes MockSSLClientSocket to disconnect, which causes the underlying QUIC
   // proxy socket to disconnect.
@@ -7562,10 +7565,11 @@
           ASYNC, server_maker1.MakeResponseHeadersPacket(
                      1, GetNthClientInitiatedBidirectionalStreamId(0), false,
                      GetResponseHeaders("200"), nullptr));
+      const char kRespData1[] = "1";
       unpartitioned_mock_quic_data.AddRead(
           ASYNC, server_maker1.MakeDataPacket(
                      2, GetNthClientInitiatedBidirectionalStreamId(0), true,
-                     ConstructDataFrame("1")));
+                     ConstructDataFrame(kRespData1)));
       unpartitioned_mock_quic_data.AddWrite(
           SYNCHRONOUS, ConstructClientAckPacket(packet_num++, 2, 1));
 
@@ -7579,10 +7583,11 @@
           ASYNC, server_maker1.MakeResponseHeadersPacket(
                      3, GetNthClientInitiatedBidirectionalStreamId(1), false,
                      GetResponseHeaders("200"), nullptr));
+      const char kRespData2[] = "2";
       unpartitioned_mock_quic_data.AddRead(
           ASYNC, server_maker1.MakeDataPacket(
                      4, GetNthClientInitiatedBidirectionalStreamId(1), true,
-                     ConstructDataFrame("2")));
+                     ConstructDataFrame(kRespData2)));
       unpartitioned_mock_quic_data.AddWrite(
           SYNCHRONOUS, ConstructClientAckPacket(packet_num++, 4, 3));
 
@@ -7596,10 +7601,11 @@
           ASYNC, server_maker1.MakeResponseHeadersPacket(
                      5, GetNthClientInitiatedBidirectionalStreamId(2), false,
                      GetResponseHeaders("200"), nullptr));
+      const char kRespData3[] = "3";
       unpartitioned_mock_quic_data.AddRead(
           ASYNC, server_maker1.MakeDataPacket(
                      6, GetNthClientInitiatedBidirectionalStreamId(2), true,
-                     ConstructDataFrame("3")));
+                     ConstructDataFrame(kRespData3)));
       unpartitioned_mock_quic_data.AddWrite(
           SYNCHRONOUS, ConstructClientAckPacket(packet_num++, 6, 5));
 
@@ -7642,7 +7648,7 @@
       partitioned_mock_quic_data1.AddRead(
           ASYNC, server_maker2.MakeDataPacket(
                      2, GetNthClientInitiatedBidirectionalStreamId(0), true,
-                     ConstructDataFrame("1")));
+                     ConstructDataFrame(kRespData1)));
       partitioned_mock_quic_data1.AddWrite(
           SYNCHRONOUS, client_maker2.MakeAckPacket(packet_num2++, 2, 1));
 
@@ -7659,7 +7665,7 @@
       partitioned_mock_quic_data1.AddRead(
           ASYNC, server_maker2.MakeDataPacket(
                      4, GetNthClientInitiatedBidirectionalStreamId(1), true,
-                     ConstructDataFrame("3")));
+                     ConstructDataFrame(kRespData3)));
       partitioned_mock_quic_data1.AddWrite(
           SYNCHRONOUS, client_maker2.MakeAckPacket(packet_num2++, 4, 3));
 
@@ -7700,7 +7706,7 @@
       partitioned_mock_quic_data2.AddRead(
           ASYNC, server_maker3.MakeDataPacket(
                      2, GetNthClientInitiatedBidirectionalStreamId(0), true,
-                     ConstructDataFrame("2")));
+                     ConstructDataFrame(kRespData2)));
       partitioned_mock_quic_data2.AddWrite(
           SYNCHRONOUS, client_maker3.MakeAckPacket(packet_num3++, 2, 1));
 
@@ -7728,7 +7734,7 @@
       EXPECT_THAT(callback.GetResult(rv), IsOk());
       std::string response_data1;
       EXPECT_THAT(ReadTransaction(&trans1, &response_data1), IsOk());
-      EXPECT_EQ("1", response_data1);
+      EXPECT_EQ(kRespData1, response_data1);
 
       HttpRequestInfo request2;
       request2.method = "GET";
@@ -7742,7 +7748,7 @@
       EXPECT_THAT(callback.GetResult(rv), IsOk());
       std::string response_data2;
       EXPECT_THAT(ReadTransaction(&trans2, &response_data2), IsOk());
-      EXPECT_EQ("2", response_data2);
+      EXPECT_EQ(kRespData2, response_data2);
 
       HttpRequestInfo request3;
       request3.method = "GET";
@@ -7757,7 +7763,7 @@
       EXPECT_THAT(callback.GetResult(rv), IsOk());
       std::string response_data3;
       EXPECT_THAT(ReadTransaction(&trans3, &response_data3), IsOk());
-      EXPECT_EQ("3", response_data3);
+      EXPECT_EQ(kRespData3, response_data3);
 
       if (partition_connections) {
         EXPECT_TRUE(partitioned_mock_quic_data1.AllReadDataConsumed());
@@ -7795,6 +7801,7 @@
   const char kGetResponse[] =
       "HTTP/1.1 200 OK\r\n"
       "Content-Length: 10\r\n\r\n";
+  const char kRespData[] = "0123456789";
 
   std::unique_ptr<MockQuicData> mock_quic_data[2] = {
       std::make_unique<MockQuicData>(version_),
@@ -7822,7 +7829,6 @@
             packet_num++, GetNthClientInitiatedBidirectionalStreamId(0),
             quic::HttpStreamPriority::kDefaultUrgency));
 
-    std::cout << "MakeRequestHeadersPacket\n";
     mock_quic_data[index]->AddWrite(
         SYNCHRONOUS,
         client_maker.MakeRequestHeadersPacket(
@@ -7847,7 +7853,7 @@
     mock_quic_data[index]->AddRead(
         SYNCHRONOUS, server_maker.MakeDataPacket(
                          3, GetNthClientInitiatedBidirectionalStreamId(0),
-                         false, ConstructDataFrame("0123456789")));
+                         false, ConstructDataFrame(kRespData)));
     mock_quic_data[index]->AddWrite(
         SYNCHRONOUS, client_maker.MakeAckPacket(packet_num++, 3, 2));
     mock_quic_data[index]->AddRead(SYNCHRONOUS,
@@ -7866,16 +7872,15 @@
   AddQuicAlternateProtocolMapping(MockCryptoClientStream::CONFIRM_HANDSHAKE);
   HttpNetworkTransaction trans(DEFAULT_PRIORITY, session_.get());
   RunTransaction(&trans);
-  CheckResponseData(&trans, "0123456789");
+  CheckResponseData(&trans, kRespData);
 
-  HttpRequestInfo request2;
   const SchemefulSite kSite1(GURL("http://origin1/"));
   request_.network_isolation_key = NetworkIsolationKey(kSite1, kSite1);
   request_.network_anonymization_key =
       NetworkAnonymizationKey::CreateSameSite(kSite1);
   HttpNetworkTransaction trans2(DEFAULT_PRIORITY, session_.get());
   RunTransaction(&trans2);
-  CheckResponseData(&trans2, "0123456789");
+  CheckResponseData(&trans2, kRespData);
 
   EXPECT_TRUE(mock_quic_data[0]->AllReadDataConsumed());
   EXPECT_TRUE(mock_quic_data[0]->AllWriteDataConsumed());
@@ -7914,13 +7919,13 @@
   int write_packet_index = 1;
   mock_quic_data.AddWrite(SYNCHRONOUS,
                           ConstructInitialSettingsPacket(write_packet_index++));
-  const std::string upload_content = "foo";
+  const std::string kUploadContent = "foo";
   mock_quic_data.AddWrite(
       SYNCHRONOUS,
       ConstructClientRequestHeadersAndDataFramesPacket(
           write_packet_index++, GetNthClientInitiatedBidirectionalStreamId(0),
           true, DEFAULT_PRIORITY, GetRequestHeaders("POST", "https", "/"),
-          nullptr, {ConstructDataFrame(upload_content)}));
+          nullptr, {ConstructDataFrame(kUploadContent)}));
   mock_quic_data.AddRead(
       ASYNC, ConstructServerResponseHeadersPacket(
                  1, GetNthClientInitiatedBidirectionalStreamId(0), false,
@@ -7929,7 +7934,7 @@
   mock_quic_data.AddRead(
       ASYNC, ConstructServerDataPacket(
                  2, GetNthClientInitiatedBidirectionalStreamId(0), true,
-                 ConstructDataFrame("hello!")));
+                 ConstructDataFrame(kQuicRespData)));
 
   mock_quic_data.AddWrite(SYNCHRONOUS,
                           ConstructClientAckPacket(write_packet_index++, 2, 1));
@@ -7944,10 +7949,10 @@
 
   CreateSession();
   request_.method = "POST";
-  UploadDataStreamNotAllowHTTP1 upload_data(upload_content);
+  UploadDataStreamNotAllowHTTP1 upload_data(kUploadContent);
   request_.upload_data_stream = &upload_data;
 
-  SendRequestAndExpectQuicResponse("hello!");
+  SendRequestAndExpectQuicResponse(kQuicRespData);
 }
 
 TEST_P(QuicNetworkTransactionTest, AllowHTTP1UploadPauseAndResume) {
@@ -7963,13 +7968,13 @@
   client_maker_->SetEncryptionLevel(quic::ENCRYPTION_FORWARD_SECURE);
   mock_quic_data.AddWrite(SYNCHRONOUS,
                           ConstructInitialSettingsPacket(write_packet_index++));
-  const std::string upload_content = "foo";
+  const std::string kUploadContent = "foo";
   mock_quic_data.AddWrite(
       SYNCHRONOUS,
       ConstructClientRequestHeadersAndDataFramesPacket(
           write_packet_index++, GetNthClientInitiatedBidirectionalStreamId(0),
           true, DEFAULT_PRIORITY, GetRequestHeaders("POST", "https", "/"),
-          nullptr, {ConstructDataFrame(upload_content)}));
+          nullptr, {ConstructDataFrame(kUploadContent)}));
   mock_quic_data.AddRead(
       SYNCHRONOUS, ConstructServerResponseHeadersPacket(
                        1, GetNthClientInitiatedBidirectionalStreamId(0), false,
@@ -7977,7 +7982,7 @@
   mock_quic_data.AddRead(
       SYNCHRONOUS, ConstructServerDataPacket(
                        2, GetNthClientInitiatedBidirectionalStreamId(0), true,
-                       ConstructDataFrame("hello!")));
+                       ConstructDataFrame(kQuicRespData)));
 
   mock_quic_data.AddWrite(SYNCHRONOUS,
                           ConstructClientAckPacket(write_packet_index++, 2, 1));
@@ -7993,7 +7998,7 @@
 
   // Set up request.
   request_.method = "POST";
-  UploadDataStreamNotAllowHTTP1 upload_data(upload_content);
+  UploadDataStreamNotAllowHTTP1 upload_data(kUploadContent);
   request_.upload_data_stream = &upload_data;
 
   HttpNetworkTransaction trans(DEFAULT_PRIORITY, session_.get());
@@ -8007,7 +8012,7 @@
   socket_data->Resume();
 
   base::RunLoop().RunUntilIdle();
-  CheckResponseData(&trans, "hello!");
+  CheckResponseData(&trans, kQuicRespData);
 }
 
 TEST_P(QuicNetworkTransactionTest, AllowHTTP1UploadFailH1AndResumeQuic) {
@@ -8035,13 +8040,13 @@
   client_maker_->SetEncryptionLevel(quic::ENCRYPTION_FORWARD_SECURE);
   mock_quic_data.AddWrite(SYNCHRONOUS,
                           ConstructInitialSettingsPacket(write_packet_index++));
-  const std::string upload_content = "foo";
+  const std::string kUploadContent = "foo";
   mock_quic_data.AddWrite(
       SYNCHRONOUS,
       ConstructClientRequestHeadersAndDataFramesPacket(
           write_packet_index++, GetNthClientInitiatedBidirectionalStreamId(0),
           true, DEFAULT_PRIORITY, GetRequestHeaders("POST", "https", "/"),
-          nullptr, {ConstructDataFrame(upload_content)}));
+          nullptr, {ConstructDataFrame(kUploadContent)}));
   mock_quic_data.AddRead(
       SYNCHRONOUS, ConstructServerResponseHeadersPacket(
                        1, GetNthClientInitiatedBidirectionalStreamId(0), false,
@@ -8049,7 +8054,7 @@
   mock_quic_data.AddRead(
       SYNCHRONOUS, ConstructServerDataPacket(
                        2, GetNthClientInitiatedBidirectionalStreamId(0), true,
-                       ConstructDataFrame("hello!")));
+                       ConstructDataFrame(kQuicRespData)));
   mock_quic_data.AddWrite(SYNCHRONOUS,
                           ConstructClientAckPacket(write_packet_index++, 2, 1));
   mock_quic_data.AddRead(ASYNC, ERR_IO_PENDING);  // No more data to read
@@ -8080,7 +8085,7 @@
 
   // Set up request.
   request_.method = "POST";
-  UploadDataStreamNotAllowHTTP1 upload_data(upload_content);
+  UploadDataStreamNotAllowHTTP1 upload_data(kUploadContent);
   request_.upload_data_stream = &upload_data;
 
   HttpNetworkTransaction trans(DEFAULT_PRIORITY, session_.get());
@@ -8098,7 +8103,7 @@
       ->NotifySessionOneRttKeyAvailable();
   socket_data->Resume();
   base::RunLoop().RunUntilIdle();
-  CheckResponseData(&trans, "hello!");
+  CheckResponseData(&trans, kQuicRespData);
 }
 
 TEST_P(QuicNetworkTransactionTest, IncorrectHttp3GoAway) {
@@ -8204,10 +8209,10 @@
   mock_quic_data1.AddRead(ASYNC, ConstructServerResponseHeadersPacket(
                                      read_packet_number1++, stream_id1, false,
                                      GetResponseHeaders("200")));
+  const char kRespData1[] = "response on the first connection";
   mock_quic_data1.AddRead(
-      ASYNC, ConstructServerDataPacket(
-                 read_packet_number1++, stream_id1, true,
-                 ConstructDataFrame("response on the first connection")));
+      ASYNC, ConstructServerDataPacket(read_packet_number1++, stream_id1, true,
+                                       ConstructDataFrame(kRespData1)));
   mock_quic_data1.AddWrite(
       ASYNC, ConstructClientAckPacket(write_packet_number1++, 4, 1));
   // Make socket hang to make sure connection stays in connection pool.
@@ -8243,10 +8248,10 @@
   mock_quic_data2.AddRead(ASYNC, server_maker2.MakeResponseHeadersPacket(
                                      read_packet_number2++, stream_id1, false,
                                      GetResponseHeaders("200"), nullptr));
-  mock_quic_data2.AddRead(
-      ASYNC, server_maker2.MakeDataPacket(
-                 read_packet_number2++, stream_id1, true,
-                 ConstructDataFrame("response on the second connection")));
+  const char kRespData2[] = "response on the second connection";
+  mock_quic_data2.AddRead(ASYNC, server_maker2.MakeDataPacket(
+                                     read_packet_number2++, stream_id1, true,
+                                     ConstructDataFrame(kRespData2)));
   mock_quic_data2.AddWrite(
       ASYNC, client_maker2.MakeAckPacket(write_packet_number2++, 2, 1));
   mock_quic_data2.AddRead(ASYNC, ERR_IO_PENDING);  // No more data to read
@@ -8278,10 +8283,10 @@
   EXPECT_THAT(rv, IsError(ERR_IO_PENDING));
 
   EXPECT_THAT(callback1.WaitForResult(), IsOk());
-  CheckResponseData(&trans1, "response on the first connection");
+  CheckResponseData(&trans1, kRespData1);
 
   EXPECT_THAT(callback2.WaitForResult(), IsOk());
-  CheckResponseData(&trans2, "response on the second connection");
+  CheckResponseData(&trans2, kRespData2);
 
   mock_quic_data1.Resume();
   mock_quic_data2.Resume();
@@ -8327,7 +8332,7 @@
   mock_quic_data.AddRead(
       ASYNC, server_maker_.MakeDataPacket(
                  2, GetNthClientInitiatedBidirectionalStreamId(0), true,
-                 ConstructDataFrame("hello!")));
+                 ConstructDataFrame(kQuicRespData)));
   mock_quic_data.AddWrite(SYNCHRONOUS,
                           ConstructClientAckPacket(packet_num++, 2, 1));
   mock_quic_data.AddRead(ASYNC, ERR_IO_PENDING);  // No more data to read.
@@ -8370,12 +8375,12 @@
   const HttpResponseInfo* response = trans1.GetResponseInfo();
   ASSERT_TRUE(response->headers);
   EXPECT_TRUE(response->was_fetched_via_spdy);
-  EXPECT_EQ("HTTP/1.1 200", response->headers->GetStatusLine());
+  EXPECT_EQ(kQuic200RespStatusLine, response->headers->GetStatusLine());
 
   std::string response_data;
   rv = ReadTransaction(&trans1, &response_data);
   EXPECT_THAT(rv, IsOk());
-  EXPECT_EQ("hello!", response_data);
+  EXPECT_EQ(kQuicRespData, response_data);
 
   HttpRequestInfo request2;
   request2.method = "GET";
@@ -8419,7 +8424,7 @@
   }
   MockRead http_reads[] = {
       MockRead("HTTP/1.1 200 OK\r\n"), MockRead(alt_svc_header_.data()),
-      MockRead("hello world"),
+      MockRead(kHttpRespData),
       MockRead(SYNCHRONOUS, ERR_TEST_PEER_CLOSE_AFTER_NEXT_MOCK_READ),
       MockRead(ASYNC, OK)};
 
@@ -8444,7 +8449,7 @@
   mock_quic_data.AddRead(
       ASYNC, ConstructServerDataPacket(
                  2, GetNthClientInitiatedBidirectionalStreamId(0), true,
-                 ConstructDataFrame("hello!")));
+                 ConstructDataFrame(kQuicRespData)));
   mock_quic_data.AddWrite(SYNCHRONOUS,
                           ConstructClientAckPacket(packet_num++, 2, 1));
   mock_quic_data.AddRead(ASYNC, ERR_IO_PENDING);  // No more data to read
@@ -8479,8 +8484,8 @@
 
   CreateSession();
 
-  SendRequestAndExpectHttpResponse("hello world");
-  SendRequestAndExpectQuicResponse("hello!");
+  SendRequestAndExpectHttpResponse(kHttpRespData);
+  SendRequestAndExpectQuicResponse(kQuicRespData);
 
   HttpRequestInfo request2;
   request2.method = "GET";
@@ -8541,7 +8546,7 @@
   mock_quic_data.AddRead(
       ASYNC, server_maker_.MakeDataPacket(
                  2, GetNthClientInitiatedBidirectionalStreamId(0), true,
-                 ConstructDataFrame("hello!")));
+                 ConstructDataFrame(kQuicRespData)));
   mock_quic_data.AddWrite(SYNCHRONOUS,
                           ConstructClientAckPacket(packet_num++, 2, 1));
   mock_quic_data.AddRead(ASYNC, ERR_IO_PENDING);  // No more data to read.
@@ -8599,12 +8604,12 @@
   const HttpResponseInfo* response = trans1.GetResponseInfo();
   ASSERT_TRUE(response->headers);
   EXPECT_TRUE(response->was_fetched_via_spdy);
-  EXPECT_EQ("HTTP/1.1 200", response->headers->GetStatusLine());
+  EXPECT_EQ(kQuic200RespStatusLine, response->headers->GetStatusLine());
 
   std::string response_data;
   rv = ReadTransaction(&trans1, &response_data);
   EXPECT_THAT(rv, IsOk());
-  EXPECT_EQ("hello!", response_data);
+  EXPECT_EQ(kQuicRespData, response_data);
 
   HttpRequestInfo request2;
   request2.method = "GET";