Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
1 <?xml version="1.0"?>
2 <!-- This Source Code Form is subject to the terms of the Mozilla Public
3 - License, v. 2.0. If a copy of the MPL was not distributed with this
4 - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
5 <!--
6 * Make sure the download manager can display downloads in the right order and
7 * contains the expected data. The list has one of each download state ordered
8 * by the start/end times.
9 -->
11 <window title="Download Manager Test"
12 xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
13 onload="test();">
15 <script type="application/javascript"
16 src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
17 <script type="application/javascript"
18 src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"/>
19 <script type="application/javascript"
20 src="utils.js"/>
22 <script type="application/javascript">
23 <![CDATA[
25 function test_meta_k(aWin)
26 {
27 let doc = aWin.document;
28 let searchbox = doc.getElementById("searchbox");
29 let richlistbox = doc.getElementById("downloadView");
31 // Enusre the serachbox is not focused
32 richlistbox.focus();
34 // Dispatch the right key combination
35 synthesizeKey("k", {accelKey: true}, aWin);
37 ok(searchbox.hasAttribute("focused"), "Searchbox is focused");
38 }
40 let testFuncs = [
41 test_meta_k,
42 ]
44 function test()
45 {
46 var dmui = getDMUI();
47 if (!dmui) {
48 todo(false, "skip test for toolkit download manager UI");
49 return;
50 }
52 let dm = Cc["@mozilla.org/download-manager;1"].
53 getService(Ci.nsIDownloadManager);
55 // See if the DM is already open, and if it is, close it!
56 let wm = Cc["@mozilla.org/appshell/window-mediator;1"].
57 getService(Ci.nsIWindowMediator);
58 let win = wm.getMostRecentWindow("Download:Manager");
59 if (win)
60 win.close();
62 let os = Cc["@mozilla.org/observer-service;1"].
63 getService(Ci.nsIObserverService);
64 const DLMGR_UI_DONE = "download-manager-ui-done";
66 let testObs = {
67 observe: function(aSubject, aTopic, aData)
68 {
69 if (aTopic != DLMGR_UI_DONE)
70 return;
72 SimpleTest.waitForFocus(function () { continueTest(aSubject) }, aSubject);
73 }
74 };
76 function continueTest(win) {
77 // Now we can run our tests
78 for each (let t in testFuncs)
79 t(win);
81 win.close();
82 os.removeObserver(testObs, DLMGR_UI_DONE);
83 SimpleTest.finish();
84 };
86 // Register with the observer service
87 os.addObserver(testObs, DLMGR_UI_DONE, false);
89 // Show the Download Manager UI
90 dmui.show();
92 SimpleTest.waitForExplicitFinish();
93 }
95 ]]>
96 </script>
98 <body xmlns="http://www.w3.org/1999/xhtml">
99 <p id="display"></p>
100 <div id="content" style="display:none;"></div>
101 <pre id="test"></pre>
102 </body>
103 </window>