content/events/test/test_bug662678.html
author Matt Brubeck <mbrubeck@mozilla.com>
Fri, 26 Aug 2011 15:28:28 -0700
changeset 77280 4dc1e45afdd7282835ea2081ce334176ee30d51a
parent 77270 97d43d93ab55b2b00db0ca9ed3217764f758a739
child 79885 54cb80b5d5a1ac8d336f3881554ac5d724f3ea4c
permissions -rw-r--r--
Back out 14463b9d2d14 and 97d43d93ab55 (Bug 621363 and Bug 676274) because of mochitest-browser-chrome leaks

<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=662678
-->
<head>
  <title>Test for Bug 662678</title>
  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=662678">Mozilla Bug 662678</a>
<p id="display"></p>
<div id="content" style="display: none">
  
</div>
<pre id="test">
<script type="application/javascript">

/** Test for Bug 662678 **/

window.addEventListener("devicemotion", function(event) {
  is(event.acceleration.x, 1.5);
  is(event.acceleration.y, 1.5);
  is(event.acceleration.z, 1.5);

  is(event.accelerationIncludingGravity.x, 1.5);
  is(event.accelerationIncludingGravity.y, 1.5);
  is(event.accelerationIncludingGravity.z, 1.5);

  is(event.rotationRate.alpha, 1.5);
  is(event.rotationRate.beta, 1.5);
  is(event.rotationRate.gamma, 1.5);
  SimpleTest.finish();
}, true);

var event = DeviceMotionEvent;
ok(!!event, "Should have seen DeviceMotionEvent!");

event = document.createEvent("DeviceMotionEvent");
event.initDeviceMotionEvent('devicemotion', true, true, 
                            {x:1.5,y:1.5,z:1.5},
                            {x:1.5,y:1.5,z:1.5},
                            {alpha:1.5,beta:1.5,gamma:1.5},
                            0);
window.dispatchEvent(event);
SimpleTest.waitForExplicitFinish();

</script>
</pre>
</body>
</html>