зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1137966 - Wait for the last auto-refresh to finish before ending the test. r=pbro
This commit is contained in:
Родитель
5b662cbb9a
Коммит
568b089f22
|
@ -483,7 +483,17 @@ let AnimationPlayerFront = FrontClass(AnimationPlayerActor, {
|
|||
return;
|
||||
}
|
||||
|
||||
this.autoRefreshTimer = setInterval(this.refreshState.bind(this), interval);
|
||||
this.autoRefreshTimer = setInterval(() => {
|
||||
// Save the refresh promise for tests. The tests need to detect when the
|
||||
// last request completes or they might finish too early.
|
||||
// Storing the latest Promise is enough to know that there is no pending
|
||||
// requests left as p.js guarantees the last request will get the reply
|
||||
// last.
|
||||
this.pendingRefreshStatePromise = this.refreshState();
|
||||
this.pendingRefreshStatePromise.then(() => {
|
||||
this.pendingRefreshStatePromise = null;
|
||||
});
|
||||
}, interval);
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
|
@ -45,7 +45,13 @@ add_task(function*() {
|
|||
info("Stop the auto-refresh");
|
||||
player.stopAutoRefresh();
|
||||
|
||||
resolve();
|
||||
if (player.pendingRefreshStatePromise) {
|
||||
// A new request was fired before we had chance to stop it. Wait for
|
||||
// it to complete.
|
||||
player.pendingRefreshStatePromise.then(resolve);
|
||||
} else {
|
||||
resolve();
|
||||
}
|
||||
}
|
||||
};
|
||||
player.on(player.AUTO_REFRESH_EVENT, onNewState);
|
||||
|
|
Загрузка…
Ссылка в новой задаче