Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
1 /* Any copyright is dedicated to the Public Domain.
2 http://creativecommons.org/publicdomain/zero/1.0/ */
4 MARIONETTE_TIMEOUT = 30000;
5 MARIONETTE_HEAD_JS = 'head.js';
7 let nfc = window.navigator.mozNfc;
8 function testEnableNFC() {
9 log('Running \'testEnableNFC\'');
10 let req = nfc.startPoll();
11 req.onsuccess = function () {
12 ok(true);
13 runNextTest();
14 };
15 req.onerror = function () {
16 ok(false, "startPoll failed");
17 runNextTest();
18 };
19 }
21 function testDisableNFC() {
22 log('Running \'testDisableNFC\'');
23 let req = nfc.powerOff();
24 req.onsuccess = function () {
25 ok(true);
26 runNextTest();
27 };
28 req.onerror = function () {
29 ok(false, "powerOff failed");
30 runNextTest();
31 };
32 }
34 function testStopPollNFC() {
35 log('Running \'testStopPollNFC\'');
36 let req = nfc.stopPoll();
37 req.onsuccess = function () {
38 ok(true);
39 runNextTest();
40 };
41 req.onerror = function () {
42 ok(false, "stopPoll failed");
43 runNextTest();
44 };
45 }
47 let tests = [
48 testEnableNFC,
49 testStopPollNFC,
50 testDisableNFC
51 ];
53 SpecialPowers.pushPermissions(
54 [{'type': 'nfc-manager', 'allow': true, 'context': document}],
55 runTests);