Bug 544170 - [SeaMonkey 2.1] mochitest-a11y: tree/test_tabbrowser.xul fails, due to "tabbrowser API" dependencies and different application UIs; (Bv1a) Add support for SeaMonkey tabbrowser UI, Extend existing checks (for Firefox tabbrowser UI), Call removeProgressListener().
authorSerge Gautherie <sgautherie.bz@free.fr>
Mon, 21 Mar 2011 14:37:57 +0100
changeset 63447 f2a9a79139fc4d21aab498b3c80443cbb1851d6a
parent 63446 8618a149ea2e673f6c0af23ee1f6183e39f0a6ef
child 63448 ddd48e3b173ae11bdf714b987b78ff789704b892
push id19229
push usersgautherie.bz@free.fr
push dateMon, 21 Mar 2011 13:44:27 +0000
treeherdermozilla-central@ddd48e3b173a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs544170
milestone2.0b13pre
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 544170 - [SeaMonkey 2.1] mochitest-a11y: tree/test_tabbrowser.xul fails, due to "tabbrowser API" dependencies and different application UIs; (Bv1a) Add support for SeaMonkey tabbrowser UI, Extend existing checks (for Firefox tabbrowser UI), Call removeProgressListener(). f=neil r=surkov.alexander (a=test-only).
accessible/tests/mochitest/tree/test_tabbrowser.xul
--- a/accessible/tests/mochitest/tree/test_tabbrowser.xul
+++ b/accessible/tests/mochitest/tree/test_tabbrowser.xul
@@ -9,17 +9,17 @@
                  type="text/css"?>
 
 <?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css"
                  type="text/css"?>
 
 <window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
         title="Accessible XUL tabbrowser hierarchy tests">
 
-  <script type="application/javascript" 
+  <script type="application/javascript"
           src="chrome://mochikit/content/MochiKit/packed.js" />
   <script type="application/javascript"
           src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" />
 
   <script type="application/javascript"
           src="../common.js" />
   <script type="application/javascript"
           src="../role.js" />
@@ -31,87 +31,185 @@
 
     const Ci = Components.interfaces;
 
     // Hack to make xul:tabbrowser work.
     Components.utils.import("resource://gre/modules/Services.jsm");
     var handleDroppedLink = null;
     var XULBrowserWindow = {
       isBusy: false,
-      setOverLink: function (link, b) {
-      }
+      setOverLink: function (link, b) {}
     };
     var gFindBar = {
       hidden: true
     };
 
     function doTest()
     {
       var tabBrowser = document.getElementById("tabbrowser");
 
       var progressListener =
       {
         onStateChange: function onStateChange(aWebProgress,
                                               aRequest,
                                               aStateFlags,
                                               aStatus)
-       {
-        if (aStateFlags & Ci.nsIWebProgressListener.STATE_STOP)
-          testAccTree();
-       }
+        {
+          if (aStateFlags & Ci.nsIWebProgressListener.STATE_STOP) {
+            tabBrowser.removeProgressListener(progressListener);
+
+            testAccTree();
+          }
+        }
       };
-
       tabBrowser.addProgressListener(progressListener,
                                      Ci.nsIWebProgress.NOTIFY_STATE_WINDOW);
 
+      // Test XUL and HTML documents.
       tabBrowser.loadTabs(["about:", "about:mozilla"], false, true);
     }
 
     function testAccTree()
     {
+      var tabBrowser = document.getElementById("tabbrowser");
+
+      //////////
+      // Tab bar
+      //////////
       var tabsAccTree = {
+        // xul:tabs
         role: ROLE_PAGETABLIST,
         children: [
+          // Children depend on application (UI): see below.
+        ]
+      };
+
+      // SeaMonkey and Firefox tabbrowser UIs differ.
+      if ("restoreTab" in tabBrowser) {
+        SimpleTest.ok(true, "Testing SeaMonkey tabbrowser UI.");
+
+        tabsAccTree.children.splice(0, 0,
           {
+            // xul:toolbarbutton ("Open a new tab")
+            role: ROLE_PUSHBUTTON,
+            children: []
+          },
+          {
+            // xul:tab ("about:")
             role: ROLE_PAGETAB,
+            children: []
+          },
+          {
+            // tab ("about:mozilla")
+            role: ROLE_PAGETAB,
+            children: []
+          },
+          {
+            // xul:toolbarbutton ("List all tabs")
+            role: ROLE_PUSHBUTTON,
             children: [
               {
-                role: ROLE_PUSHBUTTON
+                // xul:menupopup
+                role: ROLE_MENUPOPUP,
+                children: []
               }
             ]
           },
           {
+            // xul:toolbarbutton ("Close current tab")
+            role: ROLE_PUSHBUTTON,
+            children: []
+          }
+          );
+      } else {
+        SimpleTest.ok(true, "Testing Firefox tabbrowser UI.");
+
+        // NB: The (3) buttons are not visible, unless manually hovered,
+        //     probably due to size reduction in this test.
+        tabsAccTree.children.splice(0, 0,
+          {
+            // xul:tab ("about:")
             role: ROLE_PAGETAB,
             children: [
               {
-                role: ROLE_PUSHBUTTON
+                // xul:toolbarbutton ("Close Tab")
+                role: ROLE_PUSHBUTTON,
+                children: []
               }
             ]
           },
           {
-            role: ROLE_PUSHBUTTON
+            // tab ("about:mozilla")
+            role: ROLE_PAGETAB,
+            children: [
+              {
+                // xul:toolbarbutton ("Close Tab")
+                role: ROLE_PUSHBUTTON,
+                children: []
+              }
+            ]
+          },
+          {
+            // xul:toolbarbutton ("Open a new tab")
+            role: ROLE_PUSHBUTTON,
+            children: []
           }
-        ]
-      };
-      testAccessibleTree(getNode("tabbrowser").tabContainer, tabsAccTree);
+          // "List all tabs" dropdown
+          // XXX: This child(?) is not present in this test.
+          //      I'm not sure why (though probably expected).
+          );
+      }
 
+      testAccessibleTree(tabBrowser.tabContainer, tabsAccTree);
+
+      //////////
+      // Tab contents
+      //////////
       var tabboxAccTree = {
+        // xul:tabpanels
         role: ROLE_PANE,
         children: [
           {
-            role: ROLE_PROPERTYPAGE
+            // xul:notificationbox
+            role: ROLE_PROPERTYPAGE,
+            children: [
+              {
+                // xul:browser
+                role: ROLE_INTERNAL_FRAME,
+                children: [
+                  {
+                    // #document ("about:")
+                    role: ROLE_DOCUMENT
+                    // children: [ ... ] // Ignore document content.
+                  }
+                ]
+              }
+            ]
           },
           {
-            role: ROLE_PROPERTYPAGE
+            // notificationbox
+            role: ROLE_PROPERTYPAGE,
+            children: [
+              {
+                // browser
+                role: ROLE_INTERNAL_FRAME,
+                children: [
+                  {
+                    // #document ("about:mozilla")
+                    role: ROLE_DOCUMENT
+                    // children: [ ... ] // Ignore document content.
+                  }
+                ]
+              }
+            ]
           }
         ]
       };
 
-      testAccessibleTree(getNode("tabbrowser").mTabBox.tabpanels,
-                         tabboxAccTree);
+      testAccessibleTree(tabBrowser.mTabBox.tabpanels, tabboxAccTree);
 
       SimpleTest.finish()
     }
 
     SimpleTest.waitForExplicitFinish();
     addA11yLoadEvent(doTest);
   ]]>
   </script>
@@ -153,9 +251,8 @@
     <tabbrowser id="tabbrowser"
                 type="content-primary"
                 tabcontainer="tabbrowser-tabs"
                 flex="1"/>
     <toolbar id="addon-bar"/>
   </vbox>
 
 </window>
-