gecko/testing/mochitest
Bobby Holley e80993f0d4 Bug 695292 - Port SimpleTest.executeSoon() to SpecialPowers. r=mrbkap
If we just naively use the thread manager to dispatch the event via SpecialPowers,
we cannot avoid the XPCWrappedJS for the runnable being in chrome scope (even if
we pass a content object, we make the call in chrome scope, so we pass a cross-
compartment wrapper). This means that the machinery in
nsXPCWrappedJSClass::CheckForException ends up calling the error reporter for the
SpecialPowers scope, which isn't what we want.

Messing around with the implementation of CheckForException is playing with fire.
So we work around this with an explicit Cu API. :-(
2012-08-17 15:13:23 -07:00
..
chrome Bug 774032 bonus - Use @DEPTH@ and @relativesrcdir@ in Makefile.in. r=ted 2012-08-04 20:26:44 +02:00
dynamic Bug 774032 bonus - Use @DEPTH@ and @relativesrcdir@ in Makefile.in. r=ted 2012-08-04 20:26:44 +02:00
MochiKit Bug 774032 bonus - Use @DEPTH@ and @relativesrcdir@ in Makefile.in. r=ted 2012-08-04 20:26:44 +02:00
pywebsocket
roboextender Bug 774032 bonus - Use @DEPTH@ and @relativesrcdir@ in Makefile.in. r=ted 2012-08-04 20:26:44 +02:00
specialpowers Bug 774032 bonus - Use @DEPTH@ and @relativesrcdir@ in Makefile.in. r=ted 2012-08-04 20:26:44 +02:00
ssltunnel Bug 780387 - Part b: Stop using PRIntn; r=bsmedberg 2012-08-09 09:09:40 +02:00
static Bug 774032 bonus - Use @DEPTH@ and @relativesrcdir@ in Makefile.in. r=ted 2012-08-04 20:26:44 +02:00
tests Bug 695292 - Port SimpleTest.executeSoon() to SpecialPowers. r=mrbkap 2012-08-17 15:13:23 -07:00
android.json Bug 783515 - Re-enable falsely blamed native Android M3 tests now dom/indexedDB/ipc/test_ipc.html is disabled; r=gbrown,jmaher 2012-08-17 14:42:26 +01:00
browser-harness.xul
browser-test-overlay.xul Bug 728294 - Part 3 - Analyze cycle collection logs on testsuite shutdown to detected leaked windows; r=ted,smaug 2012-08-03 12:36:59 +02:00
browser-test.js bug 770770: refactor webapp runtime test harness to reduce complexity/special-casing; r=adw 2012-08-14 15:27:26 -07:00
cc-analyzer.js Bug 728294 - Part 3 - Analyze cycle collection logs on testsuite shutdown to detected leaked windows; r=ted,smaug 2012-08-03 12:36:59 +02:00
chrome-harness.js
gen_template.pl
harness-overlay.xul
harness.xul
install.rdf
jar.mn Bug 728294 - Part 3 - Analyze cycle collection logs on testsuite shutdown to detected leaked windows; r=ted,smaug 2012-08-03 12:36:59 +02:00
Makefile.in Bug 749257 - Improve test plugin. r=josh, r=bsmedberg 2012-08-13 10:40:15 -07:00
MockFilePicker.jsm Bug 731307 - Async filepicker test changes. r=roc 2012-08-17 11:35:01 -04:00
plain-loop.html
pywebsocket_wrapper.py
README.txt
redirect.html
runtests.py bug 770770: refactor webapp runtime test harness to reduce complexity/special-casing; r=adw 2012-08-14 15:27:26 -07:00
runtestsb2g.py Bug 780031 - Mochitest on b2g reliability improvements, r=jgriffin, DONTBUILD because NPOTB 2012-08-08 17:29:26 -07:00
runtestsremote.py Bug 777500 - Log information about device before and after test for remote mochitest and reftests;r=jmaher 2012-07-25 20:45:36 -04:00
runtestsvmware.py
server.js Back out b77834cb31ad (bug 580794) because of mochitest-browser-chrome timeouts 2012-07-25 16:19:02 -07:00

 ----------------
 mochitest README
 ----------------

Steps to get started:

 1.) Run the runtests.pl script to start the server.
 
     Currently, the test script automatically determines the location
     of *Firefox*.

 2.) gen_template.pl will generate test templates for HTML, XUL, and XHTML.
     Read the comment at the top of the file for usage instructions.

 3.) Write a test.


Example test:

<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=345656
-->
<head>
  <title>Test for Bug 345656</title>
  <script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
  <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>        
  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<p id="display"></p>
<div id="content" style="display: none">
  
</div>
<pre id="test">
<script class="testbody" type="text/javascript">

/** Test for Bug 345656 **/
//
//add information to show on the test page
//
$("display").innerHTML = "doing stuff...";

//
// The '$' is function is shorthand for getElementById. This is the same thing:
//
document.getElementById("display").innerHTML = "doing stuff...";

//
// you can add content that you don't want to clutter 
// the display to the content div.
//
// You can write directly, or you can use MochiKit functions
// to do it in JS like this:
//
appendChildNodes($("content"),
                 DIV({class: "qux"},
                     SPAN({id: "span42"}, "content"))
                 );

//
// the ok() function is like assert
//
ok(true, "checking to see if true is true);

//
// this will fail
//
ok(1==2, "1 equals 2?");


//
// this will be marked as a todo.
// When we fix 1 so it equals 2, we'll need to change this 
// function to ok() or is().
//
todo(1==2, "1 equals 2?");

//
// is() takes two args
//
myVar = "foo";
is(myVar, "foo", "checking to see if myVar is 'foo'");

//
// Tests can run in event handlers.
// Call this to tell SimpleTest to wait for SimpleTest.finish() 
//
SimpleTest.waitForExplicitFinish();

//
// event handler:
//
function event_fired(ev) {
  is(ev.newValue, "width: auto;", "DOMAttrModified event reports correct newValue");
  SimpleTest.finish(); // trigger the end of our test sequence
}

//
// Hook up the event. Mochikit.Signal has many conveniences for this, if you want.
//
$("content").addEventListener("DOMAttrModified", event_fired, false);

//
// Fire the event.
//
$("content").style.width = "auto";

</script>
</pre>
</body>
</html>