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

Unified Diff: device/vr/test/fake_vr_device.cc

Issue 2167643003: Refactored VRService interaction and added VRServiceClient (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Liberal sprinkling of 'u's Created 4 years, 5 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
« no previous file with comments | « device/vr/test/fake_vr_device.h ('k') | device/vr/vr_client_dispatcher.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: device/vr/test/fake_vr_device.cc
diff --git a/device/vr/test/fake_vr_device.cc b/device/vr/test/fake_vr_device.cc
index d6c1b9527b81d3b6958610e95aa4b104a1e5e908..48e7138dd074fb2199c9a7f0b1748ff9feea5757 100644
--- a/device/vr/test/fake_vr_device.cc
+++ b/device/vr/test/fake_vr_device.cc
@@ -9,10 +9,47 @@ namespace device {
FakeVRDevice::FakeVRDevice(VRDeviceProvider* provider) : VRDevice(provider) {
device_ = VRDisplay::New();
pose_ = VRPose::New();
+
+ InitBasicDevice();
}
FakeVRDevice::~FakeVRDevice() {}
+void FakeVRDevice::InitBasicDevice() {
+ device_->displayName = "FakeVRDevice";
+
+ device_->capabilities = VRDisplayCapabilities::New();
+ device_->capabilities->hasOrientation = true;
+ device_->capabilities->hasPosition = false;
+ device_->capabilities->hasExternalDisplay = false;
+ device_->capabilities->canPresent = false;
+
+ device_->leftEye = InitEye(45, -0.03f, 1024);
+ device_->rightEye = InitEye(45, 0.03f, 1024);
+}
+
+VREyeParametersPtr FakeVRDevice::InitEye(float fov,
+ float offset,
+ uint32_t size) {
+ VREyeParametersPtr eye = VREyeParameters::New();
+
+ eye->fieldOfView = VRFieldOfView::New();
+ eye->fieldOfView->upDegrees = fov;
+ eye->fieldOfView->downDegrees = fov;
+ eye->fieldOfView->leftDegrees = fov;
+ eye->fieldOfView->rightDegrees = fov;
+
+ eye->offset = mojo::Array<float>::New(3);
+ eye->offset[0] = offset;
+ eye->offset[1] = 0.0f;
+ eye->offset[2] = 0.0f;
+
+ eye->renderWidth = size;
+ eye->renderHeight = size;
+
+ return eye;
+}
+
void FakeVRDevice::SetVRDevice(const VRDisplayPtr& device) {
device_ = device.Clone();
}
@@ -22,7 +59,9 @@ void FakeVRDevice::SetPose(const VRPosePtr& pose) {
}
VRDisplayPtr FakeVRDevice::GetVRDevice() {
- return device_.Clone();
+ VRDisplayPtr display = device_.Clone();
+ display->index = id();
+ return display.Clone();
}
VRPosePtr FakeVRDevice::GetPose() {
« no previous file with comments | « device/vr/test/fake_vr_device.h ('k') | device/vr/vr_client_dispatcher.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698