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 <string> | 5 #include <string> |
6 | 6 |
7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
8 #include "base/string16.h" | 8 #include "base/string16.h" |
9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #include "chrome/browser/policy/configuration_policy_pref_store.h" | 10 #include "chrome/browser/policy/configuration_policy_pref_store.h" |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 dict->SetString( | 126 dict->SetString( |
127 "level", | 127 "level", |
128 PolicyStatusInfo::GetPolicyLevelString(POLICY_LEVEL_RECOMMENDED)); | 128 PolicyStatusInfo::GetPolicyLevelString(POLICY_LEVEL_RECOMMENDED)); |
129 result.reset(reader_->GetPolicyStatus(key::kHomepageIsNewTabPage)); | 129 result.reset(reader_->GetPolicyStatus(key::kHomepageIsNewTabPage)); |
130 EXPECT_TRUE(dict->Equals(result.get())); | 130 EXPECT_TRUE(dict->Equals(result.get())); |
131 } | 131 } |
132 | 132 |
133 // Test for integer-valued policy settings. | 133 // Test for integer-valued policy settings. |
134 TEST_F(ConfigurationPolicyReaderTest, SetIntegerValue) { | 134 TEST_F(ConfigurationPolicyReaderTest, SetIntegerValue) { |
135 provider_.AddMandatoryPolicy(key::kRestoreOnStartup, | 135 provider_.AddMandatoryPolicy(key::kRestoreOnStartup, |
136 Value::CreateIntegerValue(3)); | 136 Value::CreateIntegerValue(4)); |
137 provider_.AddRecommendedPolicy(key::kIncognitoModeAvailability, | 137 provider_.AddRecommendedPolicy(key::kIncognitoModeAvailability, |
138 Value::CreateIntegerValue(2)); | 138 Value::CreateIntegerValue(2)); |
139 reader_->OnUpdatePolicy(&provider_); | 139 reader_->OnUpdatePolicy(&provider_); |
140 scoped_ptr<DictionaryValue> dict( | 140 scoped_ptr<DictionaryValue> dict( |
141 CreateDictionary(key::kRestoreOnStartup, Value::CreateIntegerValue(3))); | 141 CreateDictionary(key::kRestoreOnStartup, Value::CreateIntegerValue(4))); |
142 scoped_ptr<DictionaryValue> result( | 142 scoped_ptr<DictionaryValue> result( |
143 reader_->GetPolicyStatus(key::kRestoreOnStartup)); | 143 reader_->GetPolicyStatus(key::kRestoreOnStartup)); |
144 EXPECT_TRUE(dict->Equals(result.get())); | 144 EXPECT_TRUE(dict->Equals(result.get())); |
145 | 145 |
146 dict.reset(CreateDictionary(key::kIncognitoModeAvailability, | 146 dict.reset(CreateDictionary(key::kIncognitoModeAvailability, |
147 Value::CreateIntegerValue(2))); | 147 Value::CreateIntegerValue(2))); |
148 dict->SetString( | 148 dict->SetString( |
149 "level", | 149 "level", |
150 PolicyStatusInfo::GetPolicyLevelString(POLICY_LEVEL_RECOMMENDED)); | 150 PolicyStatusInfo::GetPolicyLevelString(POLICY_LEVEL_RECOMMENDED)); |
151 result.reset(reader_->GetPolicyStatus(key::kIncognitoModeAvailability)); | 151 result.reset(reader_->GetPolicyStatus(key::kIncognitoModeAvailability)); |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
317 cases[i].name != NULL, | 317 cases[i].name != NULL, |
318 cases[i].level); | 318 cases[i].level); |
319 EXPECT_TRUE(dict->Equals(status_dict)); | 319 EXPECT_TRUE(dict->Equals(status_dict)); |
320 break; | 320 break; |
321 } | 321 } |
322 } | 322 } |
323 } | 323 } |
324 } | 324 } |
325 | 325 |
326 } // namespace policy | 326 } // namespace policy |
OLD | NEW |