summaryrefslogtreecommitdiffstats
path: root/browser/base/content/test/plugins/browser_globalplugin_crashinfobar.js
blob: bdca32e70110235f2e2c3493bfc2ba06db771a73 (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
/**
 * Test that the notification bar for crashed GMPs works.
 */
add_task(function*() {
  yield BrowserTestUtils.withNewTab({
    gBrowser,
    url: "about:blank",
  }, function* (browser) {
    yield ContentTask.spawn(browser, null, function* () {
      const GMP_CRASH_EVENT = {
        pluginID: 1,
        pluginName: "GlobalTestPlugin",
        submittedCrashReport: false,
        bubbles: true,
        cancelable: true,
        gmpPlugin: true,
      };

      let crashEvent = new content.PluginCrashedEvent("PluginCrashed",
                                                      GMP_CRASH_EVENT);
      content.dispatchEvent(crashEvent);
    });

    let notification = yield waitForNotificationBar("plugin-crashed", browser);

    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.");
  });
});