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

Unified Diff: components/syncable_prefs/pref_service_syncable_unittest.cc

Issue 2078893002: Add callback list to PrefModelAssociator after sync data is loaded (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@migrate_domain_scoped_settings
Patch Set: minor change Created 4 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/syncable_prefs/pref_service_syncable.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/syncable_prefs/pref_service_syncable_unittest.cc
diff --git a/components/syncable_prefs/pref_service_syncable_unittest.cc b/components/syncable_prefs/pref_service_syncable_unittest.cc
index 5aaa09616db396c3a53545ddeb412651e6ea4e59..d22b5d6fd6151a26146883ad25285994cb35648a 100644
--- a/components/syncable_prefs/pref_service_syncable_unittest.cc
+++ b/components/syncable_prefs/pref_service_syncable_unittest.cc
@@ -46,6 +46,10 @@ const char kDefaultCharsetPrefName[] = "default_charset";
const char kNonDefaultCharsetValue[] = "foo";
const char kDefaultCharsetValue[] = "utf-8";
+void Increment(int* num) {
+ (*num)++;
+}
+
class TestPrefModelAssociatorClient : public PrefModelAssociatorClient {
public:
TestPrefModelAssociatorClient() {}
@@ -121,7 +125,6 @@ class PrefServiceSyncableTest : public testing::Test {
pref_sync_service_ = reinterpret_cast<PrefModelAssociator*>(
prefs_.GetSyncableService(syncer::PREFERENCES));
ASSERT_TRUE(pref_sync_service_);
- next_pref_remote_sync_node_id_ = 0;
}
syncer::SyncChange MakeRemoteChange(int64_t id,
@@ -555,6 +558,17 @@ TEST_F(PrefServiceSyncableTest, DeletePreference) {
EXPECT_TRUE(pref->IsDefaultValue());
}
+TEST_F(PrefServiceSyncableTest, RegisterMergeDataFinishedCallback) {
+ int num_callbacks = 0;
+
+ prefs_.RegisterMergeDataFinishedCallback(
+ base::Bind(&Increment, &num_callbacks));
+ EXPECT_EQ(0, num_callbacks);
+
+ InitWithNoSyncData();
+ EXPECT_EQ(1, num_callbacks);
+}
+
} // namespace
} // namespace syncable_prefs
« no previous file with comments | « components/syncable_prefs/pref_service_syncable.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698