tor-browser

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

GeolocationSensor_read.https.html (1300B)


      1 <!DOCTYPE html>
      2 <meta charset="utf-8">
      3 <title>GeolocationSensor.read() Test</title>
      4 <link rel="author" title="Intel" href="http://www.intel.com">
      5 <link rel="help" href="https://wicg.github.io/geolocation-sensor/">
      6 <script src="/resources/testharness.js"></script>
      7 <script src="/resources/testharnessreport.js"></script>
      8 <script>
      9 const properties = [
     10  'timestamp',
     11  'latitude',
     12  'longitude',
     13  'altitude',
     14  'accuracy',
     15  'altitudeAccuracy',
     16  'heading',
     17  'speed'
     18 ];
     19 
     20 promise_test(async t => {
     21  const geo = await GeolocationSensor.read({ signal: null });
     22  assert_not_equals(geo.timestamp, null);
     23  properties.forEach(property => assert_own_property(geo, property));
     24 }, "Test that read() method resolves with valid reading when signal is null");
     25 
     26 promise_test(async t => {
     27  const geo = await GeolocationSensor.read();
     28  assert_not_equals(geo.timestamp, null);
     29  properties.forEach(property => assert_own_property(geo, property));
     30 }, "Test that read() method resolves with valid reading");
     31 
     32 promise_test(async t => {
     33  const controller = new AbortController();
     34  const signal = controller.signal;
     35  controller.abort();
     36 
     37  await promise_rejects_dom(t, 'AbortError', GeolocationSensor.read({ signal }));
     38 }, "Test that read() method rejects 'AbortError' if signal's aborted flag is set");
     39 </script>