OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <memory> | 5 #include <memory> |
6 | 6 |
7 #include "base/callback.h" | 7 #include "base/callback.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
10 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 dm_protocol::kChromeUserPolicyType, | 147 dm_protocol::kChromeUserPolicyType, |
148 homepage, | 148 homepage, |
149 GetTestUser(), | 149 GetTestUser(), |
150 key_version); | 150 key_version); |
151 } | 151 } |
152 | 152 |
153 void GetExpectedTestPolicy(PolicyMap* expected, const char* homepage) { | 153 void GetExpectedTestPolicy(PolicyMap* expected, const char* homepage) { |
154 GetExpectedDefaultPolicy(expected); | 154 GetExpectedDefaultPolicy(expected); |
155 | 155 |
156 expected->Set(key::kShowHomeButton, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, | 156 expected->Set(key::kShowHomeButton, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, |
157 POLICY_SOURCE_CLOUD, | 157 POLICY_SOURCE_CLOUD, base::MakeUnique<base::Value>(true), |
158 base::MakeUnique<base::FundamentalValue>(true), nullptr); | 158 nullptr); |
159 expected->Set(key::kRestoreOnStartup, POLICY_LEVEL_MANDATORY, | 159 expected->Set(key::kRestoreOnStartup, POLICY_LEVEL_MANDATORY, |
160 POLICY_SCOPE_USER, POLICY_SOURCE_CLOUD, | 160 POLICY_SCOPE_USER, POLICY_SOURCE_CLOUD, |
161 base::MakeUnique<base::FundamentalValue>(4), nullptr); | 161 base::MakeUnique<base::Value>(4), nullptr); |
162 base::ListValue list; | 162 base::ListValue list; |
163 list.AppendString("dev.chromium.org"); | 163 list.AppendString("dev.chromium.org"); |
164 list.AppendString("youtube.com"); | 164 list.AppendString("youtube.com"); |
165 expected->Set(key::kURLBlacklist, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, | 165 expected->Set(key::kURLBlacklist, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, |
166 POLICY_SOURCE_CLOUD, list.CreateDeepCopy(), nullptr); | 166 POLICY_SOURCE_CLOUD, list.CreateDeepCopy(), nullptr); |
167 expected->Set(key::kMaxInvalidationFetchDelay, POLICY_LEVEL_MANDATORY, | 167 expected->Set(key::kMaxInvalidationFetchDelay, POLICY_LEVEL_MANDATORY, |
168 POLICY_SCOPE_USER, POLICY_SOURCE_CLOUD, | 168 POLICY_SCOPE_USER, POLICY_SOURCE_CLOUD, |
169 base::MakeUnique<base::FundamentalValue>(1000), nullptr); | 169 base::MakeUnique<base::Value>(1000), nullptr); |
170 expected->Set(key::kHomepageLocation, POLICY_LEVEL_RECOMMENDED, | 170 expected->Set(key::kHomepageLocation, POLICY_LEVEL_RECOMMENDED, |
171 POLICY_SCOPE_USER, POLICY_SOURCE_CLOUD, | 171 POLICY_SCOPE_USER, POLICY_SOURCE_CLOUD, |
172 base::MakeUnique<base::StringValue>(homepage), nullptr); | 172 base::MakeUnique<base::StringValue>(homepage), nullptr); |
173 } | 173 } |
174 | 174 |
175 } // namespace | 175 } // namespace |
176 | 176 |
177 // Tests the cloud policy stack(s). | 177 // Tests the cloud policy stack(s). |
178 class CloudPolicyTest : public InProcessBrowserTest, | 178 class CloudPolicyTest : public InProcessBrowserTest, |
179 public PolicyService::Observer { | 179 public PolicyService::Observer { |
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
491 | 491 |
492 // They should now serialize to the same bytes. | 492 // They should now serialize to the same bytes. |
493 std::string chrome_settings_serialized; | 493 std::string chrome_settings_serialized; |
494 std::string cloud_policy_serialized; | 494 std::string cloud_policy_serialized; |
495 ASSERT_TRUE(chrome_settings.SerializeToString(&chrome_settings_serialized)); | 495 ASSERT_TRUE(chrome_settings.SerializeToString(&chrome_settings_serialized)); |
496 ASSERT_TRUE(cloud_policy.SerializeToString(&cloud_policy_serialized)); | 496 ASSERT_TRUE(cloud_policy.SerializeToString(&cloud_policy_serialized)); |
497 EXPECT_EQ(chrome_settings_serialized, cloud_policy_serialized); | 497 EXPECT_EQ(chrome_settings_serialized, cloud_policy_serialized); |
498 } | 498 } |
499 | 499 |
500 } // namespace policy | 500 } // namespace policy |
OLD | NEW |