accessible/tests/mochitest/jsat/test_pointer_relay.html

Tue, 06 Jan 2015 21:39:09 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Tue, 06 Jan 2015 21:39:09 +0100
branch
TOR_BUG_9701
changeset 8
97036ab72558
permissions
-rw-r--r--

Conditionally force memory storage according to privacy.thirdparty.isolate;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.

michael@0 1 <html>
michael@0 2
michael@0 3 <head>
michael@0 4 <title>AccessFu tests for pointer relay.</title>
michael@0 5
michael@0 6 <link rel="stylesheet" type="text/css"
michael@0 7 href="chrome://mochikit/content/tests/SimpleTest/test.css" />
michael@0 8 <script type="application/javascript"
michael@0 9 src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
michael@0 10 <script type="application/javascript" src="../common.js"></script>
michael@0 11 <script type="application/javascript" src="../layout.js"></script>
michael@0 12 <script type="application/javascript" src="./jsatcommon.js"></script>
michael@0 13 <script type="application/javascript" src="./dom_helper.js"></script>
michael@0 14 <script type="application/javascript">
michael@0 15
michael@0 16 Components.utils.import(
michael@0 17 "resource://gre/modules/accessibility/PointerAdapter.jsm");
michael@0 18
michael@0 19 var tests = [
michael@0 20 {
michael@0 21 type: 'touchstart', target: [{base: 'button'}],
michael@0 22 expected: {type: 'pointerdown', length: 1}
michael@0 23 },
michael@0 24 {
michael@0 25 type: 'touchmove', target: [{base: 'button'}],
michael@0 26 expected: {type: 'pointermove', length: 1}
michael@0 27 },
michael@0 28 {
michael@0 29 type: 'touchend', target: [{base: 'button'}],
michael@0 30 expected: {type: 'pointerup'}
michael@0 31 },
michael@0 32 {
michael@0 33 type: 'touchstart', target: [{base: 'button'},
michael@0 34 {base: 'button', x: 0.5, y: 0.3}],
michael@0 35 expected: {type: 'pointerdown', length: 2}
michael@0 36 },
michael@0 37 {
michael@0 38 type: 'touchend', target: [{base: 'button'},
michael@0 39 {base: 'button', x: 0.5, y: 0.3}],
michael@0 40 expected: {type: 'pointerup'}
michael@0 41 },
michael@0 42 {
michael@0 43 type: 'touchstart', target: [{base: 'button'},
michael@0 44 {base: 'button', x: 0.5, y: 0.3},
michael@0 45 {base: 'button', x: 0.5, y: -0.3}],
michael@0 46 expected: {type: 'pointerdown', length: 3}
michael@0 47 },
michael@0 48 {
michael@0 49 type: 'touchend', target: [{base: 'button'},
michael@0 50 {base: 'button', x: 0.5, y: 0.3},
michael@0 51 {base: 'button', x: 0.5, y: -0.3}],
michael@0 52 expected: {type: 'pointerup'}
michael@0 53 }
michael@0 54 ];
michael@0 55
michael@0 56 function makeTestFromSpec(test) {
michael@0 57 return function runTest() {
michael@0 58 PointerRelay.start(function onPointerEvent(aDetail) {
michael@0 59 is(aDetail.type, test.expected.type,
michael@0 60 'mozAccessFuPointerEvent is correct.');
michael@0 61 if (test.expected.length) {
michael@0 62 is(aDetail.points.length, test.expected.length,
michael@0 63 'mozAccessFuPointerEvent points length is correct.');
michael@0 64 }
michael@0 65 PointerRelay.stop();
michael@0 66 AccessFuTest.nextTest();
michael@0 67 });
michael@0 68 eventMap[test.type](test.target, test.type);
michael@0 69 };
michael@0 70 }
michael@0 71
michael@0 72 function doTest() {
michael@0 73 tests.forEach(function addTest(test) {
michael@0 74 AccessFuTest.addFunc(makeTestFromSpec(test));
michael@0 75 });
michael@0 76 AccessFuTest.waitForExplicitFinish();
michael@0 77 AccessFuTest.runTests();
michael@0 78 }
michael@0 79
michael@0 80 SimpleTest.waitForExplicitFinish();
michael@0 81 addA11yLoadEvent(doTest);
michael@0 82 </script>
michael@0 83
michael@0 84 </head>
michael@0 85 <body id="root">
michael@0 86 <a target="_blank"
michael@0 87 href="https://bugzilla.mozilla.org/show_bug.cgi?id=976082"
michael@0 88 title="[AccessFu] Provide tests for pointer relay.">
michael@0 89 Mozilla Bug 981015
michael@0 90 </a>
michael@0 91 <div>
michael@0 92 <button id="button">I am a button</button>
michael@0 93 </div>
michael@0 94 </body>
michael@0 95 </html>

mercurial