Currently we provide a way to start a sync cycle, and we provide a way to listen for sync cycles finishing. We do not have a way to associate the two: there should be a way to pass in a Callback that gets called when the next cycle to start after that moment completes.
This would make tests more reliable and let us fix things like 147086. Right now we do some hacky things such as comparing the timestamp we asked the cycle to start with the most recent one to finish:
https://cs.chromium.org/chromium/src/chrome/test/android/javatests/src/org/chromium/chrome/test/util/browser/sync/SyncTestUtil.java?l=113
This is a known cause of test flakiness, as it's possible for a cycle to already be in progress when we grab the start time, and the one that completes to not include an entity we were waiting for.
I sort of feel like I've filed this before but I couldn't find it. Pavel, you're the most familiar with the way the sync engine works, so I'm going to let you triage.
Comment 1 by pav...@chromium.org
, Jan 25 2017