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

Unified Diff: components/data_reduction_proxy/core/browser/data_reduction_proxy_bypass_protocol_unittest.cc

Issue 1873263002: Convert //components/data_reduction_proxy from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address feedback Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: components/data_reduction_proxy/core/browser/data_reduction_proxy_bypass_protocol_unittest.cc
diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_bypass_protocol_unittest.cc b/components/data_reduction_proxy/core/browser/data_reduction_proxy_bypass_protocol_unittest.cc
index ff58e6c766e5b4c2c47897f42b2dfef1c32ef35b..03d183585af9d7df84ad341d0c6436e5e6801118 100644
--- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_bypass_protocol_unittest.cc
+++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_bypass_protocol_unittest.cc
@@ -6,11 +6,12 @@
#include <stddef.h>
+#include <memory>
#include <utility>
#include "base/macros.h"
+#include "base/memory/ptr_util.h"
#include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
#include "base/message_loop/message_loop.h"
#include "base/metrics/field_trial.h"
#include "base/run_loop.h"
@@ -96,7 +97,7 @@ class DataReductionProxyProtocolTest : public testing::Test {
}
// Sets up the |TestURLRequestContext| with the provided |ProxyService|.
- void ConfigureTestDependencies(scoped_ptr<ProxyService> proxy_service) {
+ void ConfigureTestDependencies(std::unique_ptr<ProxyService> proxy_service) {
// Create a context with delayed initialization.
context_.reset(new TestURLRequestContext(true));
@@ -116,10 +117,10 @@ class DataReductionProxyProtocolTest : public testing::Test {
new DataReductionProxyInterceptor(
test_context_->config(), test_context_->io_data()->config_client(),
bypass_stats_.get(), test_context_->event_creator());
- scoped_ptr<net::URLRequestJobFactoryImpl> job_factory_impl(
+ std::unique_ptr<net::URLRequestJobFactoryImpl> job_factory_impl(
new net::URLRequestJobFactoryImpl());
job_factory_.reset(new net::URLRequestInterceptingJobFactory(
- std::move(job_factory_impl), make_scoped_ptr(interceptor)));
+ std::move(job_factory_impl), base::WrapUnique(interceptor)));
context_->set_job_factory(job_factory_.get());
context_->Init();
@@ -234,10 +235,8 @@ class DataReductionProxyProtocolTest : public testing::Test {
int initial_headers_received_count =
network_delegate_->headers_received_count();
TestDelegate d;
- scoped_ptr<URLRequest> r(context_->CreateRequest(
- GURL("http://www.google.com/"),
- net::DEFAULT_PRIORITY,
- &d));
+ std::unique_ptr<URLRequest> r(context_->CreateRequest(
+ GURL("http://www.google.com/"), net::DEFAULT_PRIORITY, &d));
r->set_method(method);
r->SetLoadFlags(net::LOAD_NORMAL);
@@ -310,18 +309,18 @@ class DataReductionProxyProtocolTest : public testing::Test {
protected:
base::MessageLoopForIO message_loop_;
- scoped_ptr<net::NetworkChangeNotifier> network_change_notifier_;
+ std::unique_ptr<net::NetworkChangeNotifier> network_change_notifier_;
- scoped_ptr<net::URLRequestInterceptor> simple_interceptor_;
+ std::unique_ptr<net::URLRequestInterceptor> simple_interceptor_;
net::MockClientSocketFactory mock_socket_factory_;
- scoped_ptr<net::TestNetworkDelegate> network_delegate_;
- scoped_ptr<ProxyService> proxy_service_;
- scoped_ptr<DataReductionProxyTestContext> test_context_;
- scoped_ptr<DataReductionProxyBypassStats> bypass_stats_;
+ std::unique_ptr<net::TestNetworkDelegate> network_delegate_;
+ std::unique_ptr<ProxyService> proxy_service_;
+ std::unique_ptr<DataReductionProxyTestContext> test_context_;
+ std::unique_ptr<DataReductionProxyBypassStats> bypass_stats_;
net::StaticHttpUserAgentSettings http_user_agent_settings_;
- scoped_ptr<net::URLRequestInterceptingJobFactory> job_factory_;
- scoped_ptr<TestURLRequestContext> context_;
+ std::unique_ptr<net::URLRequestInterceptingJobFactory> job_factory_;
+ std::unique_ptr<TestURLRequestContext> context_;
};
// Tests that request are deemed idempotent or not according to the method used.
@@ -341,10 +340,8 @@ TEST_F(DataReductionProxyProtocolTest, TestIdempotency) {
{ "CONNECT", false },
};
for (size_t i = 0; i < arraysize(tests); ++i) {
- scoped_ptr<net::URLRequest> request(
- context.CreateRequest(GURL("http://www.google.com/"),
- net::DEFAULT_PRIORITY,
- NULL));
+ std::unique_ptr<net::URLRequest> request(context.CreateRequest(
+ GURL("http://www.google.com/"), net::DEFAULT_PRIORITY, NULL));
request->set_method(tests[i].method);
EXPECT_EQ(
tests[i].expected_result,
@@ -803,11 +800,11 @@ class DataReductionProxyBypassProtocolEndToEndTest : public testing::Test {
private:
base::MessageLoopForIO loop_;
- scoped_ptr<net::TestURLRequestContext> context_;
- scoped_ptr<net::URLRequestContextStorage> storage_;
- scoped_ptr<net::MockClientSocketFactory> mock_socket_factory_;
- scoped_ptr<net::ProxyDelegate> proxy_delegate_;
- scoped_ptr<DataReductionProxyTestContext> drp_test_context_;
+ std::unique_ptr<net::TestURLRequestContext> context_;
+ std::unique_ptr<net::URLRequestContextStorage> storage_;
+ std::unique_ptr<net::MockClientSocketFactory> mock_socket_factory_;
+ std::unique_ptr<net::ProxyDelegate> proxy_delegate_;
+ std::unique_ptr<DataReductionProxyTestContext> drp_test_context_;
DISALLOW_COPY_AND_ASSIGN(DataReductionProxyBypassProtocolEndToEndTest);
};
@@ -881,7 +878,7 @@ TEST_F(DataReductionProxyBypassProtocolEndToEndTest,
mock_socket_factory()->AddSocketDataProvider(&retry_socket);
net::TestDelegate delegate;
- scoped_ptr<net::URLRequest> url_request(context()->CreateRequest(
+ std::unique_ptr<net::URLRequest> url_request(context()->CreateRequest(
GURL("http://www.google.com"), net::IDLE, &delegate));
url_request->Start();
drp_test_context()->RunUntilIdle();
@@ -940,7 +937,7 @@ TEST_F(DataReductionProxyBypassProtocolEndToEndTest,
base::HistogramTester histogram_tester;
net::TestDelegate delegate;
- scoped_ptr<net::URLRequest> request(context()->CreateRequest(
+ std::unique_ptr<net::URLRequest> request(context()->CreateRequest(
GURL("http://google.com"), net::IDLE, &delegate));
request->Start();
drp_test_context()->RunUntilIdle();
@@ -975,10 +972,8 @@ TEST_F(DataReductionProxyProtocolTest,
mock_socket_factory_.AddSocketDataProvider(&data1);
TestDelegate d;
- scoped_ptr<URLRequest> r(context_->CreateRequest(
- GURL("http://www.google.com/"),
- net::DEFAULT_PRIORITY,
- &d));
+ std::unique_ptr<URLRequest> r(context_->CreateRequest(
+ GURL("http://www.google.com/"), net::DEFAULT_PRIORITY, &d));
r->set_method("GET");
r->SetLoadFlags(net::LOAD_NORMAL);

Powered by Google App Engine
This is Rietveld 408576698