2
* Helper framework if tests should be performed within a running app
7
function dumperr(str) {
9
var consoleSvc = Components.classes["@mozilla.org/consoleservice;1"].
10
getService(Components.interfaces.nsIConsoleService);
11
consoleSvc.logStringMessage("IPC-Pipe Test: "+str);
14
function do_check_true(boolValue)
17
dumperr("ERROR: found not true value");
20
function do_check_false(boolValue)
23
dumperr("ERROR: found true value");
26
function do_check_eq(a, b)
29
dumperr("ERROR: found: '"+a+"' != '"+b+"'");
32
function do_check_neq(a, b)
35
dumperr("ERROR: found: '"+a+"' == '"+b+"'");
38
function do_throw(txt) {
43
function do_get_cwd() {
44
var fn="/Users/pbr/enigmail/tmp";
46
var localfile = Components.classes["@mozilla.org/file/local;1"].createInstance(
47
Components.interfaces.nsIFile);
48
localfile.initWithPath(fn);
53
function do_get_file(testdirRelativePath, allowNonexistent)
56
var isLinux = ("@mozilla.org/gnome-gconf-service;1" in Components.classes);
60
fn="/home/enigmail/tmp/"+testdirRelativePath;
62
fn="/Users/pbr/enigmail/tmp/"+testdirRelativePath;
66
var localfile = Components.classes["@mozilla.org/file/local;1"].createInstance(
67
Components.interfaces.nsILocalFile);
68
localfile.initWithPath(fn);
70
if (! (allowNonexistent || localfile.exists())) {
71
dumperr("ERROR: file '"+fn+"' not found");
77
function do_test_pending() {
79
window.setTimeout(checkStillPending, 300);
82
function checkStillPending() {
84
window.setTimeout(checkStillPending, 300);
87
function do_test_finished() {
91
alert("all tests succeeded OK");
93
alert("Test terminated with error");
96
function run_test_wrapper() {
101
if (! gTestPending) do_test_finished();
104
dumperr(ex.toString());
105
alert("Test created exception");
107
//dumperr("---- end -----");