1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/accessible/tests/mochitest/tree/test_tabbrowser.xul Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,226 @@ 1.4 +<?xml version="1.0"?> 1.5 +<?xml-stylesheet href="chrome://global/skin" type="text/css"?> 1.6 + 1.7 +<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" 1.8 + type="text/css"?> 1.9 + 1.10 +<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" 1.11 + title="Accessible XUL tabbrowser hierarchy tests"> 1.12 + 1.13 + <script type="application/javascript" 1.14 + src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" /> 1.15 + <script type="application/javascript" 1.16 + src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script> 1.17 + 1.18 + <script type="application/javascript" 1.19 + src="../common.js" /> 1.20 + <script type="application/javascript" 1.21 + src="../role.js" /> 1.22 + <script type="application/javascript" 1.23 + src="../events.js" /> 1.24 + <script type="application/javascript" 1.25 + src="../browser.js"></script> 1.26 + 1.27 + <script type="application/javascript"> 1.28 + <![CDATA[ 1.29 + //////////////////////////////////////////////////////////////////////////// 1.30 + // invoker 1.31 + function testTabHierarchy() 1.32 + { 1.33 + this.eventSeq = [ 1.34 + new asyncInvokerChecker(EVENT_DOCUMENT_LOAD_COMPLETE, tabDocumentAt, 0), 1.35 + new asyncInvokerChecker(EVENT_DOCUMENT_LOAD_COMPLETE, tabDocumentAt, 1) 1.36 + ]; 1.37 + 1.38 + this.invoke = function testTabHierarchy_invoke() 1.39 + { 1.40 + var docURIs = ["about:", "about:mozilla"]; 1.41 + tabBrowser().loadTabs(docURIs, false, true); 1.42 + } 1.43 + 1.44 + this.finalCheck = function testTabHierarchy_finalCheck(aEvent) 1.45 + { 1.46 + //////////////////// 1.47 + // Tab bar 1.48 + //////////////////// 1.49 + var tabsAccTree = { 1.50 + // xul:tabs 1.51 + role: ROLE_PAGETABLIST, 1.52 + children: [ 1.53 + // Children depend on application (UI): see below. 1.54 + ] 1.55 + }; 1.56 + 1.57 + // SeaMonkey and Firefox tabbrowser UIs differ. 1.58 + if (SEAMONKEY) { 1.59 + SimpleTest.ok(true, "Testing SeaMonkey tabbrowser UI."); 1.60 + 1.61 + tabsAccTree.children.splice(0, 0, 1.62 + { 1.63 + // xul:toolbarbutton ("Open a new tab") 1.64 + role: ROLE_PUSHBUTTON, 1.65 + children: [] 1.66 + }, 1.67 + { 1.68 + // xul:tab ("about:") 1.69 + role: ROLE_PAGETAB, 1.70 + children: [] 1.71 + }, 1.72 + { 1.73 + // tab ("about:mozilla") 1.74 + role: ROLE_PAGETAB, 1.75 + children: [] 1.76 + }, 1.77 + { 1.78 + // xul:toolbarbutton ("List all tabs") 1.79 + role: ROLE_PUSHBUTTON, 1.80 + children: [ 1.81 + { 1.82 + // xul:menupopup 1.83 + role: ROLE_MENUPOPUP, 1.84 + children: [] 1.85 + } 1.86 + ] 1.87 + }, 1.88 + { 1.89 + // xul:toolbarbutton ("Close current tab") 1.90 + role: ROLE_PUSHBUTTON, 1.91 + children: [] 1.92 + } 1.93 + ); 1.94 + } else { 1.95 + SimpleTest.ok(true, "Testing Firefox tabbrowser UI."); 1.96 + 1.97 + // NB: The (3) buttons are not visible, unless manually hovered, 1.98 + // probably due to size reduction in this test. 1.99 + tabsAccTree.children.splice(0, 0, 1.100 + { 1.101 + // xul:tab ("about:") 1.102 + role: ROLE_PAGETAB, 1.103 + children: [ 1.104 + { 1.105 + // xul:toolbarbutton ("Close Tab") 1.106 + role: ROLE_PUSHBUTTON, 1.107 + children: [] 1.108 + } 1.109 + ] 1.110 + }, 1.111 + { 1.112 + // tab ("about:mozilla") 1.113 + role: ROLE_PAGETAB, 1.114 + children: [ 1.115 + { 1.116 + // xul:toolbarbutton ("Close Tab") 1.117 + role: ROLE_PUSHBUTTON, 1.118 + children: [] 1.119 + } 1.120 + ] 1.121 + }, 1.122 + { 1.123 + // xul:toolbarbutton ("Open a new tab") 1.124 + role: ROLE_PUSHBUTTON, 1.125 + children: [] 1.126 + } 1.127 + // "List all tabs" dropdown 1.128 + // XXX: This child(?) is not present in this test. 1.129 + // I'm not sure why (though probably expected). 1.130 + ); 1.131 + } 1.132 + 1.133 + testAccessibleTree(tabBrowser().tabContainer, tabsAccTree); 1.134 + 1.135 + //////////////////// 1.136 + // Tab contents 1.137 + //////////////////// 1.138 + var tabboxAccTree = { 1.139 + // xul:tabpanels 1.140 + role: ROLE_PANE, 1.141 + children: [ 1.142 + { 1.143 + // xul:notificationbox 1.144 + role: ROLE_PROPERTYPAGE, 1.145 + children: [ 1.146 + { 1.147 + // xul:browser 1.148 + role: ROLE_INTERNAL_FRAME, 1.149 + children: [ 1.150 + { 1.151 + // #document ("about:") 1.152 + role: ROLE_DOCUMENT 1.153 + // children: [ ... ] // Ignore document content. 1.154 + } 1.155 + ] 1.156 + } 1.157 + ] 1.158 + }, 1.159 + { 1.160 + // notificationbox 1.161 + role: ROLE_PROPERTYPAGE, 1.162 + children: [ 1.163 + { 1.164 + // browser 1.165 + role: ROLE_INTERNAL_FRAME, 1.166 + children: [ 1.167 + { 1.168 + // #document ("about:mozilla") 1.169 + role: ROLE_DOCUMENT 1.170 + // children: [ ... ] // Ignore document content. 1.171 + } 1.172 + ] 1.173 + } 1.174 + ] 1.175 + } 1.176 + ] 1.177 + }; 1.178 + 1.179 + testAccessibleTree(tabBrowser().mTabBox.tabpanels, tabboxAccTree); 1.180 + } 1.181 + 1.182 + this.getID = function testTabHierarchy_getID() 1.183 + { 1.184 + return "hierarchy of tabs"; 1.185 + } 1.186 + } 1.187 + 1.188 + //////////////////////////////////////////////////////////////////////////// 1.189 + // Test 1.190 + var gQueue = null; 1.191 + function doTest() 1.192 + { 1.193 + // Load documents into tabs and wait for docLoadComplete events caused by these 1.194 + // documents load before we start the test. 1.195 + gQueue = new eventQueue(); 1.196 + 1.197 + gQueue.push(new testTabHierarchy()); 1.198 + gQueue.onFinish = function() { closeBrowserWindow(); } 1.199 + gQueue.invoke(); // Will call SimpleTest.finish(); 1.200 + } 1.201 + 1.202 + SimpleTest.waitForExplicitFinish(); 1.203 + openBrowserWindow(doTest); 1.204 + ]]> 1.205 + </script> 1.206 + 1.207 + <vbox flex="1" style="overflow: auto;"> 1.208 + <body xmlns="http://www.w3.org/1999/xhtml"> 1.209 + <a target="_blank" 1.210 + href="https://bugzilla.mozilla.org/show_bug.cgi?id=540389" 1.211 + title=" WARNING: Bad accessible tree!: [tabbrowser tab] "> 1.212 + Mozilla Bug 540389 1.213 + </a><br/> 1.214 + <a target="_blank" 1.215 + href="https://bugzilla.mozilla.org/show_bug.cgi?id=552944" 1.216 + title="No relationship between tabs and associated property page in new tabbrowser construct"> 1.217 + Mozilla Bug 552944 1.218 + </a><br/> 1.219 + <p id="display"></p> 1.220 + <div id="content" style="display: none"> 1.221 + </div> 1.222 + <pre id="test"> 1.223 + </pre> 1.224 + </body> 1.225 + 1.226 + <vbox id="eventdump"></vbox> 1.227 + </vbox> 1.228 + 1.229 +</window>