OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "components/policy/core/common/cloud/user_cloud_policy_manager.h" | 5 #include "components/policy/core/common/cloud/user_cloud_policy_manager.h" |
6 | 6 |
7 #include "base/callback.h" | 7 #include "base/callback.h" |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
(...skipping 18 matching lines...) Expand all Loading... |
29 namespace policy { | 29 namespace policy { |
30 namespace { | 30 namespace { |
31 | 31 |
32 class UserCloudPolicyManagerTest : public testing::Test { | 32 class UserCloudPolicyManagerTest : public testing::Test { |
33 protected: | 33 protected: |
34 UserCloudPolicyManagerTest() : store_(NULL) {} | 34 UserCloudPolicyManagerTest() : store_(NULL) {} |
35 | 35 |
36 void SetUp() override { | 36 void SetUp() override { |
37 // Set up a policy map for testing. | 37 // Set up a policy map for testing. |
38 policy_map_.Set("key", POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, | 38 policy_map_.Set("key", POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, |
39 POLICY_SOURCE_CLOUD, | 39 POLICY_SOURCE_CLOUD, base::MakeUnique<base::Value>("value"), |
40 base::MakeUnique<base::StringValue>("value"), nullptr); | 40 nullptr); |
41 expected_bundle_.Get(PolicyNamespace(POLICY_DOMAIN_CHROME, std::string())) | 41 expected_bundle_.Get(PolicyNamespace(POLICY_DOMAIN_CHROME, std::string())) |
42 .CopyFrom(policy_map_); | 42 .CopyFrom(policy_map_); |
43 } | 43 } |
44 | 44 |
45 void TearDown() override { | 45 void TearDown() override { |
46 if (manager_) { | 46 if (manager_) { |
47 manager_->RemoveObserver(&observer_); | 47 manager_->RemoveObserver(&observer_); |
48 manager_->Shutdown(); | 48 manager_->Shutdown(); |
49 } | 49 } |
50 } | 50 } |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 store_->NotifyStoreLoaded(); | 87 store_->NotifyStoreLoaded(); |
88 EXPECT_TRUE(expected_bundle_.Equals(manager_->policies())); | 88 EXPECT_TRUE(expected_bundle_.Equals(manager_->policies())); |
89 EXPECT_TRUE(manager_->IsInitializationComplete(POLICY_DOMAIN_CHROME)); | 89 EXPECT_TRUE(manager_->IsInitializationComplete(POLICY_DOMAIN_CHROME)); |
90 EXPECT_CALL(*store_, Clear()); | 90 EXPECT_CALL(*store_, Clear()); |
91 manager_->DisconnectAndRemovePolicy(); | 91 manager_->DisconnectAndRemovePolicy(); |
92 EXPECT_FALSE(manager_->core()->service()); | 92 EXPECT_FALSE(manager_->core()->service()); |
93 } | 93 } |
94 | 94 |
95 } // namespace | 95 } // namespace |
96 } // namespace policy | 96 } // namespace policy |
OLD | NEW |