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

Unified Diff: content/browser/vr/test/fake_vr_device.cc

Issue 829803003: Adding Chrome-side WebVR interface (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed tedchoc@'s feedback Created 5 years, 8 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: content/browser/vr/test/fake_vr_device.cc
diff --git a/content/browser/vr/test/fake_vr_device.cc b/content/browser/vr/test/fake_vr_device.cc
new file mode 100644
index 0000000000000000000000000000000000000000..32b412f74548c345e18e2f6ab4b38371dbc6a149
--- /dev/null
+++ b/content/browser/vr/test/fake_vr_device.cc
@@ -0,0 +1,56 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "content/browser/vr/test/fake_vr_device.h"
+
+namespace content {
+
+FakeVRDevice::FakeVRDevice(VRDeviceProvider* provider)
+ : VRDevice(provider) {
mdempsky 2015/05/11 19:25:01 Nit: Need explicit initialization for device_, sta
+}
+
+FakeVRDevice::~FakeVRDevice() {
+
+}
+
+void FakeVRDevice::SetVRDevice(const blink::WebVRDevice& device) {
+ device_ = device;
+}
+
+void FakeVRDevice::SetSensorState(const blink::WebHMDSensorState& state) {
+ state_ = state;
+}
+
+void FakeVRDevice::SetRenderTargetSize(
+ unsigned int width,
+ unsigned int height) {
+ width_ = width;
+ height_ = height;
+}
+
+void FakeVRDevice::GetVRDevice(blink::WebVRDevice* device) {
+ *device = device_;
+}
+
+void FakeVRDevice::GetSensorState(blink::WebHMDSensorState* state) {
+ *state = state_;
+}
+
+void FakeVRDevice::GetRenderTargetRects(
+ blink::WebVRFieldOfView leftFov,
+ blink::WebVRFieldOfView rightFov,
+ blink::WebVRVector4* leftRect,
+ blink::WebVRVector4* rightRect) {
+ leftRect->x = 0;
+ leftRect->y = 0;
+ leftRect->z = width_ / 2.0;
+ leftRect->w = height_;
+
+ rightRect->x = width_ / 2.0;
+ rightRect->y = 0;
+ rightRect->z = width_ / 2.0;
+ rightRect->w = height_;
+}
+
+} // namespace content

Powered by Google App Engine
This is Rietveld 408576698