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

Side by Side Diff: components/policy/core/common/proxy_policy_provider_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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "base/basictypes.h" 5 #include "base/basictypes.h"
6 #include "base/callback.h" 6 #include "base/callback.h"
7 #include "components/policy/core/common/external_data_fetcher.h" 7 #include "components/policy/core/common/external_data_fetcher.h"
8 #include "components/policy/core/common/mock_configuration_policy_provider.h" 8 #include "components/policy/core/common/mock_configuration_policy_provider.h"
9 #include "components/policy/core/common/policy_types.h"
10 #include "components/policy/core/common/proxy_policy_provider.h" 9 #include "components/policy/core/common/proxy_policy_provider.h"
11 #include "components/policy/core/common/schema_registry.h" 10 #include "components/policy/core/common/schema_registry.h"
12 #include "testing/gmock/include/gmock/gmock.h" 11 #include "testing/gmock/include/gmock/gmock.h"
13 #include "testing/gtest/include/gtest/gtest.h" 12 #include "testing/gtest/include/gtest/gtest.h"
14 13
15 using testing::Mock; 14 using testing::Mock;
16 15
17 namespace policy { 16 namespace policy {
18 17
19 class ProxyPolicyProviderTest : public testing::Test { 18 class ProxyPolicyProviderTest : public testing::Test {
(...skipping 29 matching lines...) Expand all
49 EXPECT_TRUE(proxy_provider_.IsInitializationComplete(POLICY_DOMAIN_CHROME)); 48 EXPECT_TRUE(proxy_provider_.IsInitializationComplete(POLICY_DOMAIN_CHROME));
50 EXPECT_TRUE(PolicyBundle().Equals(proxy_provider_.policies())); 49 EXPECT_TRUE(PolicyBundle().Equals(proxy_provider_.policies()));
51 } 50 }
52 51
53 TEST_F(ProxyPolicyProviderTest, Delegate) { 52 TEST_F(ProxyPolicyProviderTest, Delegate) {
54 PolicyBundle bundle; 53 PolicyBundle bundle;
55 bundle.Get(PolicyNamespace(POLICY_DOMAIN_CHROME, std::string())) 54 bundle.Get(PolicyNamespace(POLICY_DOMAIN_CHROME, std::string()))
56 .Set("policy", 55 .Set("policy",
57 POLICY_LEVEL_MANDATORY, 56 POLICY_LEVEL_MANDATORY,
58 POLICY_SCOPE_USER, 57 POLICY_SCOPE_USER,
59 POLICY_SOURCE_CLOUD,
60 new base::StringValue("value"), 58 new base::StringValue("value"),
61 NULL); 59 NULL);
62 mock_provider_.UpdatePolicy(CopyBundle(bundle)); 60 mock_provider_.UpdatePolicy(CopyBundle(bundle));
63 61
64 EXPECT_CALL(observer_, OnUpdatePolicy(&proxy_provider_)); 62 EXPECT_CALL(observer_, OnUpdatePolicy(&proxy_provider_));
65 proxy_provider_.SetDelegate(&mock_provider_); 63 proxy_provider_.SetDelegate(&mock_provider_);
66 Mock::VerifyAndClearExpectations(&observer_); 64 Mock::VerifyAndClearExpectations(&observer_);
67 EXPECT_TRUE(bundle.Equals(proxy_provider_.policies())); 65 EXPECT_TRUE(bundle.Equals(proxy_provider_.policies()));
68 66
69 EXPECT_CALL(observer_, OnUpdatePolicy(&proxy_provider_)); 67 EXPECT_CALL(observer_, OnUpdatePolicy(&proxy_provider_));
70 bundle.Get(PolicyNamespace(POLICY_DOMAIN_CHROME, std::string())) 68 bundle.Get(PolicyNamespace(POLICY_DOMAIN_CHROME, std::string()))
71 .Set("policy", 69 .Set("policy",
72 POLICY_LEVEL_MANDATORY, 70 POLICY_LEVEL_MANDATORY,
73 POLICY_SCOPE_USER, 71 POLICY_SCOPE_USER,
74 POLICY_SOURCE_CLOUD,
75 new base::StringValue("new value"), 72 new base::StringValue("new value"),
76 NULL); 73 NULL);
77 mock_provider_.UpdatePolicy(CopyBundle(bundle)); 74 mock_provider_.UpdatePolicy(CopyBundle(bundle));
78 Mock::VerifyAndClearExpectations(&observer_); 75 Mock::VerifyAndClearExpectations(&observer_);
79 EXPECT_TRUE(bundle.Equals(proxy_provider_.policies())); 76 EXPECT_TRUE(bundle.Equals(proxy_provider_.policies()));
80 77
81 EXPECT_CALL(observer_, OnUpdatePolicy(&proxy_provider_)); 78 EXPECT_CALL(observer_, OnUpdatePolicy(&proxy_provider_));
82 proxy_provider_.SetDelegate(NULL); 79 proxy_provider_.SetDelegate(NULL);
83 EXPECT_TRUE(PolicyBundle().Equals(proxy_provider_.policies())); 80 EXPECT_TRUE(PolicyBundle().Equals(proxy_provider_.policies()));
84 } 81 }
(...skipping 12 matching lines...) Expand all
97 proxy_provider_.RefreshPolicies(); 94 proxy_provider_.RefreshPolicies();
98 Mock::VerifyAndClearExpectations(&observer_); 95 Mock::VerifyAndClearExpectations(&observer_);
99 Mock::VerifyAndClearExpectations(&mock_provider_); 96 Mock::VerifyAndClearExpectations(&mock_provider_);
100 97
101 EXPECT_CALL(observer_, OnUpdatePolicy(&proxy_provider_)); 98 EXPECT_CALL(observer_, OnUpdatePolicy(&proxy_provider_));
102 mock_provider_.UpdatePolicy(scoped_ptr<PolicyBundle>(new PolicyBundle())); 99 mock_provider_.UpdatePolicy(scoped_ptr<PolicyBundle>(new PolicyBundle()));
103 Mock::VerifyAndClearExpectations(&observer_); 100 Mock::VerifyAndClearExpectations(&observer_);
104 } 101 }
105 102
106 } // namespace policy 103 } // namespace policy
OLDNEW
« no previous file with comments | « components/policy/core/common/policy_types.h ('k') | components/policy/core/common/schema_map_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698