blob: 0320a14c16af9e81f9ab0263b571218e054e86b6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
var Cu = Components.utils;
var Ci = Components.interfaces;
Cu.importGlobalProperties(['File']);
const { Services } = Cu.import("resource://gre/modules/Services.jsm");
// Load a duplicated copy of the jsm to prevent messing with the currently running one
var scope = {};
Services.scriptloader.loadSubScript("resource://gre/modules/Screenshot.jsm", scope);
const { Screenshot } = scope;
var index = -1;
function next() {
index++;
if (index >= steps.length) {
assert.ok(false, "Shouldn't get here!");
return;
}
try {
steps[index]();
} catch(ex) {
assert.ok(false, "Caught exception: " + ex);
}
}
var steps = [
function getScreenshot() {
let screenshot = Screenshot.get();
assert.ok(screenshot instanceof File,
"Screenshot.get() returns a File");
next();
},
function endOfTest() {
sendAsyncMessage("finish");
}
];
next();
|