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 "chrome/test/base/testing_pref_service.h" | 5 #include "chrome/test/base/testing_pref_service.h" |
6 | 6 |
7 #include "base/prefs/default_pref_store.h" | 7 #include "base/prefs/default_pref_store.h" |
8 #include "base/prefs/testing_pref_store.h" | 8 #include "base/prefs/testing_pref_store.h" |
9 #include "chrome/browser/policy/configuration_policy_pref_store.h" | 9 #include "chrome/browser/policy/configuration_policy_pref_store.h" |
10 #include "chrome/browser/prefs/browser_prefs.h" | 10 #include "chrome/browser/prefs/browser_prefs.h" |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 SetPref(recommended_prefs_, path, value); | 78 SetPref(recommended_prefs_, path, value); |
79 } | 79 } |
80 | 80 |
81 void TestingPrefServiceBase::RemoveRecommendedPref(const char* path) { | 81 void TestingPrefServiceBase::RemoveRecommendedPref(const char* path) { |
82 RemovePref(recommended_prefs_, path); | 82 RemovePref(recommended_prefs_, path); |
83 } | 83 } |
84 | 84 |
85 const Value* TestingPrefServiceBase::GetPref(TestingPrefStore* pref_store, | 85 const Value* TestingPrefServiceBase::GetPref(TestingPrefStore* pref_store, |
86 const char* path) const { | 86 const char* path) const { |
87 const Value* res; | 87 const Value* res; |
88 return pref_store->GetValue(path, &res) == PrefStore::READ_OK ? res : NULL; | 88 return pref_store->GetValue(path, &res) ? res : NULL; |
89 } | 89 } |
90 | 90 |
91 void TestingPrefServiceBase::SetPref(TestingPrefStore* pref_store, | 91 void TestingPrefServiceBase::SetPref(TestingPrefStore* pref_store, |
92 const char* path, | 92 const char* path, |
93 Value* value) { | 93 Value* value) { |
94 pref_store->SetValue(path, value); | 94 pref_store->SetValue(path, value); |
95 } | 95 } |
96 | 96 |
97 void TestingPrefServiceBase::RemovePref(TestingPrefStore* pref_store, | 97 void TestingPrefServiceBase::RemovePref(TestingPrefStore* pref_store, |
98 const char* path) { | 98 const char* path) { |
(...skipping 17 matching lines...) Expand all Loading... |
116 : browser_process_(browser_process) { | 116 : browser_process_(browser_process) { |
117 chrome::RegisterLocalState(&local_state_); | 117 chrome::RegisterLocalState(&local_state_); |
118 EXPECT_FALSE(browser_process->local_state()); | 118 EXPECT_FALSE(browser_process->local_state()); |
119 browser_process->SetLocalState(&local_state_); | 119 browser_process->SetLocalState(&local_state_); |
120 } | 120 } |
121 | 121 |
122 ScopedTestingLocalState::~ScopedTestingLocalState() { | 122 ScopedTestingLocalState::~ScopedTestingLocalState() { |
123 EXPECT_EQ(&local_state_, browser_process_->local_state()); | 123 EXPECT_EQ(&local_state_, browser_process_->local_state()); |
124 browser_process_->SetLocalState(NULL); | 124 browser_process_->SetLocalState(NULL); |
125 } | 125 } |
OLD | NEW |