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

Unified Diff: chrome/browser/sync/test/integration/sync_errors_test.cc

Issue 535683002: Fix use-after-free in HDDDTC shutdown (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix tests Created 6 years, 3 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
Index: chrome/browser/sync/test/integration/sync_errors_test.cc
diff --git a/chrome/browser/sync/test/integration/sync_errors_test.cc b/chrome/browser/sync/test/integration/sync_errors_test.cc
index 48fbf46c2dca195f1bc2090252107be98b6fa9d2..6fe399fcbc8cb1905bdfd7bc2f5a839a5db368af 100644
--- a/chrome/browser/sync/test/integration/sync_errors_test.cc
+++ b/chrome/browser/sync/test/integration/sync_errors_test.cc
@@ -37,12 +37,36 @@ class SyncDisabledChecker : public SingleClientStatusChangeChecker {
}
};
+class TypeDisabledChecker : public SingleClientStatusChangeChecker {
+ public:
+ explicit TypeDisabledChecker(ProfileSyncService* service,
+ syncer::ModelType type)
+ : SingleClientStatusChangeChecker(service), type_(type) {}
+
+ virtual bool IsExitConditionSatisfied() OVERRIDE {
+ return !service()->GetActiveDataTypes().Has(type_);
+ }
+
+ virtual std::string GetDebugMessage() const OVERRIDE {
+ return "Type disabled";
+ }
+ private:
+ syncer::ModelType type_;
+};
+
bool AwaitSyncDisabled(ProfileSyncService* service) {
SyncDisabledChecker checker(service);
checker.Wait();
return !checker.TimedOut();
}
+bool AwaitTypeDisabled(ProfileSyncService* service,
+ syncer::ModelType type) {
+ TypeDisabledChecker checker(service, type);
+ checker.Wait();
+ return !checker.TimedOut();
+}
+
class SyncErrorTest : public SyncTest {
public:
SyncErrorTest() : SyncTest(SINGLE_CLIENT) {}
@@ -203,12 +227,9 @@ IN_PROC_BROWSER_TEST_F(LegacySyncErrorTest, DisableDatatypeWhileRunning) {
GetProfile(0)->GetPrefs()->SetBoolean(
prefs::kSavingBrowserHistoryDisabled, true);
- // Flush any tasks posted by observers of the pref change.
- base::RunLoop().RunUntilIdle();
-
- synced_datatypes = GetSyncService((0))->GetActiveDataTypes();
- ASSERT_FALSE(synced_datatypes.Has(syncer::TYPED_URLS));
- ASSERT_FALSE(synced_datatypes.Has(syncer::SESSIONS));
+ // Wait for reconfigurations.
+ ASSERT_TRUE(AwaitTypeDisabled(GetSyncService(0), syncer::TYPED_URLS));
+ ASSERT_TRUE(AwaitTypeDisabled(GetSyncService(0), syncer::SESSIONS));
const BookmarkNode* node1 = AddFolder(0, 0, "title1");
SetTitle(0, node1, "new_title1");
« no previous file with comments | « chrome/browser/sync/profile_sync_service_unittest.cc ('k') | chrome/browser/sync/test_profile_sync_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698