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

Side by Side Diff: third_party/WebKit/LayoutTests/vr/resources/mock-vr-service.js

Issue 2736593002: Update API to latest spec : Remove VRFrameData#timestamp (Closed)
Patch Set: modify mock-vr-service.js 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 unified diff | Download patch
OLDNEW
1 'use strict'; 1 'use strict';
2 2
3 let mockVRService = loadMojoModules( 3 let mockVRService = loadMojoModules(
4 'mockVRService', 4 'mockVRService',
5 ['mojo/public/js/bindings', 5 ['mojo/public/js/bindings',
6 'device/vr/vr_service.mojom', 6 'device/vr/vr_service.mojom',
7 ]).then(mojo => { 7 ]).then(mojo => {
8 let [bindings, vr_service] = mojo.modules; 8 let [bindings, vr_service] = mojo.modules;
9 9
10 class MockVRDisplay { 10 class MockVRDisplay {
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 this.timeDelta_ = 0; 60 this.timeDelta_ = 0;
61 this.binding_ = new bindings.Binding(vr_service.VRVSyncProvider, this); 61 this.binding_ = new bindings.Binding(vr_service.VRVSyncProvider, this);
62 this.pose_ = null; 62 this.pose_ = null;
63 } 63 }
64 bind(request) { 64 bind(request) {
65 this.binding_.close(); 65 this.binding_.close();
66 this.binding_.bind(request); 66 this.binding_.bind(request);
67 } 67 }
68 getVSync() { 68 getVSync() {
69 if (this.pose_) { 69 if (this.pose_) {
70 this.pose_.timestamp = this.timeDelta_;
71 this.pose_.poseIndex++; 70 this.pose_.poseIndex++;
72 } 71 }
73 72
74 let retval = Promise.resolve({ 73 let retval = Promise.resolve({
75 pose: this.pose_, 74 pose: this.pose_,
76 time: { 75 time: {
77 microseconds: this.timeDelta_, 76 microseconds: this.timeDelta_,
78 }, 77 },
79 frameId: 0, 78 frameId: 0,
80 error: vr_service.VRVSyncProvider.Status.SUCCESS, 79 error: vr_service.VRVSyncProvider.Status.SUCCESS,
81 }); 80 });
82 81
83 this.timeDelta_ += 1000.0 / 60.0; 82 this.timeDelta_ += 1000.0 / 60.0;
84 return retval; 83 return retval;
85 } 84 }
86 initPose() { 85 initPose() {
87 this.pose_ = { 86 this.pose_ = {
88 timestamp: 0,
89 orientation: null, 87 orientation: null,
90 position: null, 88 position: null,
91 angularVelocity: null, 89 angularVelocity: null,
92 linearVelocity: null, 90 linearVelocity: null,
93 angularAcceleration: null, 91 angularAcceleration: null,
94 linearAcceleration: null, 92 linearAcceleration: null,
95 poseIndex: 0 93 poseIndex: 0
96 }; 94 };
97 } 95 }
98 fillPose(pose) { 96 fillPose(pose) {
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 return new MockVRService(mojo.frameInterfaces); 146 return new MockVRService(mojo.frameInterfaces);
149 }); 147 });
150 148
151 function vr_test(func, vrDisplays, name, properties) { 149 function vr_test(func, vrDisplays, name, properties) {
152 mockVRService.then( (service) => { 150 mockVRService.then( (service) => {
153 service.setVRDisplays(vrDisplays); 151 service.setVRDisplays(vrDisplays);
154 let t = async_test(name, properties); 152 let t = async_test(name, properties);
155 func(t, service); 153 func(t, service);
156 }); 154 });
157 } 155 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698