blob: 7c368412fcac9dc567e78a4cad1c18e54b97dacb (
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
const { utils: Cu, classes: Cc, interfaces: Ci } = Components;
function setPermissions() {
if (__webDriverArguments.length < 2) {
return;
}
let serverAddr = __webDriverArguments[0];
let serverPort = __webDriverArguments[1];
let perms = Cc["@mozilla.org/permissionmanager;1"]
.getService(Ci.nsIPermissionManager);
let ioService = Cc["@mozilla.org/network/io-service;1"]
.getService(Ci.nsIIOService);
let uri = ioService.newURI("http://" + serverAddr + ":" + serverPort, null, null);
perms.add(uri, "allowXULXBL", Ci.nsIPermissionManager.ALLOW_ACTION);
}
var cm = Cc["@mozilla.org/categorymanager;1"]
.getService(Ci.nsICategoryManager);
// Disable update timers that cause b2g failures.
if (cm) {
cm.deleteCategoryEntry("update-timer", "nsUpdateService", false);
}
// Load into any existing windows
var wm = Cc["@mozilla.org/appshell/window-mediator;1"]
.getService(Ci.nsIWindowMediator);
var win = wm.getMostRecentWindow('');
setPermissions();
// Loading this into the global namespace causes intermittent failures.
// See bug 882888 for more details.
var reftest = {};
Cu.import("chrome://reftest/content/reftest.jsm", reftest);
// Prevent display off during testing.
navigator.mozPower.screenEnabled = true;
var settingLock = navigator.mozSettings.createLock();
var settingResult = settingLock.set({
'screen.timeout': 0
});
settingResult.onsuccess = function () {
dump("Set screen.time to 0\n");
// Start the reftests
reftest.OnRefTestLoad(win);
}
settingResult.onerror = function () {
dump("Change screen.time failed\n");
// Start the reftests
reftest.OnRefTestLoad(win);
}
|