toolkit/content/tests/chrome/window_cursorsnap_wizard.xul

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

michael@0 1 <?xml version="1.0"?>
michael@0 2 <?xml-stylesheet href="chrome://global/skin" type="text/css"?>
michael@0 3 <wizard title="Cursor snapping test" id="wizard"
michael@0 4 width="600" height="600"
michael@0 5 onload="onload();"
michael@0 6 onunload="onunload();"
michael@0 7 buttons="accept,cancel"
michael@0 8 xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
michael@0 9
michael@0 10 <wizardpage>
michael@0 11 <label value="first page"/>
michael@0 12 </wizardpage>
michael@0 13
michael@0 14 <wizardpage>
michael@0 15 <label value="second page"/>
michael@0 16 </wizardpage>
michael@0 17
michael@0 18 <script class="testbody" type="application/javascript">
michael@0 19 <![CDATA[
michael@0 20
michael@0 21 function ok(aCondition, aMessage)
michael@0 22 {
michael@0 23 window.opener.wrappedJSObject.SimpleTest.ok(aCondition, aMessage);
michael@0 24 }
michael@0 25
michael@0 26 function is(aLeft, aRight, aMessage)
michael@0 27 {
michael@0 28 window.opener.wrappedJSObject.SimpleTest.is(aLeft, aRight, aMessage);
michael@0 29 }
michael@0 30
michael@0 31 function isnot(aLeft, aRight, aMessage)
michael@0 32 {
michael@0 33 window.opener.wrappedJSObject.SimpleTest.isnot(aLeft, aRight, aMessage);
michael@0 34 }
michael@0 35
michael@0 36 function canRetryTest()
michael@0 37 {
michael@0 38 return window.opener.wrappedJSObject.canRetryTest();
michael@0 39 }
michael@0 40
michael@0 41 function getTimeoutTime()
michael@0 42 {
michael@0 43 return window.opener.wrappedJSObject.getTimeoutTime();
michael@0 44 }
michael@0 45
michael@0 46 var gTimer;
michael@0 47 var gRetry = false;
michael@0 48
michael@0 49 function finishByTimeout()
michael@0 50 {
michael@0 51 var button = document.getElementById("wizard").getButton("next");
michael@0 52 if (button.disabled)
michael@0 53 ok(true, "cursor is NOT snapped to the disabled button (wizard)");
michael@0 54 else if (button.hidden)
michael@0 55 ok(true, "cursor is NOT snapped to the hidden button (wizard)");
michael@0 56 else {
michael@0 57 if (!canRetryTest()) {
michael@0 58 ok(false, "cursor is NOT snapped to the default button (wizard)");
michael@0 59 } else {
michael@0 60 // otherwise, this may be unexpected timeout, we should retry the test.
michael@0 61 gRetry = true;
michael@0 62 }
michael@0 63 }
michael@0 64 finish();
michael@0 65 }
michael@0 66
michael@0 67 function finish()
michael@0 68 {
michael@0 69 window.close();
michael@0 70 }
michael@0 71
michael@0 72 function onMouseMove()
michael@0 73 {
michael@0 74 var button = document.getElementById("wizard").getButton("next");
michael@0 75 if (button.disabled)
michael@0 76 ok(false, "cursor IS snapped to the disabled button (wizard)");
michael@0 77 else if (button.hidden)
michael@0 78 ok(false, "cursor IS snapped to the hidden button (wizard)");
michael@0 79 else
michael@0 80 ok(true, "cursor IS snapped to the default button (wizard)");
michael@0 81 clearTimeout(gTimer);
michael@0 82 finish();
michael@0 83 }
michael@0 84
michael@0 85 function onload()
michael@0 86 {
michael@0 87 var button = document.getElementById("wizard").getButton("next");
michael@0 88 button.addEventListener("mousemove", onMouseMove, false);
michael@0 89
michael@0 90 if (window.opener.wrappedJSObject.gDisable) {
michael@0 91 button.disabled = true;
michael@0 92 }
michael@0 93 if (window.opener.wrappedJSObject.gHidden) {
michael@0 94 button.hidden = true;
michael@0 95 }
michael@0 96 gTimer = setTimeout(finishByTimeout, getTimeoutTime());
michael@0 97 }
michael@0 98
michael@0 99 function onunload()
michael@0 100 {
michael@0 101 if (gRetry) {
michael@0 102 window.opener.wrappedJSObject.retryCurrentTest();
michael@0 103 } else {
michael@0 104 window.opener.wrappedJSObject.runNextTest();
michael@0 105 }
michael@0 106 }
michael@0 107
michael@0 108 ]]>
michael@0 109 </script>
michael@0 110
michael@0 111 </wizard>

mercurial