tor-browser

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

sensor-data.js (2024B)


      1 'use strict';
      2 
      3 const kSensorData = {
      4  sensorName: 'AmbientLightSensor',
      5  permissionName: 'ambient-light-sensor',
      6  testDriverName: 'ambient-light',
      7  featurePolicyNames: ['ambient-light-sensor']
      8 };
      9 
     10 const kReadings = {
     11  readings: [
     12    // Readings are selected so that illuminance significance check causes
     13    // the following to happen:
     14    // 1. First two values test situation when two values would be rounded
     15    //    to same value. As the second value would be rounded to same value
     16    //    as first it won't trigger reading event.
     17    // 2. New value is set to 24. And test checks it is correctly rounded to
     18    //    0.
     19    // 3. New reading is attempted to set to 35.
     20    // 4. Value is read from sensor and compared new reading. But as new
     21    //    reading was not significantly different compared to initial, for
     22    //    privacy reasons, service returns the initial value.
     23    // 5. New value is set to 49. And test checks it is correctly rounded to
     24    //    50. New value is allowed as it is significantly different compared
     25    //    to old value (24).
     26    // 6. New reading is attempted to set to 35.
     27    // 7. Value is read from sensor and compared new reading. But as new
     28    //    reading was not significantly different compared to initial, for
     29    //    privacy reasons, service returns the initial value.
     30    // 8. New value is set to 23. And test checks it is correctly rounded to
     31    //    0. New value is allowed as it is significantly different compared
     32    //    to old value (49).
     33    //
     34    // Note: Readings and expectedReadings wraps around correctly as next
     35    // value would be 150 (output from 127).
     36    { illuminance: 127 }, { illuminance: 165 }, { illuminance: 24 }, {
     37      illuminance:
     38        35
     39    }, { illuminance: 49 }, { illuminance: 35 }, { illuminance: 23 }
     40  ],
     41  expectedReadings: [
     42    { illuminance: 150 }, // output from 127
     43    { illuminance: 0 },   // output from 24
     44    { illuminance: 50 },  // output from 49
     45    { illuminance: 0 }    // output from 23
     46  ]
     47 };