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

Unified Diff: components/policy/core/common/cloud/policy_header_io_helper_unittest.cc

Issue 1902633006: Convert //components/policy from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address comments and use namespace alias 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/policy/core/common/cloud/policy_header_io_helper_unittest.cc
diff --git a/components/policy/core/common/cloud/policy_header_io_helper_unittest.cc b/components/policy/core/common/cloud/policy_header_io_helper_unittest.cc
index 3a5adf8d56e4aa98fb0e07e71165eed9e4867a56..cf0cbc74c2d3b529cee8d9d95147fdf6d0db2ab5 100644
--- a/components/policy/core/common/cloud/policy_header_io_helper_unittest.cc
+++ b/components/policy/core/common/cloud/policy_header_io_helper_unittest.cc
@@ -2,9 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "base/memory/scoped_ptr.h"
-#include "base/test/test_simple_task_runner.h"
#include "components/policy/core/common/cloud/policy_header_io_helper.h"
+
+#include <memory>
+
+#include "base/memory/ptr_util.h"
+#include "base/test/test_simple_task_runner.h"
#include "net/http/http_request_headers.h"
#include "net/url_request/url_request.h"
#include "net/url_request/url_request_test_util.h"
@@ -25,9 +28,8 @@ class PolicyHeaderIOHelperTest : public testing::Test {
~PolicyHeaderIOHelperTest() override {}
void SetUp() override {
- helper_ = make_scoped_ptr(new PolicyHeaderIOHelper(kDMServerURL,
- kInitialPolicyHeader,
- task_runner_));
+ helper_ = base::WrapUnique(new PolicyHeaderIOHelper(
+ kDMServerURL, kInitialPolicyHeader, task_runner_));
task_runner_->RunUntilIdle();
}
void TearDown() override {
@@ -43,7 +45,7 @@ class PolicyHeaderIOHelperTest : public testing::Test {
}
base::MessageLoop loop_;
- scoped_ptr<PolicyHeaderIOHelper> helper_;
+ std::unique_ptr<PolicyHeaderIOHelper> helper_;
net::TestURLRequestContext context_;
scoped_refptr<base::TestSimpleTaskRunner> task_runner_;
};
@@ -51,14 +53,14 @@ class PolicyHeaderIOHelperTest : public testing::Test {
} // namespace
TEST_F(PolicyHeaderIOHelperTest, InitialHeader) {
- scoped_ptr<net::URLRequest> request(context_.CreateRequest(
- GURL(kDMServerURL), net::DEFAULT_PRIORITY, NULL));
+ std::unique_ptr<net::URLRequest> request(
+ context_.CreateRequest(GURL(kDMServerURL), net::DEFAULT_PRIORITY, NULL));
helper_->AddPolicyHeaders(request->url(), request.get());
ValidateHeader(request->extra_request_headers(), kInitialPolicyHeader);
}
TEST_F(PolicyHeaderIOHelperTest, NoHeaderOnNonMatchingURL) {
- scoped_ptr<net::URLRequest> request(context_.CreateRequest(
+ std::unique_ptr<net::URLRequest> request(context_.CreateRequest(
GURL("http://non-matching.com"), net::DEFAULT_PRIORITY, NULL));
helper_->AddPolicyHeaders(request->url(), request.get());
EXPECT_TRUE(request->extra_request_headers().IsEmpty());
@@ -68,8 +70,8 @@ TEST_F(PolicyHeaderIOHelperTest, HeaderChange) {
std::string new_header = "new_header";
helper_->UpdateHeader(new_header);
task_runner_->RunUntilIdle();
- scoped_ptr<net::URLRequest> request(context_.CreateRequest(
- GURL(kDMServerURL), net::DEFAULT_PRIORITY, NULL));
+ std::unique_ptr<net::URLRequest> request(
+ context_.CreateRequest(GURL(kDMServerURL), net::DEFAULT_PRIORITY, NULL));
helper_->AddPolicyHeaders(request->url(), request.get());
ValidateHeader(request->extra_request_headers(), new_header);
}
@@ -77,8 +79,8 @@ TEST_F(PolicyHeaderIOHelperTest, HeaderChange) {
TEST_F(PolicyHeaderIOHelperTest, ChangeToNoHeader) {
helper_->UpdateHeader("");
task_runner_->RunUntilIdle();
- scoped_ptr<net::URLRequest> request(context_.CreateRequest(
- GURL(kDMServerURL), net::DEFAULT_PRIORITY, NULL));
+ std::unique_ptr<net::URLRequest> request(
+ context_.CreateRequest(GURL(kDMServerURL), net::DEFAULT_PRIORITY, NULL));
helper_->AddPolicyHeaders(request->url(), request.get());
EXPECT_TRUE(request->extra_request_headers().IsEmpty());
}
« no previous file with comments | « components/policy/core/common/cloud/policy_builder.cc ('k') | components/policy/core/common/cloud/policy_header_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698