accessible/tests/mochitest/tree/test_tabbrowser.xul

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

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

mercurial