summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/orientation-event/motion/multiple-event-listeners.https.html
blob: f94c9d136eb310f1bf51d8d2677e374996ed538e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<!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, 'devicemotion');
  await helper.grantSensorsPermissions();
  await helper.initializeSensors();

  const motionData1 = generateMotionData(1, 2, 3,
                                         4, 5, 6,
                                         7, 8, 9);
  await helper.setData(motionData1);
  await Promise.all([
    waitForEvent(getExpectedMotionEvent(motionData1)),
    waitForEvent(getExpectedMotionEvent(motionData1))
  ]);

  const motionData2 = generateMotionData(11, 12, 13,
                                         14, 15, 16,
                                         17, 18, 19);
  await helper.setData(motionData2);
  await waitForEvent(getExpectedMotionEvent(motionData2));
}, 'Tests using multiple event handlers for the Device Motion API.');
</script>