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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
|
"use strict";
function* test_decoder_doctor_notification(type, notificationMessage, options) {
yield BrowserTestUtils.withNewTab({ gBrowser }, function*(browser) {
let awaitNotificationBar =
BrowserTestUtils.waitForNotificationBar(gBrowser, browser, "decoder-doctor-notification");
yield ContentTask.spawn(browser, type, function*(aType) {
Services.obs.notifyObservers(content.window,
"decoder-doctor-notification",
JSON.stringify({type: aType,
isSolved: false,
decoderDoctorReportId: "test",
formats: "test"}));
});
let notification;
try {
notification = yield awaitNotificationBar;
} catch (ex) {
ok(false, ex);
return;
}
ok(notification, "Got decoder-doctor-notification notification");
is(notification.getAttribute("label"), notificationMessage,
"notification message should match expectation");
let button = notification.childNodes[0];
if (options && options.noLearnMoreButton) {
ok(!button, "There should not be a Learn More button");
return;
}
is(button.getAttribute("label"), gNavigatorBundle.getString("decoder.noCodecs.button"),
"notification button should be 'Learn more'");
is(button.getAttribute("accesskey"), gNavigatorBundle.getString("decoder.noCodecs.accesskey"),
"notification button should have accesskey");
let baseURL = Services.urlFormatter.formatURLPref("app.support.baseURL");
let url = baseURL + ((options && options.sumo) ||
"fix-video-audio-problems-firefox-windows");
let awaitNewTab = BrowserTestUtils.waitForNewTab(gBrowser, url);
button.click();
let sumoTab = yield awaitNewTab;
yield BrowserTestUtils.removeTab(sumoTab);
});
}
add_task(function* test_adobe_cdm_not_found() {
// This is only sent on Windows.
if (AppConstants.platform != "win") {
return;
}
let message;
if (AppConstants.isPlatformAndVersionAtMost("win", "5.9")) {
message = gNavigatorBundle.getFormattedString("emeNotifications.drmContentDisabled.message", [""]);
} else {
message = gNavigatorBundle.getString("decoder.noCodecs.message");
}
yield test_decoder_doctor_notification("adobe-cdm-not-found", message);
});
add_task(function* test_adobe_cdm_not_activated() {
// This is only sent on Windows.
if (AppConstants.platform != "win") {
return;
}
let message;
if (AppConstants.isPlatformAndVersionAtMost("win", "5.9")) {
message = gNavigatorBundle.getString("decoder.noCodecsXP.message");
} else {
message = gNavigatorBundle.getString("decoder.noCodecs.message");
}
yield test_decoder_doctor_notification("adobe-cdm-not-activated", message);
});
add_task(function* test_platform_decoder_not_found() {
// Not sent on Windows XP.
if (AppConstants.isPlatformAndVersionAtMost("win", "5.9")) {
return;
}
let message;
let isLinux = AppConstants.platform == "linux";
if (isLinux) {
message = gNavigatorBundle.getString("decoder.noCodecsLinux.message");
} else {
message = gNavigatorBundle.getString("decoder.noHWAcceleration.message");
}
yield test_decoder_doctor_notification("platform-decoder-not-found",
message,
{noLearnMoreButton: isLinux});
});
add_task(function* test_cannot_initialize_pulseaudio() {
// This is only sent on Linux.
if (AppConstants.platform != "linux") {
return;
}
let message = gNavigatorBundle.getString("decoder.noPulseAudio.message");
yield test_decoder_doctor_notification("cannot-initialize-pulseaudio",
message,
{sumo: "fix-common-audio-and-video-issues"});
});
add_task(function* test_unsupported_libavcodec() {
// This is only sent on Linux.
if (AppConstants.platform != "linux") {
return;
}
let message = gNavigatorBundle.getString("decoder.unsupportedLibavcodec.message");
yield test_decoder_doctor_notification("unsupported-libavcodec",
message,
{noLearnMoreButton: true});
});
|