testing/xpcshell/example/unit/test_execute_soon.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/testing/xpcshell/example/unit/test_execute_soon.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,20 @@
     1.4 +/* vim:set ts=2 sw=2 sts=2 et: */
     1.5 +/* ***** BEGIN LICENSE BLOCK *****
     1.6 + * Any copyright is dedicated to the Public Domain.
     1.7 + * http://creativecommons.org/licenses/publicdomain/
     1.8 + * ***** END LICENSE BLOCK ***** */
     1.9 +
    1.10 +var complete = false;
    1.11 +
    1.12 +function run_test() {
    1.13 +  dump("Starting test\n");
    1.14 +  do_register_cleanup(function() {
    1.15 +    dump("Checking test completed\n");
    1.16 +    do_check_true(complete);
    1.17 +  });
    1.18 +
    1.19 +  do_execute_soon(function execute_soon_callback() {
    1.20 +    dump("do_execute_soon callback\n");
    1.21 +    complete = true;
    1.22 +  });
    1.23 +}

mercurial