accessible/tests/mochitest/actions/test_media.html

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/accessible/tests/mochitest/actions/test_media.html	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,121 @@
     1.4 +<!DOCTYPE html>
     1.5 +<html>
     1.6 +<!--
     1.7 +https://bugzilla.mozilla.org/show_bug.cgi?id=483573
     1.8 +-->
     1.9 +<head>
    1.10 +  <title>HTML5 audio/video tests</title>
    1.11 +  <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css" />
    1.12 +
    1.13 +  <script type="application/javascript"
    1.14 +          src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
    1.15 +
    1.16 +  <script type="application/javascript"
    1.17 +          src="../common.js"></script>
    1.18 +  <script type="application/javascript"
    1.19 +          src="../events.js"></script>
    1.20 +  <script type="application/javascript"
    1.21 +          src="../actions.js"></script>
    1.22 +  <script type="application/javascript"
    1.23 +          src="../role.js"></script>
    1.24 +  <script type="application/javascript"
    1.25 +          src="../states.js"></script>
    1.26 +
    1.27 +  <script type="application/javascript">
    1.28 +
    1.29 +    // gA11yEventDumpID = "eventDump";
    1.30 +    //gA11yEventDumpToConsole = true; // debug stuff
    1.31 +
    1.32 +    function focusChecker(aAcc)
    1.33 +    {
    1.34 +      this.type = EVENT_FOCUS;
    1.35 +      this.target = aAcc;
    1.36 +      this.getID = function focusChecker_getID()
    1.37 +      {
    1.38 +        return "focus handling";
    1.39 +      }
    1.40 +      this.check = function focusChecker_check(aEvent)
    1.41 +      {
    1.42 +        testStates(this.target, STATE_FOCUSED);
    1.43 +      }
    1.44 +    }
    1.45 +
    1.46 +    function nameChecker(aAcc, aName)
    1.47 +    {
    1.48 +      this.type = EVENT_NAME_CHANGE;
    1.49 +      this.target = aAcc;
    1.50 +      this.getID = function nameChecker_getID()
    1.51 +      {
    1.52 +        return "name change handling";
    1.53 +      },
    1.54 +      this.check = function nameChecker_check(aEvent)
    1.55 +      {
    1.56 +        is(aEvent.accessible.name, aName,
    1.57 +           "Wrong name of " + prettyName(aEvent.accessible) + " on focus");
    1.58 +      }
    1.59 +    }
    1.60 +
    1.61 +    function doTest()
    1.62 +    {
    1.63 +      //////////////////////////////////////////////////////////////////////////
    1.64 +      // test actions of audio controls
    1.65 +
    1.66 +      todo(false, "Focus test are disabled until bug 494175 is fixed.");
    1.67 +
    1.68 +      var audioElm = getAccessible("audio");
    1.69 +      var playBtn = audioElm.firstChild;
    1.70 +      var scrubber = playBtn.nextSibling.nextSibling.nextSibling;
    1.71 +      var muteBtn = audioElm.lastChild.previousSibling;
    1.72 +
    1.73 +      var actions = [
    1.74 +        {
    1.75 +          ID: muteBtn,
    1.76 +          actionName: "press",
    1.77 +          events: CLICK_EVENTS,
    1.78 +          eventSeq: [
    1.79 +     //       new focusChecker(muteBtn),
    1.80 +            new nameChecker(muteBtn, "Unmute"),
    1.81 +          ]
    1.82 +        },
    1.83 +     //   {
    1.84 +     //     ID: scrubber,
    1.85 +     //     actionName: "activate",
    1.86 +     //     events: null,
    1.87 +     //     eventSeq: [
    1.88 +     //       new focusChecker(scrubber)
    1.89 +     //     ]
    1.90 +     //   },
    1.91 +        {
    1.92 +          ID: playBtn,
    1.93 +          actionName: "press",
    1.94 +          events: CLICK_EVENTS,
    1.95 +          eventSeq: [
    1.96 +     //       new focusChecker(playBtn),
    1.97 +            new nameChecker(playBtn, "Pause"),
    1.98 +          ]
    1.99 +        }
   1.100 +      ];
   1.101 +
   1.102 +      testActions(actions); // Will call SimpleTest.finish();
   1.103 +    }
   1.104 +
   1.105 +    SimpleTest.waitForExplicitFinish();
   1.106 +    addA11yLoadEvent(doTest);
   1.107 +  </script>
   1.108 +</head>
   1.109 +<body>
   1.110 +
   1.111 +  <a target="_blank"
   1.112 +     title="Expose HTML5 video and audio elements' embedded controls through accessibility APIs"
   1.113 +     href="https://bugzilla.mozilla.org/show_bug.cgi?id=483573">Mozilla Bug 483573</a>
   1.114 +  <p id="display"></p>
   1.115 +  <div id="content" style="display: none"></div>
   1.116 +  <pre id="test">
   1.117 +  </pre>
   1.118 +
   1.119 +  <audio id="audio" src="../bug461281.ogg"
   1.120 +         controls="true"></audio>
   1.121 +
   1.122 +  <div id="eventDump"></div>
   1.123 +</body>
   1.124 +</html>

mercurial