Bug 1152761 - Fix intermittent failure fixes in test_looprooms.js. Ensure we wait for all conditions to complete before moving on. r=mikedeboer

This commit is contained in:
Mark Banner 2015-05-06 12:47:14 +01:00
Родитель 90721308af
Коммит 2c77a3f8a4
1 изменённых файлов: 13 добавлений и 7 удалений

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

@ -463,33 +463,38 @@ add_task(function* test_roomUpdates() {
"781f012b-f1ea-4ce1-9105-7cfc36fb4ec7"
];
roomsPushNotification("1", kChannelGuest);
yield waitForCondition(() => Object.getOwnPropertyNames(gExpectedLeaves).length === 0);
yield waitForCondition(() => Object.getOwnPropertyNames(gExpectedLeaves).length === 0 &&
gExpectedUpdates.length === 0);
gExpectedUpdates.push("_nxD4V4FflQ");
gExpectedJoins["_nxD4V4FflQ"] = ["2a1787a6-4a73-43b5-ae3e-906ec1e763cb"];
roomsPushNotification("2", kChannelGuest);
yield waitForCondition(() => Object.getOwnPropertyNames(gExpectedJoins).length === 0);
yield waitForCondition(() => Object.getOwnPropertyNames(gExpectedJoins).length === 0 &&
gExpectedUpdates.length === 0);
gExpectedUpdates.push("_nxD4V4FflQ");
gExpectedJoins["_nxD4V4FflQ"] = ["781f012b-f1ea-4ce1-9105-7cfc36fb4ec7"];
gExpectedLeaves["_nxD4V4FflQ"] = ["2a1787a6-4a73-43b5-ae3e-906ec1e763cb"];
roomsPushNotification("3", kChannelGuest);
yield waitForCondition(() => Object.getOwnPropertyNames(gExpectedLeaves).length === 0);
yield waitForCondition(() => Object.getOwnPropertyNames(gExpectedLeaves).length === 0 &&
Object.getOwnPropertyNames(gExpectedJoins).length === 0 &&
gExpectedUpdates.length === 0);
gExpectedUpdates.push("_nxD4V4FflQ");
gExpectedJoins["_nxD4V4FflQ"] = [
"2a1787a6-4a73-43b5-ae3e-906ec1e763cb",
"5de6281c-6568-455f-af08-c0b0a973100e"];
roomsPushNotification("4", kChannelGuest);
yield waitForCondition(() => Object.getOwnPropertyNames(gExpectedJoins).length === 0);
yield waitForCondition(() => Object.getOwnPropertyNames(gExpectedJoins).length === 0 &&
gExpectedUpdates.length === 0);
});
// Test if push updates' channelIDs are respected.
add_task(function* () {
add_task(function* test_channelIdsRespected() {
function badRoomJoin() {
Assert.ok(false, "Unexpected 'joined' event emitted!");
}
LoopRooms.on("join", onRoomLeft);
LoopRooms.on("join", badRoomJoin);
roomsPushNotification("4", kChannelFxA);
LoopRooms.off("join", badRoomJoin);
@ -503,7 +508,8 @@ add_task(function* () {
"5de6281c-6568-455f-af08-c0b0a973100e"
];
roomsPushNotification("3", kChannelFxA);
yield waitForCondition(() => Object.getOwnPropertyNames(gExpectedLeaves).length === 0);
yield waitForCondition(() => Object.getOwnPropertyNames(gExpectedLeaves).length === 0 &&
gExpectedUpdates.length === 0);
});
// Test if joining a room as Guest works as expected.