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

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 the rest of sievers@ input Created 5 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 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..c18dfdf0fe67ccc4ae5c12e5dc5b9cd2a7afa46e
--- /dev/null
+++ b/content/browser/vr/test/fake_vr_device.cc
@@ -0,0 +1,55 @@
+// Copyright (c) 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) {
+}
+
+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