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 <?xml-stylesheet href="chrome://global/skin" type="text/css"?>
3 <?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css"
4 type="text/css"?>
5 <window title="Cursor snapping test"
6 xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
8 <script type="application/javascript"
9 src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" />
10 <script type="application/javascript"
11 src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js" />
13 <body xmlns="http://www.w3.org/1999/xhtml">
14 <div id="content" style="display: none">
16 </div>
17 <pre id="test">
18 </pre>
19 </body>
21 <script class="testbody" type="application/javascript">
22 <![CDATA[
24 SimpleTest.waitForExplicitFinish();
26 const kMaxRetryCount = 4;
27 const kTimeoutTime = [
28 100, 100, 1000, 1000, 5000
29 ];
31 var gRetryCount;
33 var gTestingCount = 0;
34 var gTestingIndex = -1;
35 var gDisable = false;
36 var gHidden = false;
38 function canRetryTest()
39 {
40 return gRetryCount <= kMaxRetryCount;
41 }
43 function getTimeoutTime()
44 {
45 return kTimeoutTime[gRetryCount];
46 }
48 function runNextTest()
49 {
50 gRetryCount = 0;
51 gTestingIndex++;
52 runCurrentTest();
53 }
55 function retryCurrentTest()
56 {
57 ok(canRetryTest(), "retry the current test...");
58 gRetryCount++;
59 runCurrentTest();
60 }
62 function runCurrentTest()
63 {
64 var position = "top=" + gTestingCount + ",left=" + gTestingCount + ",";
65 gTestingCount++;
66 switch (gTestingIndex) {
67 case 0:
68 gDisable = false;
69 gHidden = false;
70 window.open("window_cursorsnap_dialog.xul", "_blank",
71 position + "chrome,width=100,height=100");
72 break;
73 case 1:
74 gDisable = true;
75 gHidden = false;
76 window.open("window_cursorsnap_dialog.xul", "_blank",
77 position + "chrome,width=100,height=100");
78 break;
79 case 2:
80 gDisable = false;
81 gHidden = true;
82 window.open("window_cursorsnap_dialog.xul", "_blank",
83 position + "chrome,width=100,height=100");
84 break;
85 case 3:
86 gDisable = false;
87 gHidden = false;
88 window.open("window_cursorsnap_wizard.xul", "_blank",
89 position + "chrome,width=100,height=100");
90 break;
91 case 4:
92 gDisable = true;
93 gHidden = false;
94 window.open("window_cursorsnap_wizard.xul", "_blank",
95 position + "chrome,width=100,height=100");
96 break;
97 case 5:
98 gDisable = false;
99 gHidden = true;
100 window.open("window_cursorsnap_wizard.xul", "_blank",
101 position + "chrome,width=100,height=100");
102 break;
103 default:
104 SetPrefs(false);
105 SimpleTest.finish();
106 return;
107 }
108 }
110 function SetPrefs(aSet)
111 {
112 var prefSvc = Components.classes["@mozilla.org/preferences-service;1"].
113 getService(Components.interfaces.nsIPrefBranch);
114 const kPrefName = "ui.cursor_snapping.always_enabled";
115 if (aSet) {
116 prefSvc.setBoolPref(kPrefName, true);
117 } else if (prefSvc.prefHasUserValue(kPrefName)) {
118 prefSvc.clearUserPref(kPrefName);
119 }
120 }
122 SetPrefs(true);
123 runNextTest();
125 ]]>
126 </script>
127 </window>