2012-04-03 03:52:35 +04:00
|
|
|
/*
|
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public License,
|
|
|
|
* v. 2.0. If a copy of the MPL was not distributed with this file, You can
|
|
|
|
* obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
*
|
|
|
|
* This file defines the commonly-used functionality needed by a stone ridge
|
|
|
|
* test suite. This must be run under xpcshell running in JS v1.8 mode.
|
|
|
|
*/
|
|
|
|
|
2013-03-02 03:56:12 +04:00
|
|
|
/*jshint curly:true, indent:4, latedef:true, undef:true,
|
2013-02-27 21:47:28 +04:00
|
|
|
trailing:true, es5:true, esnext:true*/
|
2013-03-01 23:13:36 +04:00
|
|
|
/*global Components:true, run_test:true, _SR_OUT_FILE:true,
|
2013-03-02 03:16:10 +04:00
|
|
|
do_save_results:true*/
|
2013-02-27 21:47:28 +04:00
|
|
|
|
2012-04-13 01:23:14 +04:00
|
|
|
var STONERIDGE_FINISHED = null;
|
2012-04-03 03:52:35 +04:00
|
|
|
|
|
|
|
var Cc = Components.classes;
|
|
|
|
var Ci = Components.interfaces;
|
|
|
|
var Cr = Components.results;
|
|
|
|
|
2012-04-13 01:23:14 +04:00
|
|
|
/*
|
|
|
|
* This is used to indicate that the tests are done. Now that we know we're
|
|
|
|
* done, we can write the results to disk for the python harness to do its thing
|
|
|
|
* with.
|
|
|
|
*/
|
|
|
|
function do_test_finish() {
|
2013-02-27 21:47:28 +04:00
|
|
|
STONERIDGE_FINISHED = true;
|
2012-04-13 01:23:14 +04:00
|
|
|
}
|
2012-04-04 00:30:58 +04:00
|
|
|
|
2012-04-03 03:52:35 +04:00
|
|
|
/*
|
2012-04-13 01:23:14 +04:00
|
|
|
* This is only here for symmetry with xpcshell unit tests, stone ridge assumes
|
|
|
|
* everything it runs is going to be asynchronous.
|
2012-04-03 03:52:35 +04:00
|
|
|
*/
|
2012-04-13 01:23:14 +04:00
|
|
|
function do_test_pending() {}
|
|
|
|
|
|
|
|
function make_channel(url) {
|
2013-02-27 21:47:28 +04:00
|
|
|
var ios = Cc["@mozilla.org/network/io-service;1"].getService(Ci.nsIIOService);
|
|
|
|
return ios.newChannel(url, "", null);
|
2012-04-03 03:52:35 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* The main entry point for all stone ridge tests
|
|
|
|
*/
|
2012-05-15 00:24:14 +04:00
|
|
|
function do_stoneridge() {
|
2013-02-27 21:47:28 +04:00
|
|
|
STONERIDGE_FINISHED = false;
|
|
|
|
|
|
|
|
run_test();
|
|
|
|
|
|
|
|
// Pump the event loop until we're told to stop
|
2013-03-02 03:56:12 +04:00
|
|
|
var thread = Cc["@mozilla.org/thread-manager;1"].getService().currentThread;
|
2013-02-27 21:47:28 +04:00
|
|
|
while (!STONERIDGE_FINISHED) {
|
|
|
|
thread.processNextEvent(true);
|
|
|
|
}
|
|
|
|
while (thread.hasPendingEvents()) {
|
|
|
|
thread.processNextEvent(true);
|
|
|
|
}
|
|
|
|
|
2013-03-01 23:13:36 +04:00
|
|
|
do_save_results(_SR_OUT_FILE);
|
2012-04-03 03:52:35 +04:00
|
|
|
}
|