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

Unified Diff: components/policy/core/common/cloud/policy_header_service_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_service_unittest.cc
diff --git a/components/policy/core/common/cloud/policy_header_service_unittest.cc b/components/policy/core/common/cloud/policy_header_service_unittest.cc
index 54d2aba0ec4fde853d9a53d96b25023dc3022593..423859fb7653cc3eb7e2bdc9e938ca04aff4a9fd 100644
--- a/components/policy/core/common/cloud/policy_header_service_unittest.cc
+++ b/components/policy/core/common/cloud/policy_header_service_unittest.cc
@@ -4,11 +4,11 @@
#include "components/policy/core/common/cloud/policy_header_service.h"
+#include <memory>
#include <utility>
#include "base/base64.h"
#include "base/json/json_reader.h"
-#include "base/memory/scoped_ptr.h"
#include "base/test/test_simple_task_runner.h"
#include "base/values.h"
#include "components/policy/core/common/cloud/cloud_policy_constants.h"
@@ -28,7 +28,7 @@ const char kPolicyHeaderName[] = "Chrome-Policy-Posture";
class TestCloudPolicyStore : public MockCloudPolicyStore {
public:
- void SetPolicy(scoped_ptr<PolicyData> policy) {
+ void SetPolicy(std::unique_ptr<PolicyData> policy) {
policy_ = std::move(policy);
// Notify observers.
NotifyStoreLoaded();
@@ -70,7 +70,7 @@ class PolicyHeaderServiceTest : public testing::Test {
std::string decoded;
base::Base64Decode(header, &decoded);
// Parse the JSON.
- scoped_ptr<base::Value> value = base::JSONReader::Read(decoded);
+ std::unique_ptr<base::Value> value = base::JSONReader::Read(decoded);
ASSERT_TRUE(value);
base::DictionaryValue* dict;
EXPECT_TRUE(value->GetAsDictionary(&dict));
@@ -85,10 +85,10 @@ class PolicyHeaderServiceTest : public testing::Test {
}
base::MessageLoop loop_;
- scoped_ptr<PolicyHeaderService> service_;
+ std::unique_ptr<PolicyHeaderService> service_;
TestCloudPolicyStore user_store_;
TestCloudPolicyStore device_store_;
- scoped_ptr<PolicyHeaderIOHelper> helper_;
+ std::unique_ptr<PolicyHeaderIOHelper> helper_;
scoped_refptr<base::TestSimpleTaskRunner> task_runner_;
};
@@ -102,7 +102,7 @@ TEST_F(PolicyHeaderServiceTest, TestCreationAndShutdown) {
TEST_F(PolicyHeaderServiceTest, TestWithAndWithoutPolicyHeader) {
// Set policy - this should push a header to the PolicyHeaderIOHelper.
- scoped_ptr<PolicyData> policy(new PolicyData());
+ std::unique_ptr<PolicyData> policy(new PolicyData());
std::string expected_dmtoken = "expected_dmtoken";
std::string expected_policy_token = "expected_dmtoken";
policy->set_request_token(expected_dmtoken);
@@ -111,18 +111,18 @@ TEST_F(PolicyHeaderServiceTest, TestWithAndWithoutPolicyHeader) {
task_runner_->RunUntilIdle();
net::TestURLRequestContext context;
- 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(), expected_dmtoken,
expected_policy_token);
// Now blow away the policy data.
- user_store_.SetPolicy(scoped_ptr<PolicyData>());
+ user_store_.SetPolicy(std::unique_ptr<PolicyData>());
task_runner_->RunUntilIdle();
- scoped_ptr<net::URLRequest> request2(context.CreateRequest(
- GURL(kDMServerURL), net::DEFAULT_PRIORITY, NULL));
+ std::unique_ptr<net::URLRequest> request2(
+ context.CreateRequest(GURL(kDMServerURL), net::DEFAULT_PRIORITY, NULL));
helper_->AddPolicyHeaders(request2->url(), request2.get());
ValidateHeader(request2->extra_request_headers(), "", "");
}

Powered by Google App Engine
This is Rietveld 408576698