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

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

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

Powered by Google App Engine
This is Rietveld 408576698