gecko/testing/mochitest/tests/test_SpecialPowersExtension.html

47 lines
1.7 KiB
HTML

<!DOCTYPE HTML>
<html>
<head>
<title>Test for SpecialPowers extension</title>
<script type="text/javascript" src="/MochiKit/packed.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body onload="starttest();">
<div id="content" style="display: none">
</div>
<pre id="test">
<script class="testbody" type="text/javascript">
dump("\nSPECIALPTEST:::Test script loaded " + (new Date).getTime() + "\n");
SimpleTest.waitForExplicitFinish();
function starttest(){
dump("\nSPECIALPTEST:::Test script running after load " + (new Date).getTime() + "\n");
/** Test for SpecialPowers extension **/
is(SpecialPowers.sanityCheck(), "foo", "check to see whether the Special Powers extension is installed.");
// Test a sync call into chrome
SpecialPowers.setBoolPref('extensions.checkCompatibility', true);
is(SpecialPowers.getBoolPref('extensions.checkCompatibility'), true, "Check to see if we can set a preference properly");
// Test a int pref
SpecialPowers.setIntPref('extensions.foobar', 42);
is(SpecialPowers.getIntPref('extensions.foobar'), 42, "Check int pref");
// Test a string pref
SpecialPowers.setCharPref("extensions.foobaz", "hi there");
is(SpecialPowers.getCharPref("extensions.foobaz"), "hi there", "Check string pref");
// Test Complex Pref - TODO: Without chrome access, I don't know how you'd actually
// set this preference since you have to create an XPCOM object.
// Leaving untested for now.
SimpleTest.finish();
}
//starttest();
</script>
</pre>
</body>
</html>