| 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 <set> | 5 #include <set> |
| 6 #include <string> | 6 #include <string> |
| 7 | 7 |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/values.h" | 9 #include "base/values.h" |
| 10 #include "chrome/browser/policy/configuration_policy_pref_store.h" | 10 #include "chrome/browser/policy/configuration_policy_pref_store.h" |
| (...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 358 | 358 |
| 359 // Test getting a default value. | 359 // Test getting a default value. |
| 360 value = NULL; | 360 value = NULL; |
| 361 ASSERT_TRUE(pref_value_store_->GetValue(prefs::kDefaultPref, | 361 ASSERT_TRUE(pref_value_store_->GetValue(prefs::kDefaultPref, |
| 362 Value::TYPE_STRING, &value)); | 362 Value::TYPE_STRING, &value)); |
| 363 EXPECT_TRUE(value->GetAsString(&actual_str_value)); | 363 EXPECT_TRUE(value->GetAsString(&actual_str_value)); |
| 364 EXPECT_EQ(default_pref::kDefaultValue, actual_str_value); | 364 EXPECT_EQ(default_pref::kDefaultValue, actual_str_value); |
| 365 | 365 |
| 366 // Test getting a preference value that the |PrefValueStore| | 366 // Test getting a preference value that the |PrefValueStore| |
| 367 // does not contain. | 367 // does not contain. |
| 368 FundamentalValue tmp_dummy_value(true); | 368 base::FundamentalValue tmp_dummy_value(true); |
| 369 value = &tmp_dummy_value; | 369 value = &tmp_dummy_value; |
| 370 ASSERT_FALSE(pref_value_store_->GetValue(prefs::kMissingPref, | 370 ASSERT_FALSE(pref_value_store_->GetValue(prefs::kMissingPref, |
| 371 Value::TYPE_STRING, &value)); | 371 Value::TYPE_STRING, &value)); |
| 372 ASSERT_TRUE(value == NULL); | 372 ASSERT_TRUE(value == NULL); |
| 373 } | 373 } |
| 374 | 374 |
| 375 TEST_F(PrefValueStoreTest, PrefChanges) { | 375 TEST_F(PrefValueStoreTest, PrefChanges) { |
| 376 // Check pref controlled by highest-priority store. | 376 // Check pref controlled by highest-priority store. |
| 377 EXPECT_CALL(pref_notifier_, OnPreferenceChanged(prefs::kManagedPlatformPref)); | 377 EXPECT_CALL(pref_notifier_, OnPreferenceChanged(prefs::kManagedPlatformPref)); |
| 378 EXPECT_CALL(*sync_associator_, | 378 EXPECT_CALL(*sync_associator_, |
| (...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 670 prefs::kUserPref)); | 670 prefs::kUserPref)); |
| 671 EXPECT_TRUE(pref_value_store_->PrefValueExtensionModifiable( | 671 EXPECT_TRUE(pref_value_store_->PrefValueExtensionModifiable( |
| 672 prefs::kRecommendedPlatformPref)); | 672 prefs::kRecommendedPlatformPref)); |
| 673 EXPECT_TRUE(pref_value_store_->PrefValueExtensionModifiable( | 673 EXPECT_TRUE(pref_value_store_->PrefValueExtensionModifiable( |
| 674 prefs::kRecommendedCloudPref)); | 674 prefs::kRecommendedCloudPref)); |
| 675 EXPECT_TRUE(pref_value_store_->PrefValueExtensionModifiable( | 675 EXPECT_TRUE(pref_value_store_->PrefValueExtensionModifiable( |
| 676 prefs::kDefaultPref)); | 676 prefs::kDefaultPref)); |
| 677 EXPECT_TRUE(pref_value_store_->PrefValueExtensionModifiable( | 677 EXPECT_TRUE(pref_value_store_->PrefValueExtensionModifiable( |
| 678 prefs::kMissingPref)); | 678 prefs::kMissingPref)); |
| 679 } | 679 } |
| OLD | NEW |