chromium/content/test/data/device_sensors/device_motion_only_some_sensors_are_available_test.html

<html>
  <head>
    <title>DeviceMotion only some sensors are available test</title>
    <script type="text/javascript">
      let expectedInterval = Math.floor(1000 / 60);
      let kRadiansToDegrees = 180 / Math.PI;
      function checkMotionEvent(event) {
        return event.acceleration.x == 1 &&
               event.acceleration.y == 2 &&
               event.acceleration.z == 3 &&
               event.accelerationIncludingGravity.x == null &&
               event.accelerationIncludingGravity.y == null &&
               event.accelerationIncludingGravity.z == null &&
               event.rotationRate.alpha == 7 * kRadiansToDegrees &&
               event.rotationRate.beta == 8 * kRadiansToDegrees &&
               event.rotationRate.gamma == 9 * kRadiansToDegrees &&
               event.interval == expectedInterval;
      }

      function onMotion(event) {
        if (checkMotionEvent(event)) {
          window.removeEventListener('devicemotion', onMotion);
          pass();
        } else {
          console.log("event.acceleration.x is: " + event.acceleration.x);
          console.log("event.acceleration.y is: " + event.acceleration.y);
          console.log("event.acceleration.z is: " + event.acceleration.z);
          console.log("event.accelerationIncludingGravity.x is: " + event.accelerationIncludingGravity.x);
          console.log("event.accelerationIncludingGravity.y is: " + event.accelerationIncludingGravity.y);
          console.log("event.accelerationIncludingGravity.z is: " + event.accelerationIncludingGravity.z);
          console.log("event.rotationRate.alpha is: " + event.rotationRate.alpha);
          console.log("event.rotationRate.beta is: " + event.rotationRate.beta);
          console.log("event.rotationRate.gamma is: " + event.rotationRate.gamma);
          console.log("event.interval is: " + event.interval);
          fail();
        }
      }

      function pass() {
        document.getElementById('status').innerHTML = 'PASS';
        document.location = '#pass';
      }

      function fail() {
        document.location = '#fail';
      }
    </script>
  </head>
  <body onLoad="window.addEventListener('devicemotion', onMotion)">
    <div id="status">FAIL</div>
  </body>
</html>