dom/tests/mochitest/gamepad/test_gamepad.html

Tue, 06 Jan 2015 21:39:09 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Tue, 06 Jan 2015 21:39:09 +0100
branch
TOR_BUG_9701
changeset 8
97036ab72558
permissions
-rw-r--r--

Conditionally force memory storage according to privacy.thirdparty.isolate;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.

     1 <!-- Any copyright is dedicated to the Public Domain.
     2    - http://creativecommons.org/publicdomain/zero/1.0/ -->
     3 <!DOCTYPE HTML>
     4 <html>
     5 <head>
     6   <title>Test gamepad</title>
     7   <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
     8   <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
     9 </head>
    10 <body>
    11 <script type="text/javascript" src="mock_gamepad.js"></script>
    12 <script class="testbody" type="text/javascript">
    13 SimpleTest.waitForExplicitFinish();
    14 window.addEventListener("gamepadconnected", connecthandler);
    15 // Add a gamepad
    16 var index = GamepadService.addGamepad("test gamepad", // id
    17                                       SpecialPowers.Ci.nsIGamepadServiceTest.STANDARD_MAPPING,
    18                                       4, // buttons
    19                                       2);// axes
    20 // Press a button
    21 GamepadService.newButtonEvent(index, 0, true);
    22 function connecthandler(e) {
    23   is(e.gamepad.id, "test gamepad", "correct gamepad name");
    24   is(e.gamepad.mapping, "standard", "standard mapping");
    25   is(e.gamepad.buttons.length, 4, "correct number of buttons");
    26   is(e.gamepad.axes.length, 2, "correct number of axes");
    27   SimpleTest.executeSoon(function() {
    28     GamepadService.removeGamepad(index);
    29     SimpleTest.finish();
    30   });
    31 }
    32 </script>
    33 </body>
    34 </html>

mercurial