blob: c9ff84595a3de321f0de3ad06e6072cd77161657 (
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
41
|
'use strict';
(function() {
var lastWakeLock,
throwAtNextUnlock;
function mnwl_requestWakeLock(lock) {
lastWakeLock = {
released: false,
topic: lock,
unlock: function() {
if (throwAtNextUnlock) {
throwAtNextUnlock = false;
throw "NS_ERROR_DOM_INVALID_STATE_ERR";
}
this.released = true;
}
};
return lastWakeLock;
}
function mnwl_teardown() {
lastWakeLock = undefined;
throwAtNextUnlock = undefined;
}
function mnwl_throwAtNextUnlock() {
throwAtNextUnlock = true;
}
window.MockNavigatorWakeLock = {
requestWakeLock: mnwl_requestWakeLock,
mTeardown: mnwl_teardown,
mThrowAtNextUnlock: mnwl_throwAtNextUnlock,
get mLastWakeLock() {
return lastWakeLock;
}
};
})();
|