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

Side by Side Diff: chrome/browser/prefs/profile_pref_store_manager_unittest.cc

Issue 2791903003: Pref service: have Mash and Chrome connect to the right pref stores (Closed)
Patch Set: ProfilePrefStoreManagerTest: explicit list stores to connect to Created 3 years, 8 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/profile_pref_store_manager.h" 5 #include "chrome/browser/prefs/profile_pref_store_manager.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <memory> 9 #include <memory>
10 #include <utility> 10 #include <utility>
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 seed_("seed"), 146 seed_("seed"),
147 reset_recorded_(false) {} 147 reset_recorded_(false) {}
148 148
149 void SetUp() override { 149 void SetUp() override {
150 worker_pool_ = base::MakeUnique<base::SequencedWorkerPoolOwner>( 150 worker_pool_ = base::MakeUnique<base::SequencedWorkerPoolOwner>(
151 2, "ProfilePrefStoreManagerTest"); 151 2, "ProfilePrefStoreManagerTest");
152 if (GetParam()) { 152 if (GetParam()) {
153 feature_list_.InitAndEnableFeature(features::kPrefService); 153 feature_list_.InitAndEnableFeature(features::kPrefService);
154 service_manager::mojom::ServicePtr service_ptr; 154 service_manager::mojom::ServicePtr service_ptr;
155 pref_service_context_ = base::MakeUnique<service_manager::ServiceContext>( 155 pref_service_context_ = base::MakeUnique<service_manager::ServiceContext>(
156 prefs::CreatePrefService(std::set<PrefValueStore::PrefStoreType>(), 156 prefs::CreatePrefService(
157 worker_pool_->pool()), 157 std::set<PrefValueStore::PrefStoreType>(
158 {PrefValueStore::USER_STORE, PrefValueStore::DEFAULT_STORE}),
159 worker_pool_->pool()),
158 mojo::MakeRequest(&service_ptr)); 160 mojo::MakeRequest(&service_ptr));
159 connector_ = service_manager::Connector::Create(&connector_request_); 161 connector_ = service_manager::Connector::Create(&connector_request_);
160 service_manager::Connector::TestApi test_api(connector_.get()); 162 service_manager::Connector::TestApi test_api(connector_.get());
161 test_api.OverrideBinderForTesting( 163 test_api.OverrideBinderForTesting(
162 prefs::mojom::kServiceName, prefs::mojom::PrefStoreConnector::Name_, 164 prefs::mojom::kServiceName, prefs::mojom::PrefStoreConnector::Name_,
163 base::Bind(&ProfilePrefStoreManagerTest::BindInterface, 165 base::Bind(&ProfilePrefStoreManagerTest::BindInterface,
164 base::Unretained(this), 166 base::Unretained(this),
165 prefs::mojom::PrefStoreConnector::Name_)); 167 prefs::mojom::PrefStoreConnector::Name_));
166 test_api.OverrideBinderForTesting( 168 test_api.OverrideBinderForTesting(
167 prefs::mojom::kServiceName, prefs::mojom::PrefServiceControl::Name_, 169 prefs::mojom::kServiceName, prefs::mojom::PrefServiceControl::Name_,
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 return ProfilePrefStoreManager::kPlatformSupportsPreferenceTracking && 223 return ProfilePrefStoreManager::kPlatformSupportsPreferenceTracking &&
222 !GetParam(); 224 !GetParam();
223 } 225 }
224 226
225 void RelaunchPrefService() { 227 void RelaunchPrefService() {
226 if (!GetParam()) 228 if (!GetParam())
227 return; 229 return;
228 230
229 service_manager::mojom::ServicePtr service_ptr; 231 service_manager::mojom::ServicePtr service_ptr;
230 pref_service_context_ = base::MakeUnique<service_manager::ServiceContext>( 232 pref_service_context_ = base::MakeUnique<service_manager::ServiceContext>(
231 prefs::CreatePrefService(std::set<PrefValueStore::PrefStoreType>(), 233 prefs::CreatePrefService(
232 worker_pool_->pool()), 234 std::set<PrefValueStore::PrefStoreType>(
235 {PrefValueStore::USER_STORE, PrefValueStore::DEFAULT_STORE}),
236 worker_pool_->pool()),
233 mojo::MakeRequest(&service_ptr)); 237 mojo::MakeRequest(&service_ptr));
234 } 238 }
235 239
236 // Verifies whether a reset was reported via the RecordReset() hook. Also 240 // Verifies whether a reset was reported via the RecordReset() hook. Also
237 // verifies that GetResetTime() was set (or not) accordingly. 241 // verifies that GetResetTime() was set (or not) accordingly.
238 void VerifyResetRecorded(bool reset_expected) { 242 void VerifyResetRecorded(bool reset_expected) {
239 EXPECT_EQ(reset_expected, reset_recorded_); 243 EXPECT_EQ(reset_expected, reset_recorded_);
240 244
241 PrefServiceFactory pref_service_factory; 245 PrefServiceFactory pref_service_factory;
242 pref_service_factory.set_user_prefs(pref_store_); 246 pref_service_factory.set_user_prefs(pref_store_);
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after
616 base::WrapUnique(new base::Value(kGoodbyeWorld)), 620 base::WrapUnique(new base::Value(kGoodbyeWorld)),
617 WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS); 621 WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS);
618 LoadExistingPrefs(); 622 LoadExistingPrefs();
619 ExpectStringValueEquals(kProtectedAtomic, kGoodbyeWorld); 623 ExpectStringValueEquals(kProtectedAtomic, kGoodbyeWorld);
620 VerifyResetRecorded(false); 624 VerifyResetRecorded(false);
621 } 625 }
622 626
623 INSTANTIATE_TEST_CASE_P(ProfilePrefStoreManagerTest, 627 INSTANTIATE_TEST_CASE_P(ProfilePrefStoreManagerTest,
624 ProfilePrefStoreManagerTest, 628 ProfilePrefStoreManagerTest,
625 testing::Bool()); 629 testing::Bool());
OLDNEW
« no previous file with comments | « chrome/browser/prefs/profile_pref_store_manager.cc ('k') | chrome/browser/profiles/profile_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698