Commit 9a6e4459 authored by Nohemi Fernandez's avatar Nohemi Fernandez Committed by Chromium LUCI CQ

[iOS] Ensure that Sync tests are more flexible on startup.

Currently, Chrome strictly enforces that the fake Sync server is running
to call |ClearSyncServerData|. This may be causing intermittent issues
in EarlGrey tests if service startup is in an inconsistent state.

This patch makes the test suites more flexible by allowing the
inconsistent state, and changing a failure for a no-op case.

Bug: 11530874
Change-Id: I4f20dc0c282d1b09ad54d43ab32dd10f54a2d42c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2600741
Commit-Queue: Nohemi Fernandez <fernandex@chromium.org>
Reviewed-by: default avatarSylvain Defresne <sdefresne@chromium.org>
Cr-Commit-Position: refs/heads/master@{#838958}
parent ceb12fd1
......@@ -72,7 +72,8 @@ void DeleteAutofillProfileFromFakeSyncServer(std::string guid);
// Clears the autofill profile for the given |guid|.
void ClearAutofillProfile(std::string guid);
// Clears fake sync server data.
// Clears fake sync server data if the server is running, otherwise does
// nothing.
void ClearSyncServerData();
// Returns true if the sync backend server is intialized.
......
......@@ -128,8 +128,10 @@ void TriggerSyncCycle(syncer::ModelType type) {
}
void ClearSyncServerData() {
DCHECK(gSyncFakeServer);
gSyncFakeServer->ClearServerData();
// Allow the caller to preventively clear server data.
if (gSyncFakeServer) {
gSyncFakeServer->ClearServerData();
}
}
int GetNumberOfSyncEntities(syncer::ModelType type) {
......
......@@ -150,7 +150,7 @@ id ExecuteJavaScript(NSString* javascript, NSError* __autoreleasing* out_error);
#pragma mark - Sync Utilities (EG2)
// Clears fake sync server data.
// Clears fake sync server data if the server is running.
- (void)clearSyncServerData;
// Starts the sync server. The server should not be running when calling this.
......
......@@ -285,7 +285,7 @@
#pragma mark - Sync Utilities (EG2)
// Clears fake sync server data.
// Clears fake sync server data if the server is running.
+ (void)clearSyncServerData;
// Starts the sync server. The server should not be running when calling this.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment