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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
|
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
/* import-globals-from ../../../../../toolkit/mozapps/update/tests/browser/head.js */
Services.scriptloader.loadSubScript(
"chrome://mochitests/content/browser/toolkit/mozapps/update/tests/browser/head.js",
this
);
add_task(async function verify_distribution_info_hides() {
let defaultBranch = Services.prefs.getDefaultBranch(null);
defaultBranch.setCharPref("distribution.id", "mozilla-test-distribution-id");
defaultBranch.setCharPref("distribution.version", "1.0");
let aboutDialog = await waitForAboutDialog();
await TestUtils.waitForCondition(
() => aboutDialog.document.getElementById("currentChannel").value != "",
"Waiting for init to complete"
);
let distroIdField = aboutDialog.document.getElementById("distributionId");
let distroField = aboutDialog.document.getElementById("distribution");
if (
AppConstants.platform === "win" &&
Services.sysinfo.getProperty("hasWinPackageId")
) {
is(distroIdField.value, "mozilla-test-distribution-id - 1.0");
is(distroIdField.style.display, "block");
is(distroField.style.display, "block");
} else {
is(distroIdField.value, "");
isnot(distroIdField.style.display, "block");
isnot(distroField.style.display, "block");
}
aboutDialog.close();
});
add_task(async function verify_distribution_info_displays() {
let defaultBranch = Services.prefs.getDefaultBranch(null);
defaultBranch.setCharPref("distribution.id", "test-distribution-id");
defaultBranch.setCharPref("distribution.version", "1.0");
defaultBranch.setCharPref("distribution.about", "About Text");
let aboutDialog = await waitForAboutDialog();
await TestUtils.waitForCondition(
() => aboutDialog.document.getElementById("currentChannel").value != "",
"Waiting for init to complete"
);
let distroIdField = aboutDialog.document.getElementById("distributionId");
is(distroIdField.value, "test-distribution-id - 1.0");
is(distroIdField.style.display, "block");
let distroField = aboutDialog.document.getElementById("distribution");
is(distroField.value, "About Text");
is(distroField.style.display, "block");
aboutDialog.close();
});
add_task(async function cleanup() {
let defaultBranch = Services.prefs.getDefaultBranch(null);
// This is the best we can do since we can't remove default prefs
defaultBranch.setCharPref("distribution.id", "");
defaultBranch.setCharPref("distribution.version", "");
defaultBranch.setCharPref("distribution.about", "");
});
|