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

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

Issue 762863002: Removed policy::PolicyNamespaceKey. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: pass values in ctors Created 6 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
Index: components/policy/core/common/cloud/cloud_policy_service_unittest.cc
diff --git a/components/policy/core/common/cloud/cloud_policy_service_unittest.cc b/components/policy/core/common/cloud/cloud_policy_service_unittest.cc
index 005316618670f73ff4655c600a5ec9b975619b42..0c82bb08c30dfdf705bb049ac8f635c310ffd71a 100644
--- a/components/policy/core/common/cloud/cloud_policy_service_unittest.cc
+++ b/components/policy/core/common/cloud/cloud_policy_service_unittest.cc
@@ -32,24 +32,24 @@ class MockCloudPolicyServiceObserver : public CloudPolicyService::Observer {
class CloudPolicyServiceTest : public testing::Test {
public:
CloudPolicyServiceTest()
- : policy_ns_key_(dm_protocol::kChromeUserPolicyType, std::string()),
- service_(policy_ns_key_, &client_, &store_) {}
+ : policy_type_(dm_protocol::kChromeUserPolicyType),
+ service_(policy_type_, std::string(), &client_, &store_) {}
MOCK_METHOD1(OnPolicyRefresh, void(bool));
protected:
- PolicyNamespaceKey policy_ns_key_;
+ std::string policy_type_;
MockCloudPolicyClient client_;
MockCloudPolicyStore store_;
CloudPolicyService service_;
};
-MATCHER_P(ProtoMatches, proto, "") {
+MATCHER_P(ProtoMatches, proto, std::string()) {
return arg.SerializePartialAsString() == proto.SerializePartialAsString();
}
TEST_F(CloudPolicyServiceTest, ManagedByEmptyPolicy) {
- EXPECT_EQ("", service_.ManagedBy());
+ EXPECT_EQ(std::string(), service_.ManagedBy());
}
TEST_F(CloudPolicyServiceTest, ManagedByValidPolicy) {
@@ -61,7 +61,7 @@ TEST_F(CloudPolicyServiceTest, ManagedByValidPolicy) {
TEST_F(CloudPolicyServiceTest, PolicyUpdateSuccess) {
em::PolicyFetchResponse policy;
policy.set_policy_data("fake policy");
- client_.SetPolicy(policy_ns_key_, policy);
+ client_.SetPolicy(policy_type_, std::string(), policy);
EXPECT_CALL(store_, Store(ProtoMatches(policy))).Times(1);
client_.NotifyPolicyFetched();
@@ -104,7 +104,7 @@ TEST_F(CloudPolicyServiceTest, RefreshPolicySuccess) {
// Client responds, push policy to store.
em::PolicyFetchResponse policy;
policy.set_policy_data("fake policy");
- client_.SetPolicy(policy_ns_key_, policy);
+ client_.SetPolicy(policy_type_, std::string(), policy);
client_.fetched_invalidation_version_ = 12345;
EXPECT_CALL(store_, Store(ProtoMatches(policy))).Times(1);
EXPECT_EQ(0, store_.invalidation_version());
@@ -160,7 +160,7 @@ TEST_F(CloudPolicyServiceTest, RefreshPolicyStoreError) {
// Client responds, push policy to store.
em::PolicyFetchResponse policy;
policy.set_policy_data("fake policy");
- client_.SetPolicy(policy_ns_key_, policy);
+ client_.SetPolicy(policy_type_, std::string(), policy);
EXPECT_CALL(store_, Store(ProtoMatches(policy))).Times(1);
client_.NotifyPolicyFetched();
@@ -188,7 +188,7 @@ TEST_F(CloudPolicyServiceTest, RefreshPolicyConcurrent) {
// Client responds, push policy to store.
em::PolicyFetchResponse policy;
policy.set_policy_data("fake policy");
- client_.SetPolicy(policy_ns_key_, policy);
+ client_.SetPolicy(policy_type_, std::string(), policy);
EXPECT_CALL(store_, Store(ProtoMatches(policy))).Times(1);
client_.NotifyPolicyFetched();
@@ -214,7 +214,7 @@ TEST_F(CloudPolicyServiceTest, StoreAlreadyInitialized) {
// Service should start off initialized if the store has already loaded
// policy.
store_.NotifyStoreLoaded();
- CloudPolicyService service(policy_ns_key_, &client_, &store_);
+ CloudPolicyService service(policy_type_, std::string(), &client_, &store_);
EXPECT_TRUE(service.IsInitializationComplete());
}

Powered by Google App Engine
This is Rietveld 408576698