blob: 58d9b43c0e4f08e16d96fda787759c13ef336be0 (
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
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
|
"use strict";
const { AboutWelcomeParent } = ChromeUtils.import(
"resource:///actors/AboutWelcomeParent.jsm"
);
async function openAboutWelcomeTab() {
await setAboutWelcomePref(true);
let tab = await BrowserTestUtils.openNewForegroundTab(
gBrowser,
"about:welcome"
);
registerCleanupFunction(() => {
BrowserTestUtils.removeTab(tab);
});
return tab;
}
/**
* Test simplified welcome UI tab closed terminate reason
*/
add_task(async function test_About_Welcome_Tab_Close() {
await setAboutWelcomePref(true);
let tab = await BrowserTestUtils.openNewForegroundTab(
gBrowser,
"about:welcome",
false
);
Assert.ok(Services.focus.activeWindow, "Active window is not null");
let AWP = new AboutWelcomeParent();
Assert.ok(AWP.AboutWelcomeObserver, "AboutWelcomeObserver is not null");
BrowserTestUtils.removeTab(tab);
Assert.equal(
AWP.AboutWelcomeObserver.terminateReason,
AWP.AboutWelcomeObserver.AWTerminate.TAB_CLOSED,
"Terminated due to tab closed"
);
});
/**
* Test simplified welcome UI closed due to change in location uri
*/
add_task(async function test_About_Welcome_Location_Change() {
await openAboutWelcomeTab();
let windowGlobalParent =
gBrowser.selectedBrowser.browsingContext.currentWindowGlobal;
let aboutWelcomeActor = await windowGlobalParent.getActor("AboutWelcome");
Assert.ok(
aboutWelcomeActor.AboutWelcomeObserver,
"AboutWelcomeObserver is not null"
);
BrowserTestUtils.loadURIString(
gBrowser.selectedBrowser,
"http://example.com/#foo"
);
await BrowserTestUtils.waitForLocationChange(
gBrowser,
"http://example.com/#foo"
);
Assert.equal(
aboutWelcomeActor.AboutWelcomeObserver.terminateReason,
aboutWelcomeActor.AboutWelcomeObserver.AWTerminate.ADDRESS_BAR_NAVIGATED,
"Terminated due to location uri changed"
);
});
|