2 <?xml-stylesheet href=
"chrome://global/skin" type=
"text/css"?>
3 <?xml-stylesheet href=
"chrome://mochikit/content/tests/SimpleTest/test.css"
5 <window title=
"Taskbar Previews Test"
6 xmlns:
html=
"http://www.w3.org/1999/xhtml"
7 xmlns=
"http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
10 <title>Previews - yeah!
</title>
11 <script src=
"chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" />
12 <script class=
"testbody" type=
"application/javascript">
14 let taskbar = Cc[
"@mozilla.org/windows-taskbar;1"].getService(Ci.nsIWinTaskbar);
16 function IsWin7OrHigher() {
18 var ver = parseFloat(Services.sysinfo.getProperty(
"version"));
24 isnot(taskbar, null,
"Taskbar service is defined");
25 is(taskbar.available, IsWin7OrHigher(),
"Expected availability of taskbar");
27 SimpleTest.waitForExplicitFinish();
29 function stdPreviewSuite(p) {
30 p.visible = !p.visible;
31 p.visible = !p.visible;
39 if (!taskbar.available)
44 thumbnailAspectRatio:
1.0,
45 get wrappedJSObject() { return this; }
48 let win = Services.wm.getMostRecentWindow(
"navigator:browser");
49 let docShell = win.gBrowser.docShell;
51 let winPreview = taskbar.getTaskbarWindowPreview(docShell);
52 isnot(winPreview, null,
"Window preview is not null");
53 winPreview.controller = controller;
54 let button = winPreview.getButton(
0);
55 isnot(button, null,
"Could get button at valid index");
57 winPreview.getButton(-
1);
58 ok(false,
"Got button at negative index");
61 winPreview.getButton(Ci.nsITaskbarWindowPreview.NUM_TOOLBAR_BUTTONS);
62 ok(false,
"Got button at index that is too large");
65 stdPreviewSuite(winPreview);
66 // Let's not perma-hide this window from the taskbar
67 winPreview.visible = true;
69 let tabP = taskbar.createTaskbarTabPreview(docShell, controller);
70 isnot(tabP, null,
"Tab preview is not null");
71 is(tabP.controller.wrappedJSObject, controller,
"Controllers match");
72 is(tabP.icon, null,
"Default icon is null (windows default)");
77 ok(false,
"Moved a preview next to itself!");
79 stdPreviewSuite(tabP);
81 let tabP2 = taskbar.createTaskbarTabPreview(docShell, controller);
85 isnot(tabP2, null,
"2nd Tab preview is not null");
86 isnot(tabP,tabP2,
"Tab previews are different");
88 ok(tabP.active && !tabP2.active,
"Only one tab is active (part 1)");
90 ok(!tabP.active && tabP2.active,
"Only one tab is active (part 2)");
92 ok(tabP.active && !tabP2.active,
"Only one tab is active (part 3)");
94 ok(!tabP.active && !tabP2.active,
"Neither tab is active");
95 is(winPreview.active, false,
"Window preview is not active");
97 winPreview.active = true;
98 ok(winPreview.active && !tabP.active,
"Tab preview takes activation from window");
100 ok(tabP.active && !winPreview.active,
"Tab preview takes activation from window");
102 tabP.visible = false;
103 tabP2.visible = false;
110 <body xmlns=
"http://www.w3.org/1999/xhtml">
112 <div id=
"content" style=
"display: none"></div>
113 <pre id=
"test"></pre>