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
|
// Test the sidebar counters in BrowserUITelemetry.
"use strict";
const { BrowserUITelemetry: BUIT } = Cu.import("resource:///modules/BrowserUITelemetry.jsm", {});
add_task(function* testSidebarOpenClose() {
// Reset BrowserUITelemetry's world.
BUIT._countableEvents = {};
yield SidebarUI.show("viewTabsSidebar");
let counts = BUIT._countableEvents[BUIT.currentBucket];
Assert.deepEqual(counts, { sidebar: { viewTabsSidebar: { show: 1 } } });
yield SidebarUI.hide();
Assert.deepEqual(counts, { sidebar: { viewTabsSidebar: { show: 1, hide: 1 } } });
yield SidebarUI.show("viewBookmarksSidebar");
Assert.deepEqual(counts, {
sidebar: {
viewTabsSidebar: { show: 1, hide: 1 },
viewBookmarksSidebar: { show: 1 },
}
});
// Re-open the tabs sidebar while bookmarks is open - bookmarks should
// record a close.
yield SidebarUI.show("viewTabsSidebar");
Assert.deepEqual(counts, {
sidebar: {
viewTabsSidebar: { show: 2, hide: 1 },
viewBookmarksSidebar: { show: 1, hide: 1 },
}
});
yield SidebarUI.hide();
Assert.deepEqual(counts, {
sidebar: {
viewTabsSidebar: { show: 2, hide: 2 },
viewBookmarksSidebar: { show: 1, hide: 1 },
}
});
// Toggle - this will re-open viewTabsSidebar
yield SidebarUI.toggle("viewTabsSidebar");
Assert.deepEqual(counts, {
sidebar: {
viewTabsSidebar: { show: 3, hide: 2 },
viewBookmarksSidebar: { show: 1, hide: 1 },
}
});
yield SidebarUI.toggle("viewTabsSidebar");
Assert.deepEqual(counts, {
sidebar: {
viewTabsSidebar: { show: 3, hide: 3 },
viewBookmarksSidebar: { show: 1, hide: 1 },
}
});
});
|