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

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

Issue 2617183002: Add more WebVR layout tests, adjust test format (Closed)
Patch Set: Add some missing catches for failed getVRDisplays 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..c8dde3773ed3ab5b5f0f04b9687767b234d94dc5
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/vr/getLayers_presenting.html
@@ -0,0 +1,59 @@
+<!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>
+<canvas id="webgl-canvas"></canvas>
+<script src="resources/presentation-setup.js"></script>
+<script>
+let fakeDisplays = fakeVRDisplays();
+
+vr_test( (t) => {
+ return navigator.getVRDisplays().then( (displays) => {
+ t.step( () => {
+ assert_true(displays != null);
+ assert_equals(1, displays.length);
bajones 2017/01/06 20:20:25 For consistency let's make sure the assert's argum
bsheedy 2017/01/06 22:14:19 Done.
+ }, "getVRDisplays returned correct results");
bajones 2017/01/06 20:20:25 Seems redundant to have this check in every single
bsheedy 2017/01/06 22:14:19 Done, removed from tests except for ones specifica
+ 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);
bajones 2017/01/06 20:20:25 For consistency let's swap the order of these thre
bsheedy 2017/01/06 22:14:18 If we want assert_equals(actual, expected), then t
+ 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_equals(layer.leftBounds[i], expectedLeft[i]);
+ assert_equals(layer.rightBounds[i], expectedRight[i]);
+ }
+ }, "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