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

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

Issue 2624263003: Add more WebVR layout tests and fix small issues they found (Closed)
Patch Set: Added a few clarifying comments 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/events_vrdisplayconnect.html
diff --git a/third_party/WebKit/LayoutTests/vr/events_vrdisplayconnect.html b/third_party/WebKit/LayoutTests/vr/events_vrdisplayconnect.html
new file mode 100644
index 0000000000000000000000000000000000000000..f1341b794034d645661d6a231264975664fa81db
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/vr/events_vrdisplayconnect.html
@@ -0,0 +1,52 @@
+<!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, mockService) => {
+ let watcherDone = new Event("watcherdone");
+ let eventWatcher = new EventWatcher(t, window, ["vrdisplayconnect",
+ "watcherdone"]);
+ eventWatcher.wait_for(["vrdisplayconnect", /*Initial mock display connected*/
+ "vrdisplayconnect", /*Display added w/ addVRDisplay*/
+ "watcherdone"])
+ .then( () => {
+ t.done();
+ });
+ return navigator.getVRDisplays().then( (displays) => {
+ var display = displays[0];
+
+ t.step( () => {
+ assert_equals(displays.length, 1);
+ }, "Starting with a single display");
+ mockService.addVRDisplay(fakeDisplays["FakeMagicWindowOnly"]);
+
+ setTimeout( () => {
+ navigator.getVRDisplays().then( (displays) => {
+ t.step( () => {
+ assert_equals(displays.length, 2);
+ assert_equals(displays[1].displayName, "FakeVRDisplay");
+ }, "Check added display");
+ window.dispatchEvent(watcherDone);
+ }, (err) => {
+ t.step( () => {
+ assert_unreached(err);
+ }, "second getVRDisplays rejected");
+ });
+ }, 100);
+ }, (err) => {
+ t.step( () => {
+ assert_unreached(err);
+ }, "getVRDisplays rejected");
+ t.done();
+ });
+}, [fakeDisplays["Pixel"]],
+"Test vrdisplayconnect fires once when new display connected");
+
+</script>

Powered by Google App Engine
This is Rietveld 408576698