2015-03-11 08:35:00 +03:00
|
|
|
const Cu = Components.utils;
|
|
|
|
const Ci = Components.interfaces;
|
|
|
|
|
2015-05-18 16:52:26 +03:00
|
|
|
Cu.importGlobalProperties(['File']);
|
|
|
|
|
2015-03-11 08:35:00 +03:00
|
|
|
const { Services } = Cu.import("resource://gre/modules/Services.jsm");
|
|
|
|
|
|
|
|
// Load a duplicated copy of the jsm to prevent messing with the currently running one
|
|
|
|
let scope = {};
|
|
|
|
Services.scriptloader.loadSubScript("resource://gre/modules/Screenshot.jsm", scope);
|
|
|
|
const { Screenshot } = scope;
|
|
|
|
|
|
|
|
let 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);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
let steps = [
|
|
|
|
function getScreenshot() {
|
|
|
|
let screenshot = Screenshot.get();
|
2015-05-18 16:52:26 +03:00
|
|
|
assert.ok(screenshot instanceof File,
|
2015-03-11 08:35:00 +03:00
|
|
|
"Screenshot.get() returns a File");
|
|
|
|
next();
|
|
|
|
},
|
|
|
|
|
|
|
|
function endOfTest() {
|
|
|
|
sendAsyncMessage("finish");
|
|
|
|
}
|
|
|
|
];
|
|
|
|
|
|
|
|
next();
|