accessible/tests/mochitest/elm/test_nsApplicationAcc.html

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/accessible/tests/mochitest/elm/test_nsApplicationAcc.html	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,75 @@
     1.4 +<html>
     1.5 +
     1.6 +<head>
     1.7 +  <title>application accessible name</title>
     1.8 +  <link rel="stylesheet" type="text/css" 
     1.9 +         href="chrome://mochikit/content/tests/SimpleTest/test.css" />
    1.10 +  <script type="application/javascript" 
    1.11 +          src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
    1.12 +
    1.13 +  <script type="application/javascript" 
    1.14 +          src="../common.js"></script>
    1.15 +  <script type="application/javascript" 
    1.16 +          src="../role.js"></script>
    1.17 +
    1.18 +  <script type="application/javascript">
    1.19 +    function doTest()
    1.20 +    {
    1.21 +      var accessible = getApplicationAccessible();
    1.22 +      if (!accessible) {
    1.23 +        SimpleTest.finish();
    1.24 +        return;
    1.25 +      }
    1.26 +
    1.27 +      var bundleServ =
    1.28 +        Components.classes["@mozilla.org/intl/stringbundle;1"].
    1.29 +        getService(Components.interfaces.nsIStringBundleService);
    1.30 +      var brandBundle =
    1.31 +        bundleServ.createBundle("chrome://branding/locale/brand.properties");
    1.32 +
    1.33 +      var appInfo = Components.classes["@mozilla.org/xre/app-info;1"].
    1.34 +        getService(Components.interfaces.nsIXULAppInfo);
    1.35 +
    1.36 +      // nsIAccessible::name
    1.37 +      var applicationName = "";
    1.38 +      if (LINUX || SOLARIS) {
    1.39 +        applicationName = appInfo.name;
    1.40 +      } else {
    1.41 +        try {
    1.42 +          applicationName = brandBundle.GetStringFromName("brandShortName");
    1.43 +        } catch(e) {
    1.44 +        }
    1.45 +
    1.46 +        if (applicationName == "")
    1.47 +          applicationName = "Gecko based application";
    1.48 +      }
    1.49 +      is (accessible.name, applicationName, "wrong application accessible name");
    1.50 +
    1.51 +      // nsIAccessibleApplication
    1.52 +      is(accessible.appName, appInfo.name, "Wrong application name");
    1.53 +      is(accessible.appVersion, appInfo.version, "Wrong application version");
    1.54 +      is(accessible.platformName, "Gecko", "Wrong platform name");
    1.55 +      is(accessible.platformVersion, appInfo.platformVersion,
    1.56 +         "Wrong platform version");
    1.57 +
    1.58 +      SimpleTest.finish();
    1.59 +    }
    1.60 +
    1.61 +    SimpleTest.waitForExplicitFinish();
    1.62 +    addA11yLoadEvent(doTest);
    1.63 +  </script>
    1.64 +  </head>
    1.65 +  <body>
    1.66 +  <a target="_blank"
    1.67 +     href="https://bugzilla.mozilla.org/show_bug.cgi?id=456121"
    1.68 +    title="nsApplicationAccessible::GetName does not return a default value when brand.properties does not exist">
    1.69 +    Mozilla Bug 454211
    1.70 +  </a>
    1.71 +
    1.72 +  <p id="display"></p>
    1.73 +  <div id="content" style="display: none"></div>
    1.74 +  <pre id="test">
    1.75 +  </pre>
    1.76 +
    1.77 +  </body>
    1.78 +</html>

mercurial