tor-browser

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

null-values.https.html (2291B)


      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, 'devicemotion');
     12  await helper.grantSensorsPermissions();
     13 
     14  const motionData1 = generateMotionData(1, 2, 3,
     15                                         null, null, null,
     16                                         null, null, null);
     17 
     18  const motionData2 = generateMotionData(null, null, null,
     19                                         1, 2, 3,
     20                                         null, null, null);
     21 
     22  const motionData3 = generateMotionData(null, null, null,
     23                                         null, null, null,
     24                                         1, 2, 3);
     25 
     26  const motionData4 = generateMotionData(null, null, null,
     27                                         null, null, null,
     28                                         null, null, null);
     29 
     30  await helper.initializeSensors({disabledSensors: ['accelerometer','gyroscope']});
     31  await helper.setData(motionData1);
     32  await waitForEvent(getExpectedMotionEvent(motionData1));
     33  // If test needs to change virtual sensor state from connected to not
     34  // connected or vise versa, reset needs to be called. It removes created
     35  // virtual sensors and creating them with different connection state is then
     36  // possible.
     37  await helper.reset();
     38 
     39  await helper.initializeSensors({disabledSensors: ['linear-acceleration','gyroscope']});
     40  await helper.setData(motionData2);
     41  await waitForEvent(getExpectedMotionEvent(motionData2));
     42  await helper.reset();
     43 
     44  await helper.initializeSensors({disabledSensors: ['accelerometer','linear-acceleration']});
     45  await helper.setData(motionData3);
     46  await waitForEvent(getExpectedMotionEvent(motionData3));
     47  await helper.reset();
     48 
     49  await helper.initializeSensors({disabledSensors: ['accelerometer','linear-acceleration','gyroscope']});
     50  await helper.setData(motionData4);
     51  await waitForEvent(getExpectedMotionEvent(motionData4));
     52 }, 'Tests using null values for some or all of the event properties.');
     53 </script>