accessible/tests/mochitest/relations/test_embeds.xul

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/accessible/tests/mochitest/relations/test_embeds.xul	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,140 @@
     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="Embeds relation tests">
    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="../relations.js"></script>
    1.27 +  <script type="application/javascript"
    1.28 +          src="../browser.js"></script>
    1.29 +
    1.30 +  <script type="application/javascript">
    1.31 +  <![CDATA[
    1.32 +    ////////////////////////////////////////////////////////////////////////////
    1.33 +    // Invokers
    1.34 +
    1.35 +    function loadURI(aURI)
    1.36 +    {
    1.37 +      this.invoke = function loadURI_invoke()
    1.38 +      {
    1.39 +        tabBrowser().loadURI(aURI);
    1.40 +      }
    1.41 +
    1.42 +      this.eventSeq = [
    1.43 +        new invokerChecker(EVENT_REORDER, currentBrowser)
    1.44 +      ];
    1.45 +
    1.46 +      this.finalCheck = function loadURI_finalCheck()
    1.47 +      {
    1.48 +        testRelation(browserDocument(), RELATION_EMBEDS,
    1.49 +                     getAccessible(currentTabDocument()));
    1.50 +      }
    1.51 +
    1.52 +      this.getID = function loadURI_getID()
    1.53 +      {
    1.54 +        return "load uri " + aURI;
    1.55 +      }
    1.56 +    }
    1.57 +
    1.58 +    function browserReorderChecker()
    1.59 +    {
    1.60 +      this.type = EVENT_REORDER;
    1.61 +
    1.62 +      this.match = function browserReorderChecker_match(aEvent)
    1.63 +      {
    1.64 +        // Reorder event might be duped because of temporary document creation.
    1.65 +        if (aEvent.accessible == getAccessible(currentBrowser())) {
    1.66 +          this.cnt++;
    1.67 +          return this.cnt != 2;
    1.68 +        }
    1.69 +
    1.70 +        return false;
    1.71 +      }
    1.72 +
    1.73 +      this.cnt = 0;
    1.74 +    }
    1.75 +
    1.76 +    function loadOneTab(aURI)
    1.77 +    {
    1.78 +      this.invoke = function loadOneTab_invoke()
    1.79 +      {
    1.80 +        tabBrowser().loadOneTab(aURI, null, null, null, false);
    1.81 +      }
    1.82 +
    1.83 +      this.eventSeq = [
    1.84 +        new browserReorderChecker()
    1.85 +      ];
    1.86 +
    1.87 +      this.finalCheck = function loadURI_finalCheck()
    1.88 +      {
    1.89 +        testRelation(browserDocument(), RELATION_EMBEDS,
    1.90 +                     getAccessible(currentTabDocument()));
    1.91 +      }
    1.92 +
    1.93 +      this.getID = function loadOneTab_getID()
    1.94 +      {
    1.95 +        return "load uri '" + aURI + "' in new tab";
    1.96 +      }
    1.97 +    }
    1.98 +
    1.99 +    ////////////////////////////////////////////////////////////////////////////
   1.100 +    // Testing
   1.101 +
   1.102 +    gA11yEventDumpToConsole = true; // debug
   1.103 +
   1.104 +    var gQueue = null;
   1.105 +    function doTests()
   1.106 +    {
   1.107 +      testRelation(browserDocument(), RELATION_EMBEDS,
   1.108 +                   getAccessible(currentTabDocument()));
   1.109 +
   1.110 +      enableLogging("docload");
   1.111 +      gQueue = new eventQueue();
   1.112 +
   1.113 +      gQueue.push(new loadURI("about:about"));
   1.114 +      gQueue.push(new loadOneTab("about:mozilla"));
   1.115 +
   1.116 +      gQueue.onFinish = function()
   1.117 +      {
   1.118 +        disableLogging();
   1.119 +        closeBrowserWindow();
   1.120 +      }
   1.121 +      gQueue.invoke();
   1.122 +    }
   1.123 +
   1.124 +    SimpleTest.waitForExplicitFinish();
   1.125 +    openBrowserWindow(doTests, "about:");
   1.126 +  ]]>
   1.127 +  </script>
   1.128 +
   1.129 +  <vbox flex="1" style="overflow: auto;">
   1.130 +  <body xmlns="http://www.w3.org/1999/xhtml">
   1.131 +    <a target="_blank"
   1.132 +       href="https://bugzilla.mozilla.org/show_bug.cgi?id=707654"
   1.133 +       title="Embeds relation on root accessible can return not content document">
   1.134 +      Mozilla Bug 707654
   1.135 +    </a>
   1.136 +    <p id="display"></p>
   1.137 +    <div id="content" style="display: none">
   1.138 +    </div>
   1.139 +    <pre id="test">
   1.140 +    </pre>
   1.141 +  </body>
   1.142 +  </vbox>
   1.143 +</window>

mercurial