Commit 681895a1 authored by Marc Treib's avatar Marc Treib Committed by Commit Bot

Sync tests: don't needlessly re-create ConfigurationRefresher

https://crrev.com/c/1030177 introduced lazy creation of the
ConfigurationRefresher in SyncTest::InitializeInvalidations. However, it
unconditionally re-created it for every Sync client. Re-creating it
drops any previous observer registrations, which means the refresher
would effectively only work for the *last* client.
This CL fixes this by creating it only if it doesn't exist yet.
Interestingly, this didn't seem to cause any problems in practice.

Bug: 832019
Change-Id: Ic9df260fdc5b8955d591d96678b4e1500035067f
Reviewed-on: https://chromium-review.googlesource.com/c/1261439Reviewed-by: default avatarMikel Astiz <mastiz@chromium.org>
Commit-Queue: Marc Treib <treib@chromium.org>
Cr-Commit-Position: refs/heads/master@{#596654}
parent 5ad19ef3
......@@ -714,7 +714,11 @@ void SyncTest::SetUpInvalidations(int index) {
}
void SyncTest::InitializeInvalidations(int index) {
configuration_refresher_ = std::make_unique<ConfigurationRefresher>();
// Lazily create |configuration_refresher_| the first time we get here (or the
// first time after a previous call to StopConfigurationRefresher).
if (!configuration_refresher_) {
configuration_refresher_ = std::make_unique<ConfigurationRefresher>();
}
switch (server_type_) {
case EXTERNAL_LIVE_SERVER:
......
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