tor-browser

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

basic-operation-absolute.https.html (1596B)


      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, 'deviceorientationabsolute');
     12  await helper.grantSensorsPermissions();
     13  await helper.initializeSensors();
     14 
     15  const orientationData = generateOrientationData(1.1, 2.2, 3.3, true);
     16  await helper.setData(orientationData);
     17  await waitForEvent(getExpectedAbsoluteOrientationEvent(orientationData));
     18 }, 'Tests basic operation of deviceorientationabsolute event using mock data.');
     19 
     20 promise_test(async (t) => {
     21  const helper = new SensorTestHelper(t, 'deviceorientationabsolute');
     22  await helper.grantSensorsPermissions();
     23  await helper.initializeSensors({disabledSensors: ['absolute-orientation']});
     24 
     25  const orientationData = generateOrientationData(null, null, null, true);
     26  const watcher = new EventWatcher(t, window, ['deviceorientationabsolute']);
     27 
     28  const event = await watcher.wait_for('deviceorientationabsolute');
     29  assert_equals(event.type, 'deviceorientationabsolute', 'type is set to \"deviceorientationabsolute\"');
     30  assert_true(event instanceof DeviceOrientationEvent, 'event is DeviceOrientationEvent');
     31 
     32  assertEventEquals(event, getExpectedAbsoluteOrientationEvent(orientationData));
     33 }, 'If UA can never provide absolute information, the event should be fired as a null event.');
     34 </script>