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

Side by Side Diff: components/policy/core/common/cloud/user_cloud_policy_manager_unittest.cc

Issue 1348903007: Revert of Add source column to chrome://policy showing the origins of policies. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 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 unified diff | Download patch
OLDNEW
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/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "base/sequenced_task_runner.h" 9 #include "base/sequenced_task_runner.h"
10 #include "components/policy/core/common/cloud/cloud_external_data_manager.h" 10 #include "components/policy/core/common/cloud/cloud_external_data_manager.h"
11 #include "components/policy/core/common/cloud/mock_user_cloud_policy_store.h" 11 #include "components/policy/core/common/cloud/mock_user_cloud_policy_store.h"
12 #include "components/policy/core/common/external_data_fetcher.h" 12 #include "components/policy/core/common/external_data_fetcher.h"
13 #include "components/policy/core/common/mock_configuration_policy_provider.h" 13 #include "components/policy/core/common/mock_configuration_policy_provider.h"
14 #include "components/policy/core/common/policy_types.h"
15 #include "components/policy/core/common/schema_registry.h" 14 #include "components/policy/core/common/schema_registry.h"
16 #include "net/url_request/url_request_context_getter.h" 15 #include "net/url_request/url_request_context_getter.h"
17 #include "testing/gmock/include/gmock/gmock.h" 16 #include "testing/gmock/include/gmock/gmock.h"
18 #include "testing/gtest/include/gtest/gtest.h" 17 #include "testing/gtest/include/gtest/gtest.h"
19 18
20 namespace em = enterprise_management; 19 namespace em = enterprise_management;
21 20
22 using testing::AnyNumber; 21 using testing::AnyNumber;
23 using testing::AtLeast; 22 using testing::AtLeast;
24 using testing::Mock; 23 using testing::Mock;
25 using testing::_; 24 using testing::_;
26 25
27 namespace policy { 26 namespace policy {
28 namespace { 27 namespace {
29 28
30 class UserCloudPolicyManagerTest : public testing::Test { 29 class UserCloudPolicyManagerTest : public testing::Test {
31 protected: 30 protected:
32 UserCloudPolicyManagerTest() : store_(NULL) {} 31 UserCloudPolicyManagerTest() : store_(NULL) {}
33 32
34 void SetUp() override { 33 void SetUp() override {
35 // Set up a policy map for testing. 34 // Set up a policy map for testing.
36 policy_map_.Set("key", 35 policy_map_.Set("key",
37 POLICY_LEVEL_MANDATORY, 36 POLICY_LEVEL_MANDATORY,
38 POLICY_SCOPE_USER, 37 POLICY_SCOPE_USER,
39 POLICY_SOURCE_CLOUD,
40 new base::StringValue("value"), 38 new base::StringValue("value"),
41 NULL); 39 NULL);
42 expected_bundle_.Get(PolicyNamespace(POLICY_DOMAIN_CHROME, std::string())) 40 expected_bundle_.Get(PolicyNamespace(POLICY_DOMAIN_CHROME, std::string()))
43 .CopyFrom(policy_map_); 41 .CopyFrom(policy_map_);
44 } 42 }
45 43
46 void TearDown() override { 44 void TearDown() override {
47 if (manager_) { 45 if (manager_) {
48 manager_->RemoveObserver(&observer_); 46 manager_->RemoveObserver(&observer_);
49 manager_->Shutdown(); 47 manager_->Shutdown();
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 store_->NotifyStoreLoaded(); 86 store_->NotifyStoreLoaded();
89 EXPECT_TRUE(expected_bundle_.Equals(manager_->policies())); 87 EXPECT_TRUE(expected_bundle_.Equals(manager_->policies()));
90 EXPECT_TRUE(manager_->IsInitializationComplete(POLICY_DOMAIN_CHROME)); 88 EXPECT_TRUE(manager_->IsInitializationComplete(POLICY_DOMAIN_CHROME));
91 EXPECT_CALL(*store_, Clear()); 89 EXPECT_CALL(*store_, Clear());
92 manager_->DisconnectAndRemovePolicy(); 90 manager_->DisconnectAndRemovePolicy();
93 EXPECT_FALSE(manager_->core()->service()); 91 EXPECT_FALSE(manager_->core()->service());
94 } 92 }
95 93
96 } // namespace 94 } // namespace
97 } // namespace policy 95 } // namespace policy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698