testing/mochitest/tests/Harness_sanity/test_sanity_cleanup.html

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     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