testing/mochitest/tests/browser/browser_add_task.js

changeset 0
6474c204b198
equal deleted inserted replaced
-1:000000000000 0:7af9ab3e57cb
1 /* Any copyright is dedicated to the Public Domain.
2 * http://creativecommons.org/publicdomain/zero/1.0/ */
3
4 "use strict";
5
6 let test1Complete = false;
7 let test2Complete = false;
8
9 function executeWithTimeout() {
10 let deferred = Promise.defer();
11 executeSoon(function() {
12 ok(true, "we get here after a timeout");
13 deferred.resolve();
14 });
15 return deferred.promise;
16 }
17
18 add_task(function asyncTest_no1() {
19 yield executeWithTimeout();
20 test1Complete = true;
21 });
22
23 add_task(function asyncTest_no2() {
24 yield executeWithTimeout();
25 test2Complete = true;
26 });
27
28 add_task(function() {
29 ok(test1Complete, "We have been through test 1");
30 ok(test2Complete, "We have been through test 2");
31 });

mercurial