accessible/tests/mochitest/tree/test_tabbrowser.xul

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 <?xml version="1.0"?>
michael@0 2 <?xml-stylesheet href="chrome://global/skin" type="text/css"?>
michael@0 3
michael@0 4 <?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css"
michael@0 5 type="text/css"?>
michael@0 6
michael@0 7 <window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
michael@0 8 title="Accessible XUL tabbrowser hierarchy tests">
michael@0 9
michael@0 10 <script type="application/javascript"
michael@0 11 src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" />
michael@0 12 <script type="application/javascript"
michael@0 13 src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script>
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="../events.js" />
michael@0 21 <script type="application/javascript"
michael@0 22 src="../browser.js"></script>
michael@0 23
michael@0 24 <script type="application/javascript">
michael@0 25 <![CDATA[
michael@0 26 ////////////////////////////////////////////////////////////////////////////
michael@0 27 // invoker
michael@0 28 function testTabHierarchy()
michael@0 29 {
michael@0 30 this.eventSeq = [
michael@0 31 new asyncInvokerChecker(EVENT_DOCUMENT_LOAD_COMPLETE, tabDocumentAt, 0),
michael@0 32 new asyncInvokerChecker(EVENT_DOCUMENT_LOAD_COMPLETE, tabDocumentAt, 1)
michael@0 33 ];
michael@0 34
michael@0 35 this.invoke = function testTabHierarchy_invoke()
michael@0 36 {
michael@0 37 var docURIs = ["about:", "about:mozilla"];
michael@0 38 tabBrowser().loadTabs(docURIs, false, true);
michael@0 39 }
michael@0 40
michael@0 41 this.finalCheck = function testTabHierarchy_finalCheck(aEvent)
michael@0 42 {
michael@0 43 ////////////////////
michael@0 44 // Tab bar
michael@0 45 ////////////////////
michael@0 46 var tabsAccTree = {
michael@0 47 // xul:tabs
michael@0 48 role: ROLE_PAGETABLIST,
michael@0 49 children: [
michael@0 50 // Children depend on application (UI): see below.
michael@0 51 ]
michael@0 52 };
michael@0 53
michael@0 54 // SeaMonkey and Firefox tabbrowser UIs differ.
michael@0 55 if (SEAMONKEY) {
michael@0 56 SimpleTest.ok(true, "Testing SeaMonkey tabbrowser UI.");
michael@0 57
michael@0 58 tabsAccTree.children.splice(0, 0,
michael@0 59 {
michael@0 60 // xul:toolbarbutton ("Open a new tab")
michael@0 61 role: ROLE_PUSHBUTTON,
michael@0 62 children: []
michael@0 63 },
michael@0 64 {
michael@0 65 // xul:tab ("about:")
michael@0 66 role: ROLE_PAGETAB,
michael@0 67 children: []
michael@0 68 },
michael@0 69 {
michael@0 70 // tab ("about:mozilla")
michael@0 71 role: ROLE_PAGETAB,
michael@0 72 children: []
michael@0 73 },
michael@0 74 {
michael@0 75 // xul:toolbarbutton ("List all tabs")
michael@0 76 role: ROLE_PUSHBUTTON,
michael@0 77 children: [
michael@0 78 {
michael@0 79 // xul:menupopup
michael@0 80 role: ROLE_MENUPOPUP,
michael@0 81 children: []
michael@0 82 }
michael@0 83 ]
michael@0 84 },
michael@0 85 {
michael@0 86 // xul:toolbarbutton ("Close current tab")
michael@0 87 role: ROLE_PUSHBUTTON,
michael@0 88 children: []
michael@0 89 }
michael@0 90 );
michael@0 91 } else {
michael@0 92 SimpleTest.ok(true, "Testing Firefox tabbrowser UI.");
michael@0 93
michael@0 94 // NB: The (3) buttons are not visible, unless manually hovered,
michael@0 95 // probably due to size reduction in this test.
michael@0 96 tabsAccTree.children.splice(0, 0,
michael@0 97 {
michael@0 98 // xul:tab ("about:")
michael@0 99 role: ROLE_PAGETAB,
michael@0 100 children: [
michael@0 101 {
michael@0 102 // xul:toolbarbutton ("Close Tab")
michael@0 103 role: ROLE_PUSHBUTTON,
michael@0 104 children: []
michael@0 105 }
michael@0 106 ]
michael@0 107 },
michael@0 108 {
michael@0 109 // tab ("about:mozilla")
michael@0 110 role: ROLE_PAGETAB,
michael@0 111 children: [
michael@0 112 {
michael@0 113 // xul:toolbarbutton ("Close Tab")
michael@0 114 role: ROLE_PUSHBUTTON,
michael@0 115 children: []
michael@0 116 }
michael@0 117 ]
michael@0 118 },
michael@0 119 {
michael@0 120 // xul:toolbarbutton ("Open a new tab")
michael@0 121 role: ROLE_PUSHBUTTON,
michael@0 122 children: []
michael@0 123 }
michael@0 124 // "List all tabs" dropdown
michael@0 125 // XXX: This child(?) is not present in this test.
michael@0 126 // I'm not sure why (though probably expected).
michael@0 127 );
michael@0 128 }
michael@0 129
michael@0 130 testAccessibleTree(tabBrowser().tabContainer, tabsAccTree);
michael@0 131
michael@0 132 ////////////////////
michael@0 133 // Tab contents
michael@0 134 ////////////////////
michael@0 135 var tabboxAccTree = {
michael@0 136 // xul:tabpanels
michael@0 137 role: ROLE_PANE,
michael@0 138 children: [
michael@0 139 {
michael@0 140 // xul:notificationbox
michael@0 141 role: ROLE_PROPERTYPAGE,
michael@0 142 children: [
michael@0 143 {
michael@0 144 // xul:browser
michael@0 145 role: ROLE_INTERNAL_FRAME,
michael@0 146 children: [
michael@0 147 {
michael@0 148 // #document ("about:")
michael@0 149 role: ROLE_DOCUMENT
michael@0 150 // children: [ ... ] // Ignore document content.
michael@0 151 }
michael@0 152 ]
michael@0 153 }
michael@0 154 ]
michael@0 155 },
michael@0 156 {
michael@0 157 // notificationbox
michael@0 158 role: ROLE_PROPERTYPAGE,
michael@0 159 children: [
michael@0 160 {
michael@0 161 // browser
michael@0 162 role: ROLE_INTERNAL_FRAME,
michael@0 163 children: [
michael@0 164 {
michael@0 165 // #document ("about:mozilla")
michael@0 166 role: ROLE_DOCUMENT
michael@0 167 // children: [ ... ] // Ignore document content.
michael@0 168 }
michael@0 169 ]
michael@0 170 }
michael@0 171 ]
michael@0 172 }
michael@0 173 ]
michael@0 174 };
michael@0 175
michael@0 176 testAccessibleTree(tabBrowser().mTabBox.tabpanels, tabboxAccTree);
michael@0 177 }
michael@0 178
michael@0 179 this.getID = function testTabHierarchy_getID()
michael@0 180 {
michael@0 181 return "hierarchy of tabs";
michael@0 182 }
michael@0 183 }
michael@0 184
michael@0 185 ////////////////////////////////////////////////////////////////////////////
michael@0 186 // Test
michael@0 187 var gQueue = null;
michael@0 188 function doTest()
michael@0 189 {
michael@0 190 // Load documents into tabs and wait for docLoadComplete events caused by these
michael@0 191 // documents load before we start the test.
michael@0 192 gQueue = new eventQueue();
michael@0 193
michael@0 194 gQueue.push(new testTabHierarchy());
michael@0 195 gQueue.onFinish = function() { closeBrowserWindow(); }
michael@0 196 gQueue.invoke(); // Will call SimpleTest.finish();
michael@0 197 }
michael@0 198
michael@0 199 SimpleTest.waitForExplicitFinish();
michael@0 200 openBrowserWindow(doTest);
michael@0 201 ]]>
michael@0 202 </script>
michael@0 203
michael@0 204 <vbox flex="1" style="overflow: auto;">
michael@0 205 <body xmlns="http://www.w3.org/1999/xhtml">
michael@0 206 <a target="_blank"
michael@0 207 href="https://bugzilla.mozilla.org/show_bug.cgi?id=540389"
michael@0 208 title=" WARNING: Bad accessible tree!: [tabbrowser tab] ">
michael@0 209 Mozilla Bug 540389
michael@0 210 </a><br/>
michael@0 211 <a target="_blank"
michael@0 212 href="https://bugzilla.mozilla.org/show_bug.cgi?id=552944"
michael@0 213 title="No relationship between tabs and associated property page in new tabbrowser construct">
michael@0 214 Mozilla Bug 552944
michael@0 215 </a><br/>
michael@0 216 <p id="display"></p>
michael@0 217 <div id="content" style="display: none">
michael@0 218 </div>
michael@0 219 <pre id="test">
michael@0 220 </pre>
michael@0 221 </body>
michael@0 222
michael@0 223 <vbox id="eventdump"></vbox>
michael@0 224 </vbox>
michael@0 225
michael@0 226 </window>

mercurial