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

Unified Diff: chrome/browser/extensions/api/preferences_private/preferences_private_apitest.cc

Issue 1770843002: SuggestionsService: implement SyncServiceObserver (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: iOS Created 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/android/most_visited_sites.cc ('k') | chrome/browser/search/instant_service.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/api/preferences_private/preferences_private_apitest.cc
diff --git a/chrome/browser/extensions/api/preferences_private/preferences_private_apitest.cc b/chrome/browser/extensions/api/preferences_private/preferences_private_apitest.cc
index 29969c11851c05665a3ef85872b51018c018a69b..75101a48bf60a33f660ecbde330a0dee7efca3d7 100644
--- a/chrome/browser/extensions/api/preferences_private/preferences_private_apitest.cc
+++ b/chrome/browser/extensions/api/preferences_private/preferences_private_apitest.cc
@@ -50,6 +50,7 @@ class FakeProfileSyncService : public ProfileSyncService {
public:
explicit FakeProfileSyncService(Profile* profile)
: ProfileSyncService(CreateProfileSyncServiceParamsForTest(profile)),
+ test_started_(false),
sync_initialized_(true),
initialized_state_violation_(false) {}
@@ -61,6 +62,10 @@ class FakeProfileSyncService : public ProfileSyncService {
new FakeProfileSyncService(static_cast<Profile*>(context)));
}
+ void set_test_started(bool test_started) {
+ test_started_ = test_started;
+ }
+
void set_sync_initialized(bool sync_initialized) {
sync_initialized_ = sync_initialized;
}
@@ -71,6 +76,10 @@ class FakeProfileSyncService : public ProfileSyncService {
bool IsSyncActive() const override { return sync_initialized_; }
void AddObserver(sync_driver::SyncServiceObserver* observer) override {
+ // Ignore other SyncServiceObsevers which we don't care about.
+ if (!test_started_)
+ return;
+
if (sync_initialized_)
initialized_state_violation_ = true;
// Set sync initialized state to true so the function will run after
@@ -99,6 +108,7 @@ class FakeProfileSyncService : public ProfileSyncService {
}
private:
+ bool test_started_;
bool sync_initialized_;
// Set to true if a function is called when sync_initialized is in an
// unexpected state.
@@ -141,6 +151,8 @@ class PreferencesPrivateApiTest : public ExtensionApiTest {
profile, &FakeProfileSyncService::BuildFakeProfileSyncService));
browser_ = new Browser(Browser::CreateParams(profile));
+
+ service_->set_test_started(true);
}
// Calls GetSyncCategoriesWithoutPassphraseFunction and verifies that the
« no previous file with comments | « chrome/browser/android/most_visited_sites.cc ('k') | chrome/browser/search/instant_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698