summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/orientation-event/orientation/basic-operation.https.html
diff options
context:
space:
mode:
Diffstat (limited to 'testing/web-platform/tests/orientation-event/orientation/basic-operation.https.html')
-rw-r--r--testing/web-platform/tests/orientation-event/orientation/basic-operation.https.html34
1 files changed, 34 insertions, 0 deletions
diff --git a/testing/web-platform/tests/orientation-event/orientation/basic-operation.https.html b/testing/web-platform/tests/orientation-event/orientation/basic-operation.https.html
new file mode 100644
index 0000000000..c4d26e3744
--- /dev/null
+++ b/testing/web-platform/tests/orientation-event/orientation/basic-operation.https.html
@@ -0,0 +1,34 @@
+<!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();
+ await helper.initializeSensors();
+
+ const orientationData = generateOrientationData(1.1, 2.2, 3.3, false);
+ await helper.setData(orientationData);
+ await waitForEvent(getExpectedOrientationEvent(orientationData));
+}, 'Tests basic operation of deviceorientation event using mock data.');
+
+promise_test(async (t) => {
+ const helper = new SensorTestHelper(t, 'deviceorientation');
+ await helper.grantSensorsPermissions();
+ await helper.initializeSensors({disabledSensors: ['relative-orientation']});
+
+ const orientationData = generateOrientationData(null, null, null, false);
+ const watcher = new EventWatcher(t, window, ['deviceorientation']);
+
+ const event = await watcher.wait_for('deviceorientation');
+ assert_equals(event.type, 'deviceorientation', 'type is set to \"deviceorientation\"');
+ assert_true(event instanceof DeviceOrientationEvent, 'event is DeviceOrientationEvent');
+
+ assertEventEquals(event, getExpectedOrientationEvent(orientationData));
+}, 'If UA can never provide orientation information, the event should be fired as a null event.');
+</script>