Backed out changeset 238352c73015 (bug 1110887)

--HG--
extra : rebase_source : 41528ae51914dae53d840af7824a2d14c72f906b
This commit is contained in:
Carsten "Tomcat" Book 2015-04-09 13:05:44 +02:00
Родитель 66907bfaea
Коммит 3ae7118364
1 изменённых файлов: 54 добавлений и 32 удалений

Просмотреть файл

@ -2,39 +2,61 @@
* 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/. */
/**
* Test that plugin crash submissions still work properly after
* click-to-play activation.
*/
add_task(function*() {
yield BrowserTestUtils.withNewTab({
gBrowser,
url: "about:blank",
}, function* (browser) {
yield ContentTask.spawn(browser, null, function* () {
const GMP_CRASH_EVENT = {
pluginName: "GlobalTestPlugin",
pluginDumpID: "1234",
browserDumpID: "5678",
submittedCrashReport: false,
bubbles: true,
cancelable: true,
gmpPlugin: true,
};
let gTestBrowser = null;
let crashEvent = new content.PluginCrashedEvent("PluginCrashed",
GMP_CRASH_EVENT);
content.dispatchEvent(crashEvent);
});
let crashedEventProperties = {
pluginName: "GlobalTestPlugin",
pluginDumpID: "1234",
browserDumpID: "5678",
submittedCrashReport: false,
bubbles: true,
cancelable: true
}
let notification = yield waitForNotificationBar("plugin-crashed", browser);
// Test that plugin crash submissions still work properly after
// click-to-play activation.
let notificationBox = gBrowser.getNotificationBox(browser);
ok(notification, "Infobar was shown.");
is(notification.priority, notificationBox.PRIORITY_WARNING_MEDIUM,
"Correct priority.");
is(notification.getAttribute("label"),
"The GlobalTestPlugin plugin has crashed.",
"Correct message.");
function test() {
waitForExplicitFinish();
let tab = gBrowser.loadOneTab("about:blank", { inBackground: false });
gTestBrowser = gBrowser.getBrowserForTab(tab);
gTestBrowser.addEventListener("PluginCrashed", onCrash, false);
gTestBrowser.addEventListener("load", onPageLoad, true);
registerCleanupFunction(function cleanUp() {
gTestBrowser.removeEventListener("PluginCrashed", onCrash, false);
gTestBrowser.removeEventListener("load", onPageLoad, true);
gBrowser.removeTab(tab);
});
});
}
function onPageLoad() {
executeSoon(generateCrashEvent);
}
function generateCrashEvent() {
let window = gTestBrowser.contentWindow;
let crashedEvent = new window.PluginCrashedEvent("PluginCrashed", crashedEventProperties);
window.dispatchEvent(crashedEvent);
}
function onCrash(event) {
let target = event.target;
is (target, gTestBrowser.contentWindow, "Event target is the window.");
for (let [name, val] of Iterator(crashedEventProperties)) {
let propVal = event[name];
is (propVal, val, "Correct property: " + name + ".");
}
waitForNotificationBar("plugin-crashed", gTestBrowser, (notification) => {
let notificationBox = gBrowser.getNotificationBox(gTestBrowser);
ok(notification, "Infobar was shown.");
is(notification.priority, notificationBox.PRIORITY_WARNING_MEDIUM, "Correct priority.");
is(notification.getAttribute("label"), "The GlobalTestPlugin plugin has crashed.", "Correct message.");
finish();
});
}