accessible/tests/mochitest/name/test_browserui.xul

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/accessible/tests/mochitest/name/test_browserui.xul	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,107 @@
     1.4 +<?xml version="1.0"?>
     1.5 +<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
     1.6 +<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css"
     1.7 +                 type="text/css"?>
     1.8 +
     1.9 +<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
    1.10 +        title="Accessibility Name Calculating Test.">
    1.11 +
    1.12 +  <script type="application/javascript"
    1.13 +          src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" />
    1.14 +  <script type="application/javascript"
    1.15 +          src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script>
    1.16 +
    1.17 +  <script type="application/javascript"
    1.18 +          src="../common.js"></script>
    1.19 +  <script type="application/javascript"
    1.20 +          src="../role.js"></script>
    1.21 +  <script type="application/javascript"
    1.22 +          src="../states.js"></script>
    1.23 +  <script type="application/javascript"
    1.24 +          src="../events.js"></script>
    1.25 +  <script type="application/javascript"
    1.26 +          src="../browser.js"></script>
    1.27 +
    1.28 +  <script type="application/javascript">
    1.29 +  <![CDATA[
    1.30 +    function addTab(aURL)
    1.31 +    {
    1.32 +      this.eventSeq = [
    1.33 +        new invokerChecker(EVENT_DOCUMENT_LOAD_COMPLETE, tabDocumentAt, 1)
    1.34 +      ];
    1.35 +
    1.36 +      this.invoke = function addTab_invoke()
    1.37 +      {
    1.38 +        tabBrowser().addTab(aURL);
    1.39 +      }
    1.40 +
    1.41 +      this.getID = function addTab_getID()
    1.42 +      {
    1.43 +        return "add tab: " + aURL;
    1.44 +      }
    1.45 +    }
    1.46 +
    1.47 +    function switchTab(aTabBrowser, aWindow)
    1.48 +    {
    1.49 +      this.invoke = function switchTab_invoke()
    1.50 +      {
    1.51 +        synthesizeKey("VK_TAB", { ctrlKey: true }, browserWindow());
    1.52 +      }
    1.53 +
    1.54 +      this.eventSeq = [
    1.55 +        new focusChecker(tabDocumentAt, 1)
    1.56 +      ];
    1.57 +
    1.58 +      this.check = function switchTab_check(aEvent)
    1.59 +      {
    1.60 +        var title = getAccessible(browserDocument()).name;
    1.61 +        isnot(title.indexOf(aEvent.accessible.name), -1,
    1.62 +              "Window title contains the name of active tab document" +
    1.63 +              " (Is '" + aEvent.accessible.name + "' in '" + title + "'?)");
    1.64 +      }
    1.65 +
    1.66 +      this.getID = function switchTab_getID() { return "switch tab"; }
    1.67 +    }
    1.68 +
    1.69 +    ////////////////////////////////////////////////////////////////////////////
    1.70 +    // Tests
    1.71 +
    1.72 +    //gA11yEventDumpID = "eventdump"; // debug stuff
    1.73 +    //gA11yEventDumpToConsole = true; // debug
    1.74 +
    1.75 +    var gQueue = null;
    1.76 +    function doTests()
    1.77 +    {
    1.78 +      gQueue = new eventQueue();
    1.79 +      gQueue.push(new addTab("about:mozilla"));
    1.80 +      gQueue.push(new switchTab());
    1.81 +      gQueue.onFinish = function()
    1.82 +      {
    1.83 +        closeBrowserWindow();
    1.84 +      }
    1.85 +
    1.86 +      gQueue.invoke();
    1.87 +    }
    1.88 +
    1.89 +    SimpleTest.waitForExplicitFinish();
    1.90 +    openBrowserWindow(doTests, "about:");
    1.91 +  ]]>
    1.92 +  </script>
    1.93 +
    1.94 +  <vbox flex="1" style="overflow: auto;">
    1.95 +  <body xmlns="http://www.w3.org/1999/xhtml">
    1.96 +    <a target="_blank"
    1.97 +       href="https://bugzilla.mozilla.org/show_bug.cgi?id=507382"
    1.98 +       title="focus is fired earlier than root accessible name is changed when switching between tabs">
    1.99 +      Mozilla Bug 
   1.100 +    </a>
   1.101 +    <p id="display"></p>
   1.102 +    <div id="content" style="display: none">
   1.103 +    </div>
   1.104 +    <pre id="test">
   1.105 +    </pre>
   1.106 +  </body>
   1.107 +
   1.108 +  <vbox id="eventdump"></vbox>
   1.109 +  </vbox>
   1.110 +</window>

mercurial