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

Unified Diff: third_party/WebKit/LayoutTests/vr/getLayers_presenting.html

Issue 2623613002: Reland 2617183002 without offending tests (Closed)
Patch Set: Created 3 years, 11 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/vr/getLayers_presenting.html
diff --git a/third_party/WebKit/LayoutTests/vr/getLayers_presenting.html b/third_party/WebKit/LayoutTests/vr/getLayers_presenting.html
new file mode 100644
index 0000000000000000000000000000000000000000..ff43931e6a13dc18406dca29644f10493c90a95c
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/vr/getLayers_presenting.html
@@ -0,0 +1,58 @@
+<!DOCTYPE html>
+<script src="../resources/testharness.js"></script>
+<script src="../resources/testharnessreport.js"></script>
+<script src="../resources/mojo-helpers.js"></script>
+<script src="resources/fake-vr-displays.js"></script>
+<script src="resources/mock-vr-service.js"></script>
+<script src="resources/test-constants.js"></script>
+<canvas id="webgl-canvas"></canvas>
+<script src="resources/presentation-setup.js"></script>
+<script>
+let fakeDisplays = fakeVRDisplays();
+
+vr_test( (t) => {
+ return navigator.getVRDisplays().then( (displays) => {
+ var display = displays[0];
+
+ t.step( () => {
+ assert_equals(display.getLayers().length, 0);
+ }, "No layers initially returned");
+
+ runWithUserGesture( () => {
+ display.requestPresent([{ source : webglCanvas }]).then( () => {
+ t.step( () => {
+ let layers = display.getLayers();
+ assert_equals(layers.length, 1);
+ let layer = layers[0];
+
+ assert_equals(layer.source, webglCanvas);
+ assert_equals(layer.leftBounds.length, 4);
+ assert_equals(layer.rightBounds.length, 4);
+
+ let expectedLeft = [0.0, 0.0, 0.5, 1.0];
+ let expectedRight = [0.5, 0.0, 0.5, 1.0];
+ for (let i = 0; i < layer.leftBounds.length; i++) {
+ assert_approx_equals(layer.leftBounds[i], expectedLeft[i],
+ FLOAT_EPSILON);
+ assert_approx_equals(layer.rightBounds[i], expectedRight[i],
+ FLOAT_EPSILON);
+ }
+ }, "Layer is correct");
+ }, (err) => {
+ t.step( () => {
+ assert_unreached();
+ }, "requestPresent failed");
+ }).then( () => {
+ t.done();
+ });
+ });
+ }, (err) => {
+ t.step( () => {
+ assert_unreached();
+ }, "getVRDisplays rejected");
+ t.done();
+ });
+}, [fakeDisplays["Pixel"]],
+"Test getLayers returns an empty array when not presenting");
+
+</script>

Powered by Google App Engine
This is Rietveld 408576698