Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(20)

Unified Diff: third_party/WebKit/LayoutTests/sensor/absolute-orientation-sensor.html

Issue 2746573002: [Sensors] Implement bindings for AbsoluteOrientationSensor (Closed)
Patch Set: [Sensors] Implement bindings for AbsoluteOrientationSensor Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/sensor/absolute-orientation-sensor.html
diff --git a/third_party/WebKit/LayoutTests/sensor/absolute-orientation-sensor.html b/third_party/WebKit/LayoutTests/sensor/absolute-orientation-sensor.html
new file mode 100644
index 0000000000000000000000000000000000000000..e6ec891c956f8b66f50ad8c9f5802c3b98b60234
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/sensor/absolute-orientation-sensor.html
@@ -0,0 +1,44 @@
+<!DOCTYPE html>
+<script src="../resources/testharness.js"></script>
+<script src="../resources/testharnessreport.js"></script>
+<script src="../resources/mojo-helpers.js"></script>
+<script src="resources/sensor-helpers.js"></script>
+<script src="resources/generic-sensor-tests.js"></script>
+<script>
+
+'use strict';
+
+if (!window.testRunner)
+ debug('This test cannot be run without the TestRunner');
+
+const kIdentityQuaternion = [1, 0, 0, 0];
+const kIdentityMatrix = [1, 0, 0, 0,
shalamov 2017/03/23 08:41:06 Would be cool if we provide predefined quats and v
Mikhail 2017/03/24 14:47:09 Done.
+ 0, 1, 0, 0,
+ 0, 0, 1, 0,
+ 0, 0, 0, 1];
+
+function update_sensor_reading(buffer, expects_modified_reading, readsCount) {
+ buffer[1] = window.performance.now();
+ buffer[2] = 0;
+ buffer[3] = 0;
+ buffer[4] = 0;
+ buffer[5] = 1;
+}
+
+function verify_sensor_reading(sensor, should_be_null) {
+ if (should_be_null)
+ return sensor.quaternion == null && sensor.timestamp == null;
+
+ if (sensor.timestamp == null ||
+ sensor.quaternion.toString() != kIdentityQuaternion.toString())
+ return false;
+
+ let rotationMatrix = new Float32Array(16);
+ sensor.populateMatrix(rotationMatrix);
+
+ return rotationMatrix.toString() == kIdentityMatrix.toString();
shalamov 2017/03/23 08:41:05 I think there were array comparison helpers, maybe
Mikhail 2017/03/24 14:47:09 I found only asserts being exposed
+}
+
+runGenericSensorTests(AbsoluteOrientationSensor, update_sensor_reading, verify_sensor_reading);
+
+</script>

Powered by Google App Engine
This is Rietveld 408576698