| 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..5581d3d09e049c3b807d67fcf0b7e6cba65e2b0a 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.
|
| @@ -611,9 +613,29 @@ bool SyncTest::SetupSync() {
|
| }
|
| }
|
|
|
| + int clientIndex = 0;
|
| + // If we're using external servers, clear server data so the account starts
|
| + // with a clean slate.
|
| + if (UsingExternalServers()) {
|
| + // Setup the first client so the sync engine is initialized, which is
|
| + // required to clear server data.
|
| + DVLOG(1) << "Setting up first client for clear.";
|
| + if (!GetClient(clientIndex)->SetupSyncForClear()) {
|
| + LOG(FATAL) << "SetupSync() failed.";
|
| + return false;
|
| + }
|
| +
|
| + DVLOG(1) << "Done setting up first client for clear.";
|
| + if (!ClearServerData(GetClient(clientIndex++))) {
|
| + LOG(FATAL) << "ClearServerData failed.";
|
| + return false;
|
| + }
|
| + }
|
| +
|
| // Sync each of the profiles.
|
| - for (int i = 0; i < num_clients_; ++i) {
|
| - if (!GetClient(i)->SetupSync()) {
|
| + for (; clientIndex < num_clients_; clientIndex++) {
|
| + DVLOG(1) << "Setting up " << clientIndex << " client";
|
| + if (!GetClient(clientIndex)->SetupSync()) {
|
| LOG(FATAL) << "SetupSync() failed.";
|
| return false;
|
| }
|
| @@ -1139,3 +1161,14 @@ void SyncTest::SetPreexistingPreferencesFileContents(
|
| const std::string& contents) {
|
| preexisting_preferences_file_contents_ = contents;
|
| }
|
| +
|
| +bool SyncTest::ClearServerData(ProfileSyncServiceHarness* harness) {
|
| + // At this point our birthday is good.
|
| + base::RunLoop run_loop;
|
| + harness->service()->ClearServerDataForTest(run_loop.QuitClosure());
|
| + run_loop.Run();
|
| +
|
| + // Our birthday is bad here so restart sync to get the new birthday from the
|
| + // server.
|
| + return harness->RestartSyncService();
|
| +}
|
|
|