OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/prefs/preferences_service.h" | 5 #include "chrome/browser/prefs/preferences_service.h" |
6 | 6 |
7 #include "base/macros.h" | 7 #include "base/macros.h" |
8 #include "base/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 PreferencesServiceTest::~PreferencesServiceTest() {} | 131 PreferencesServiceTest::~PreferencesServiceTest() {} |
132 | 132 |
133 void PreferencesServiceTest::InitObserver( | 133 void PreferencesServiceTest::InitObserver( |
134 const std::vector<std::string>& preferences) { | 134 const std::vector<std::string>& preferences) { |
135 service_->Subscribe(preferences); | 135 service_->Subscribe(preferences); |
136 base::RunLoop().RunUntilIdle(); | 136 base::RunLoop().RunUntilIdle(); |
137 } | 137 } |
138 | 138 |
139 void PreferencesServiceTest::InitPreference(const std::string& key, int value) { | 139 void PreferencesServiceTest::InitPreference(const std::string& key, int value) { |
140 registry_->RegisterIntegerPref(key, value); | 140 registry_->RegisterIntegerPref(key, value); |
141 base::FundamentalValue fundamental_value(value); | 141 base::Value fundamental_value(value); |
142 profile_->GetPrefs()->Set(key, fundamental_value); | 142 profile_->GetPrefs()->Set(key, fundamental_value); |
143 } | 143 } |
144 | 144 |
145 void PreferencesServiceTest::SetPreferences( | 145 void PreferencesServiceTest::SetPreferences( |
146 std::unique_ptr<base::DictionaryValue> preferences) { | 146 std::unique_ptr<base::DictionaryValue> preferences) { |
147 service_->SetPreferences(std::move(preferences)); | 147 service_->SetPreferences(std::move(preferences)); |
148 base::RunLoop().RunUntilIdle(); | 148 base::RunLoop().RunUntilIdle(); |
149 } | 149 } |
150 | 150 |
151 void PreferencesServiceTest::SetUp() { | 151 void PreferencesServiceTest::SetUp() { |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
298 std::unique_ptr<base::DictionaryValue> dictionary = | 298 std::unique_ptr<base::DictionaryValue> dictionary = |
299 base::MakeUnique<base::DictionaryValue>(); | 299 base::MakeUnique<base::DictionaryValue>(); |
300 dictionary->SetInteger(kKey, kNewValue); | 300 dictionary->SetInteger(kKey, kNewValue); |
301 SetPreferences(std::move(dictionary)); | 301 SetPreferences(std::move(dictionary)); |
302 | 302 |
303 EXPECT_FALSE(client()->on_preferences_changed_called()); | 303 EXPECT_FALSE(client()->on_preferences_changed_called()); |
304 EXPECT_EQ(kNewValue, service()->GetInteger(kKey)); | 304 EXPECT_EQ(kNewValue, service()->GetInteger(kKey)); |
305 } | 305 } |
306 | 306 |
307 } // namespace test | 307 } // namespace test |
OLD | NEW |