OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "chrome/browser/policy/user_policy_cache.h" | 5 #include "chrome/browser/policy/user_policy_cache.h" |
6 | 6 |
7 #include <limits> | 7 #include <limits> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 em::PolicyOptions::MANDATORY); | 147 em::PolicyOptions::MANDATORY); |
148 settings.mutable_policyrefreshrate()->set_policyrefreshrate(5); | 148 settings.mutable_policyrefreshrate()->set_policyrefreshrate(5); |
149 settings.mutable_policyrefreshrate()->mutable_policy_options()->set_mode( | 149 settings.mutable_policyrefreshrate()->mutable_policy_options()->set_mode( |
150 em::PolicyOptions::RECOMMENDED); | 150 em::PolicyOptions::RECOMMENDED); |
151 PolicyMap mandatory_policy; | 151 PolicyMap mandatory_policy; |
152 PolicyMap recommended_policy; | 152 PolicyMap recommended_policy; |
153 DecodePolicy(settings, &mandatory_policy, &recommended_policy); | 153 DecodePolicy(settings, &mandatory_policy, &recommended_policy); |
154 PolicyMap mandatory; | 154 PolicyMap mandatory; |
155 mandatory.Set(kPolicyHomepageLocation, | 155 mandatory.Set(kPolicyHomepageLocation, |
156 Value::CreateStringValue("chromium.org")); | 156 Value::CreateStringValue("chromium.org")); |
157 mandatory.Set(kPolicyJavascriptEnabled, Value::CreateBooleanValue(true)); | 157 mandatory.Set(kPolicyJavascriptEnabled, base::TrueValue()); |
158 PolicyMap recommended; | 158 PolicyMap recommended; |
159 recommended.Set(kPolicyPolicyRefreshRate, Value::CreateIntegerValue(5)); | 159 recommended.Set(kPolicyPolicyRefreshRate, Value::CreateIntegerValue(5)); |
160 EXPECT_TRUE(mandatory.Equals(mandatory_policy)); | 160 EXPECT_TRUE(mandatory.Equals(mandatory_policy)); |
161 EXPECT_TRUE(recommended.Equals(recommended_policy)); | 161 EXPECT_TRUE(recommended.Equals(recommended_policy)); |
162 } | 162 } |
163 | 163 |
164 TEST_F(UserPolicyCacheTest, DecodeIntegerValue) { | 164 TEST_F(UserPolicyCacheTest, DecodeIntegerValue) { |
165 const int min = std::numeric_limits<int>::min(); | 165 const int min = std::numeric_limits<int>::min(); |
166 const int max = std::numeric_limits<int>::max(); | 166 const int max = std::numeric_limits<int>::max(); |
167 scoped_ptr<Value> value( | 167 scoped_ptr<Value> value( |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
378 // If new-style policy comes in, it should override old-style policy. | 378 // If new-style policy comes in, it should override old-style policy. |
379 policy = CreateHomepagePolicy("http://www.example.com", | 379 policy = CreateHomepagePolicy("http://www.example.com", |
380 base::Time::NowFromSystemTime(), | 380 base::Time::NowFromSystemTime(), |
381 em::PolicyOptions::RECOMMENDED); | 381 em::PolicyOptions::RECOMMENDED); |
382 SetPolicy(&cache, policy, true); | 382 SetPolicy(&cache, policy, true); |
383 EXPECT_TRUE(expected.Equals(recommended_policy(cache))); | 383 EXPECT_TRUE(expected.Equals(recommended_policy(cache))); |
384 EXPECT_TRUE(empty.Equals(mandatory_policy(cache))); | 384 EXPECT_TRUE(empty.Equals(mandatory_policy(cache))); |
385 } | 385 } |
386 | 386 |
387 } // namespace policy | 387 } // namespace policy |
OLD | NEW |