Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(133)

Side by Side Diff: services/preferences/pref_service_factory_unittest.cc

Issue 2771723002: Pref service: Merge PrefStoreConnector interfaces. (Closed)
Patch Set: Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2017 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2017 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 "services/preferences/public/cpp/pref_service_factory.h" 5 #include "services/preferences/public/cpp/pref_service_factory.h"
6 6
7 #include "base/files/scoped_temp_dir.h" 7 #include "base/files/scoped_temp_dir.h"
8 #include "base/memory/ptr_util.h" 8 #include "base/memory/ptr_util.h"
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "base/test/sequenced_worker_pool_owner.h" 10 #include "base/test/sequenced_worker_pool_owner.h"
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 static void OnInit(const base::Closure& quit_closure, bool success) { 130 static void OnInit(const base::Closure& quit_closure, bool success) {
131 quit_closure.Run(); 131 quit_closure.Run();
132 } 132 }
133 133
134 // Called when the PrefService has been created. 134 // Called when the PrefService has been created.
135 static void OnCreate(const base::Closure& quit_closure, 135 static void OnCreate(const base::Closure& quit_closure,
136 std::unique_ptr<PrefService>* out, 136 std::unique_ptr<PrefService>* out,
137 std::unique_ptr<PrefService> pref_service) { 137 std::unique_ptr<PrefService> pref_service) {
138 DCHECK(pref_service); 138 DCHECK(pref_service);
139 *out = std::move(pref_service); 139 *out = std::move(pref_service);
140 (*out)->AddPrefInitObserver( 140 if ((*out)->GetInitializationStatus() ==
141 base::Bind(PrefServiceFactoryTest::OnInit, quit_closure)); 141 PrefService::INITIALIZATION_STATUS_WAITING) {
142 (*out)->AddPrefInitObserver(
143 base::Bind(PrefServiceFactoryTest::OnInit, quit_closure));
144 return;
145 }
146 quit_closure.Run();
142 } 147 }
143 148
144 static void OnPrefChanged(const base::Closure& quit_closure, 149 static void OnPrefChanged(const base::Closure& quit_closure,
145 const std::string& expected_path, 150 const std::string& expected_path,
146 const std::string& path) { 151 const std::string& path) {
147 if (path == expected_path) 152 if (path == expected_path)
148 quit_closure.Run(); 153 quit_closure.Run();
149 } 154 }
150 155
151 base::ScopedTempDir profile_dir_; 156 base::ScopedTempDir profile_dir_;
(...skipping 19 matching lines...) Expand all
171 176
172 // TODO(tibell): Once we have a default store check the value prior to 177 // TODO(tibell): Once we have a default store check the value prior to
173 // setting. 178 // setting.
174 pref_service->SetInteger(kKey, kUpdatedValue); 179 pref_service->SetInteger(kKey, kUpdatedValue);
175 WaitForPrefChange(pref_service2.get(), kKey); 180 WaitForPrefChange(pref_service2.get(), kKey);
176 EXPECT_EQ(kUpdatedValue, pref_service2->GetInteger(kKey)); 181 EXPECT_EQ(kUpdatedValue, pref_service2->GetInteger(kKey));
177 } 182 }
178 183
179 } // namespace 184 } // namespace
180 } // namespace prefs 185 } // namespace prefs
OLDNEW
« no previous file with comments | « services/preferences/persistent_pref_store_impl_unittest.cc ('k') | services/preferences/pref_store_manager_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698