tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

rounding.https.html (995B)


      1 <!DOCTYPE html>
      2 <script src="/resources/testharness.js"></script>
      3 <script src="/resources/testharnessreport.js"></script>
      4 <script src="/resources/testdriver.js"></script>
      5 <script src="/resources/testdriver-vendor.js"></script>
      6 <script src="../resources/orientation-event-helpers.js"></script>
      7 <script>
      8 'use strict';
      9 
     10 promise_test(async (t) => {
     11  const helper = new SensorTestHelper(t, 'deviceorientation');
     12  await helper.grantSensorsPermissions();
     13  await helper.initializeSensors();
     14 
     15  const value = 1.23456789;
     16  const orientationData = generateOrientationData(value, value, value, false);
     17  await helper.setData(orientationData);
     18 
     19  const event = await new Promise(resolve => {
     20    window.addEventListener('deviceorientation', t.step_func(ev => {
     21      resolve(ev);
     22    }, { once: true }));
     23  });
     24 
     25  assertValueIsCoarsened(event.alpha);
     26  assertValueIsCoarsened(event.beta);
     27  assertValueIsCoarsened(event.gamma);
     28 }, 'Tests that deviceorientation values are correctly rounded.');
     29 </script>