summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/orientation-event/orientation/absolute-fallback.https.html
blob: 27a430728e88a160063792b37c1a144a156ff63f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
<!DOCTYPE html>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/resources/testdriver.js"></script>
<script src="/resources/testdriver-vendor.js"></script>
<script src="../resources/orientation-event-helpers.js"></script>
<script>
'use strict';

promise_test(async (t) => {
  const helper = new SensorTestHelper(t, 'deviceorientation');
  await helper.grantSensorsPermissions();

  // Make the relative orientation sensor unavailable and set mock data for
  // the absolute one.
  await helper.initializeSensors({enabledSensors: ['absolute-orientation'], disabledSensors: ['relative-orientation']});
  const orientationData = generateOrientationData(1.1, 2.2, 3.3, true);

  // Check sensor values when fallback is activated.
  await helper.setData(orientationData);
  await waitForEvent(getExpectedOrientationEvent(orientationData));
}, 'Tests that deviceorientation falls back to using absolute orientation data if relative is unavailable.');
</script>