Bug 1638196 - [remote] Use timeout multipler for RecordEvents.record(). r=remote-protocol-reviewers,maja_zf

On Ubuntu 18.04 tests are failing more often for debug builds
due to not received events. By using a timeout multiplier of
4 will give the events enough time to be recorded.

Differential Revision: https://phabricator.services.mozilla.com/D76992
This commit is contained in:
Henrik Skupin 2020-05-27 13:28:37 +00:00
Родитель 18ae80df9c
Коммит 85d151cdef
2 изменённых файлов: 6 добавлений и 7 удалений

Просмотреть файл

@ -12,6 +12,9 @@ const { RemoteAgent } = ChromeUtils.import(
"chrome://remote/content/RemoteAgent.jsm"
);
const TIMEOUT_MULTIPLIER = SpecialPowers.isDebugBuild ? 4 : 1;
const TIMEOUT_EVENTS = 1000 * TIMEOUT_MULTIPLIER;
/*
add_task() is overriden to setup and teardown a test environment
making it easier to write browser-chrome tests for the remote
@ -550,7 +553,7 @@ class RecordEvents {
*
* @return {Array<{ eventName, payload }>} Recorded events
*/
async record(timeout = 1000) {
async record(timeout = TIMEOUT_EVENTS) {
await Promise.race([Promise.all(this.promises), timeoutPromise(timeout)]);
for (const unsubscribe of this.subscriptions) {
unsubscribe();

Просмотреть файл

@ -301,12 +301,8 @@ function recordContextEvents(Runtime, total) {
}
async function assertEventOrder(options = {}) {
const {
history,
expectedEvents = [DESTROYED, CLEARED, CREATED],
timeout,
} = options;
const events = await history.record(timeout);
const { history, expectedEvents = [DESTROYED, CLEARED, CREATED] } = options;
const events = await history.record();
const eventNames = events.map(item => item.eventName);
info(`Expected events: ${expectedEvents}`);
info(`Received events: ${eventNames}`);