tor-browser

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

multiple-promises-after-resolve.https.html (772B)


      1 <!DOCTYPE html>
      2 <html>
      3 <head>
      4 <script src="/resources/testharness.js"></script>
      5 <script src="/resources/testharnessreport.js"></script>
      6 <script src="/resources/test-only-api.js"></script>
      7 <script src="resources/battery-status-helpers.js"></script>
      8 </head>
      9 <body>
     10 <script>
     11 battery_status_test(async (t, mockBatteryMonitor)  => {
     12  const promise1 = navigator.getBattery();
     13  mockBatteryMonitor.setBatteryStatus(false, 10, 20, 0.5);
     14  const result1 = await promise1;
     15  mockBatteryMonitor.verifyBatteryStatus(result1);
     16  const promise2 = navigator.getBattery();
     17  assert_equals(promise1, promise2);
     18  const result2 = await promise2;
     19  mockBatteryMonitor.verifyBatteryStatus(result2);
     20 }, 'multiple consecutive invocations of navigator.getBattery()');
     21 </script>
     22 </body>
     23 </html>