accessible/tests/mochitest/actions/test_tree.xul

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 <?xml version="1.0"?>
michael@0 2 <?xml-stylesheet href="chrome://global/skin" type="text/css"?>
michael@0 3 <?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css"
michael@0 4 type="text/css"?>
michael@0 5
michael@0 6 <window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
michael@0 7 title="Accessible XUL tree actions tests">
michael@0 8
michael@0 9 <script type="application/javascript"
michael@0 10 src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" />
michael@0 11
michael@0 12 <script type="application/javascript"
michael@0 13 src="../treeview.js" />
michael@0 14
michael@0 15 <script type="application/javascript"
michael@0 16 src="../common.js" />
michael@0 17 <script type="application/javascript"
michael@0 18 src="../role.js" />
michael@0 19 <script type="application/javascript"
michael@0 20 src="../states.js" />
michael@0 21 <script type="application/javascript"
michael@0 22 src="../events.js" />
michael@0 23 <script type="application/javascript"
michael@0 24 src="../actions.js" />
michael@0 25
michael@0 26 <script type="application/javascript">
michael@0 27 <![CDATA[
michael@0 28 ////////////////////////////////////////////////////////////////////////////
michael@0 29 // Accessible tree testers
michael@0 30
michael@0 31 function stateFocusChecker(aAcc, aStates)
michael@0 32 {
michael@0 33 this.__proto__ = new focusChecker(aAcc);
michael@0 34
michael@0 35 this.check = function focusChecker_check(aEvent)
michael@0 36 {
michael@0 37 var states = aStates ? aStates : 0;
michael@0 38 testStates(this.target, STATE_FOCUSED | STATE_SELECTED | states);
michael@0 39 }
michael@0 40 }
michael@0 41
michael@0 42 ////////////////////////////////////////////////////////////////////////////
michael@0 43 // Test
michael@0 44
michael@0 45 // gA11yEventDumpID = "debug";
michael@0 46 //gA11yEventDumpToConsole = true; // debug
michael@0 47
michael@0 48 function doTest()
michael@0 49 {
michael@0 50 var treeNode = getNode("tree");
michael@0 51
michael@0 52 var treeBodyNode = treeNode.boxObject.treeBody;
michael@0 53
michael@0 54 var tree = getAccessible(treeNode);
michael@0 55 var expandedTreeItem = tree.getChildAt(2);
michael@0 56 var collapsedTreeItem = tree.getChildAt(5);
michael@0 57
michael@0 58 var actions = [
michael@0 59 {
michael@0 60 ID: expandedTreeItem,
michael@0 61 actionName: "activate",
michael@0 62 actionIndex: 0,
michael@0 63 events: CLICK_EVENTS,
michael@0 64 targetID: treeBodyNode,
michael@0 65 eventSeq: [
michael@0 66 new stateFocusChecker(expandedTreeItem, STATE_EXPANDED)
michael@0 67 ]
michael@0 68 },
michael@0 69 {
michael@0 70 ID: collapsedTreeItem,
michael@0 71 actionName: "expand",
michael@0 72 actionIndex: 1,
michael@0 73 events: CLICK_EVENTS,
michael@0 74 targetID: treeBodyNode,
michael@0 75 checkOnClickEvent: function check(aEvent)
michael@0 76 {
michael@0 77 testStates(this.ID, STATE_EXPANDED);
michael@0 78 }
michael@0 79 },
michael@0 80 {
michael@0 81 ID: collapsedTreeItem,
michael@0 82 actionName: "collapse",
michael@0 83 actionIndex: 1,
michael@0 84 events: CLICK_EVENTS,
michael@0 85 targetID: treeBodyNode,
michael@0 86 checkOnClickEvent: function check(aEvent)
michael@0 87 {
michael@0 88 testStates(this.ID, STATE_COLLAPSED);
michael@0 89 }
michael@0 90 }
michael@0 91 ];
michael@0 92
michael@0 93 testActions(actions); // Will call SimpleTest.finish();
michael@0 94 }
michael@0 95
michael@0 96 SimpleTest.waitForExplicitFinish();
michael@0 97 addA11yXULTreeLoadEvent(doTest, "tree", new nsTreeTreeView());
michael@0 98 ]]>
michael@0 99 </script>
michael@0 100
michael@0 101 <hbox flex="1" style="overflow: auto;">
michael@0 102 <body xmlns="http://www.w3.org/1999/xhtml">
michael@0 103 <a target="_blank"
michael@0 104 href="https://bugzilla.mozilla.org/show_bug.cgi?id=503727"
michael@0 105 title="Reorganize implementation of XUL tree accessibility">
michael@0 106 Mozilla Bug 503727
michael@0 107 </a><br/>
michael@0 108 <p id="display"></p>
michael@0 109 <div id="content" style="display: none">
michael@0 110 </div>
michael@0 111 <pre id="test">
michael@0 112 </pre>
michael@0 113 </body>
michael@0 114
michael@0 115 <vbox flex="1">
michael@0 116 <tree id="tree" flex="1" minheight="100px">
michael@0 117 <treecols>
michael@0 118 <treecol id="col" flex="1" primary="true" label="column"/>
michael@0 119 </treecols>
michael@0 120 <treechildren/>
michael@0 121 </tree>
michael@0 122
michael@0 123 <vbox id="debug"/>
michael@0 124 </vbox>
michael@0 125 </hbox>
michael@0 126
michael@0 127 </window>
michael@0 128

mercurial