Chromium Code Reviews| 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 |