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

Unified Diff: net/quic/chromium/quic_end_to_end_unittest.cc

Issue 2518063007: Pass QuicInMemoryCache directly instead of using a singleton. (Closed)
Patch Set: Fix Cronet compile error Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/net.gypi ('k') | net/quic/core/quic_server_session_base_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/quic/chromium/quic_end_to_end_unittest.cc
diff --git a/net/quic/chromium/quic_end_to_end_unittest.cc b/net/quic/chromium/quic_end_to_end_unittest.cc
index a7720affc7f40a6059ea613ebba9a4c301e2347a..8b7bde71a1d07675fe5844879f977f1cbb4db93b 100644
--- a/net/quic/chromium/quic_end_to_end_unittest.cc
+++ b/net/quic/chromium/quic_end_to_end_unittest.cc
@@ -38,7 +38,6 @@
#include "net/test/test_data_directory.h"
#include "net/tools/quic/quic_in_memory_cache.h"
#include "net/tools/quic/quic_simple_server.h"
-#include "net/tools/quic/test_tools/quic_in_memory_cache_peer.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "testing/platform_test.h"
@@ -48,7 +47,6 @@ using base::StringPiece;
namespace net {
using test::IsOk;
-using test::QuicInMemoryCachePeer;
namespace test {
@@ -153,7 +151,6 @@ class QuicEndToEndTest : public ::testing::TestWithParam<TestParams> {
}
void SetUp() override {
- QuicInMemoryCachePeer::ResetForTests();
StartServer();
// Use a mapped host resolver so that request for test.example.com (port 80)
@@ -170,7 +167,7 @@ class QuicEndToEndTest : public ::testing::TestWithParam<TestParams> {
transaction_factory_.reset(new TestTransactionFactory(params_));
}
- void TearDown() override { QuicInMemoryCachePeer::ResetForTests(); }
+ void TearDown() override {}
// Starts the QUIC server listening on a random port.
void StartServer() {
@@ -180,9 +177,9 @@ class QuicEndToEndTest : public ::testing::TestWithParam<TestParams> {
server_config_.SetInitialSessionFlowControlWindowToSend(
kInitialSessionFlowControlWindowForTest);
server_config_options_.token_binding_params = QuicTagVector{kTB10, kP256};
- server_.reset(new QuicSimpleServer(CryptoTestUtils::ProofSourceForTesting(),
- server_config_, server_config_options_,
- AllSupportedVersions()));
+ server_.reset(new QuicSimpleServer(
+ CryptoTestUtils::ProofSourceForTesting(), server_config_,
+ server_config_options_, AllSupportedVersions(), &in_memory_cache_));
server_->Listen(server_address_);
server_address_ = server_->server_address();
server_->StartReading();
@@ -195,8 +192,8 @@ class QuicEndToEndTest : public ::testing::TestWithParam<TestParams> {
int response_code,
StringPiece response_detail,
StringPiece body) {
- QuicInMemoryCache::GetInstance()->AddSimpleResponse(
- "test.example.com", path, response_code, body);
+ in_memory_cache_.AddSimpleResponse("test.example.com", path, response_code,
+ body);
}
// Populates |request_body_| with |length_| ASCII bytes.
@@ -251,6 +248,7 @@ class QuicEndToEndTest : public ::testing::TestWithParam<TestParams> {
std::string request_body_;
std::unique_ptr<UploadDataStream> upload_data_stream_;
std::unique_ptr<QuicSimpleServer> server_;
+ QuicInMemoryCache in_memory_cache_;
IPEndPoint server_address_;
std::string server_hostname_;
QuicConfig server_config_;
« no previous file with comments | « net/net.gypi ('k') | net/quic/core/quic_server_session_base_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698