testing/mochitest/tests/Harness_sanity/test_sanity_cleanup.html

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/ -->
     3 <!DOCTYPE HTML>
     4 <html>
     5 <head>
     6   <title>SimpleTest.registerCleanupFunction test</title>
     7   <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
     8   <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
     9 </head>
    10 <body>
    11 <script class="testbody" type="text/javascript">
    12 // Not a great example, since we have the pushPrefEnv API to cover
    13 // this use case, but I want to be able to test that the cleanup
    14 // function gets run, so setting and clearing a pref seems straightforward.
    15 function do_cleanup1() {
    16   SpecialPowers.clearUserPref("simpletest.cleanup.1");
    17   info("do_cleanup1 run!");
    18 }
    19 function do_cleanup2() {
    20   SpecialPowers.clearUserPref("simpletest.cleanup.2");
    21   info("do_cleanup2 run!");
    22 }
    23 SpecialPowers.setBoolPref("simpletest.cleanup.1", true);
    24 SpecialPowers.setBoolPref("simpletest.cleanup.2", true);
    25 SimpleTest.registerCleanupFunction(do_cleanup1);
    26 SimpleTest.registerCleanupFunction(do_cleanup2);
    27 ok(true, "dummy check");
    28 </script>
    29 </body>
    30 </html>

mercurial