testing/mochitest/tests/browser/browser_add_task.js

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

     1 /* Any copyright is dedicated to the Public Domain.
     2  * http://creativecommons.org/publicdomain/zero/1.0/ */
     4 "use strict";
     6 let test1Complete = false;
     7 let test2Complete = false;
     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 }
    18 add_task(function asyncTest_no1() {
    19   yield executeWithTimeout();
    20   test1Complete = true;
    21 });
    23 add_task(function asyncTest_no2() {
    24   yield executeWithTimeout();
    25   test2Complete = true;
    26 });
    28 add_task(function() {
    29   ok(test1Complete, "We have been through test 1");
    30   ok(test2Complete, "We have been through test 2");
    31 });

mercurial