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

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

Issue 2716413003: Initial clear server data impl (Closed)
Patch Set: Clear server data command 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/sync/test/integration/sync_test.cc
diff --git a/chrome/browser/sync/test/integration/sync_test.cc b/chrome/browser/sync/test/integration/sync_test.cc
index f40d1f98fd44fbfb4f595c9aa98392743c0720e2..9cee9439d3b97096572fe44be14ce68d635a81aa 100644
--- a/chrome/browser/sync/test/integration/sync_test.cc
+++ b/chrome/browser/sync/test/integration/sync_test.cc
@@ -231,7 +231,9 @@ SyncTest::SyncTest(TestType test_type)
}
}
-SyncTest::~SyncTest() {}
+SyncTest::~SyncTest() {
+ sync_datatype_helper::DissociateWithTest(this);
+}
void SyncTest::SetUp() {
// Sets |server_type_| if it wasn't specified by the test.
@@ -350,6 +352,7 @@ void SyncTest::CreateProfile(int index) {
tmp_profile_paths_[index]->CreateUniqueTempDirUnderPath(user_data_dir));
}
base::FilePath profile_path = tmp_profile_paths_[index]->GetPath();
+ LOG(WARNING) << "PROFILE PATH " << profile_path.value();
skym 2017/03/07 18:38:22 Should this be DVLOG? Did you mean to remove this?
wylieb 2017/03/07 19:52:23 Done.
if (UsingExternalServers()) {
// If running against an EXTERNAL_LIVE_SERVER, we signin profiles using real
// GAIA server. This requires creating profiles with no test hooks.
@@ -611,12 +614,33 @@ bool SyncTest::SetupSync() {
}
}
- // Sync each of the profiles.
- for (int i = 0; i < num_clients_; ++i) {
- if (!GetClient(i)->SetupSync()) {
+ if (UsingExternalServers()) {
+ DVLOG(1) << "Setting up first client for clear.";
+ if (!GetClient(0)->SetupSyncForClear()) {
LOG(FATAL) << "SetupSync() failed.";
return false;
}
+
+ DVLOG(1) << "Done Setting up first client for clear";
skym 2017/03/07 18:38:22 Setting should be setting Also, end with punctuat
wylieb 2017/03/07 19:52:23 Done.
+ ClearServerData(GetClient(0));
+
+ // Sync each of the profiles.
+ for (int i = 1; i < num_clients_; ++i) {
+ DVLOG(1) << "Setting up " << i << " client";
+
+ if (!GetClient(i)->SetupSync()) {
+ LOG(FATAL) << "SetupSync() failed.";
+ return false;
+ }
+ }
+ } else {
+ // Sync each of the profiles.
+ for (int i = 0; i < num_clients_; ++i) {
skym 2017/03/07 18:38:22 This loop and logic seems extremely similar to jus
+ if (!GetClient(i)->SetupSync()) {
+ LOG(FATAL) << "SetupSync() failed.";
+ return false;
+ }
+ }
}
// Because clients may modify sync data as part of startup (for example local
@@ -1139,3 +1163,12 @@ void SyncTest::SetPreexistingPreferencesFileContents(
const std::string& contents) {
preexisting_preferences_file_contents_ = contents;
}
+
+void SyncTest::ClearServerData(ProfileSyncServiceHarness* harness) {
+ // start config, at this point out bday is good
skym 2017/03/07 18:38:22 Sorry for all the obnoxious nits, but, https://goo
wylieb 2017/03/07 19:52:23 Done.
+ base::RunLoop run_loop;
+ harness->service()->ClearServerDataForTest(run_loop.QuitClosure());
+ run_loop.Run();
+
+ harness->RestartSyncService();
+}

Powered by Google App Engine
This is Rietveld 408576698