blob: 5db423878e2521e6a6bf7a9b9a0a55eeb1c230c5 (
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
|
/* -*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- */
/* vim: set sts=2 sw=2 et tw=80: */
"use strict";
add_task(async function testPrintPreview() {
await BrowserTestUtils.openNewForegroundTab(gBrowser, "http://example.net/");
let extension = ExtensionTestUtils.loadExtension({
manifest: {
permissions: ["tabs"],
},
background: async function () {
await browser.tabs.printPreview();
browser.test.assertTrue(true, "print preview entered");
browser.test.notifyPass("tabs.printPreview");
},
});
is(
document.querySelector(".printPreviewBrowser"),
null,
"There shouldn't be any print preview browser"
);
await extension.startup();
// Ensure we're showing the preview...
await BrowserTestUtils.waitForCondition(() => {
let preview = document.querySelector(".printPreviewBrowser");
return preview && BrowserTestUtils.is_visible(preview);
});
gBrowser.getTabDialogBox(gBrowser.selectedBrowser).abortAllDialogs();
// Wait for the preview to go away
await BrowserTestUtils.waitForCondition(
() => !document.querySelector(".printPreviewBrowser")
);
await extension.awaitFinish("tabs.printPreview");
await extension.unload();
BrowserTestUtils.removeTab(gBrowser.tabs[1]);
});
|