-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJSIL.TestFixture.js
More file actions
59 lines (39 loc) · 1.22 KB
/
Copy pathJSIL.TestFixture.js
File metadata and controls
59 lines (39 loc) · 1.22 KB
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
"use strict";
var test = window.test = Object.create(null);
test.logText = "";
test.exceptions = [];
test.game = null;
JSIL.DeclareNamespace("JSIL.TestFixture", false);
JSIL.TestFixture.RecordErrorService = function () {
};
JSIL.TestFixture.RecordErrorService.prototype.error = function (exception) {
var exceptionMessage = "Unknown error";
var exceptionTimestamp = JSIL.Host.getTime() - (window.$jsilbrowserstate.mainRunAtTime || 0);
try {
exceptionMessage = String(exc);
} catch (_exc) {
}
test.exceptions.push([exceptionTimestamp, exceptionMessage]);
};
JSIL.TestFixture.LogService = function () {
};
JSIL.TestFixture.LogService.prototype.write = function (text) {
test.logText += text;
};
JSIL.TestFixture.GameControlService = function () {
};
JSIL.TestFixture.GameControlService.prototype.started = function (game) {
test.game = game;
};
JSIL.Host.registerServices({
error: new JSIL.TestFixture.RecordErrorService(),
stdout: new JSIL.TestFixture.LogService(),
stderr: new JSIL.TestFixture.LogService(),
gameControl: new JSIL.TestFixture.GameControlService()
});
test.pressKeysFor = function (keys, duration) {
pressKeys(keys);
window.setTimeout(function () {
releaseKeys(keys);
});
};