1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/testing/mochitest/tests/Harness_sanity/test_sanity_cleanup.html Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,30 @@ 1.4 +<!-- Any copyright is dedicated to the Public Domain. 1.5 + - http://creativecommons.org/publicdomain/zero/1.0/ --> 1.6 +<!DOCTYPE HTML> 1.7 +<html> 1.8 +<head> 1.9 + <title>SimpleTest.registerCleanupFunction test</title> 1.10 + <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> 1.11 + <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> 1.12 +</head> 1.13 +<body> 1.14 +<script class="testbody" type="text/javascript"> 1.15 +// Not a great example, since we have the pushPrefEnv API to cover 1.16 +// this use case, but I want to be able to test that the cleanup 1.17 +// function gets run, so setting and clearing a pref seems straightforward. 1.18 +function do_cleanup1() { 1.19 + SpecialPowers.clearUserPref("simpletest.cleanup.1"); 1.20 + info("do_cleanup1 run!"); 1.21 +} 1.22 +function do_cleanup2() { 1.23 + SpecialPowers.clearUserPref("simpletest.cleanup.2"); 1.24 + info("do_cleanup2 run!"); 1.25 +} 1.26 +SpecialPowers.setBoolPref("simpletest.cleanup.1", true); 1.27 +SpecialPowers.setBoolPref("simpletest.cleanup.2", true); 1.28 +SimpleTest.registerCleanupFunction(do_cleanup1); 1.29 +SimpleTest.registerCleanupFunction(do_cleanup2); 1.30 +ok(true, "dummy check"); 1.31 +</script> 1.32 +</body> 1.33 +</html>