OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CONTENT_BROWSER_VR_VR_TEST_HELPERS_H_ | |
6 #define CONTENT_BROWSER_VR_VR_TEST_HELPERS_H_ | |
7 | |
8 #include <vector> | |
9 #include "content/browser/vr/vr_device.h" | |
10 #include "content/browser/vr/vr_device_provider.h" | |
11 #include "third_party/WebKit/public/platform/WebVR.h" | |
12 | |
13 namespace content { | |
14 | |
15 class MockVRDevice : public VRDevice { | |
no sievers
2015/03/19 01:24:52
nit: might be nice to have these two mock classes
| |
16 public: | |
17 MockVRDevice(VRDeviceProvider* provider); | |
18 ~MockVRDevice() override; | |
19 | |
no sievers
2015/03/19 01:24:52
Since you are not using gmock, should these classe
no sievers
2015/03/19 01:26:23
err FakeVRDevice etc. I meant
| |
20 void SetVRDevice(const blink::WebVRDevice& device); | |
21 void SetHMDSensorState(const blink::WebHMDSensorState& state); | |
22 void SetRenderTargetSize(unsigned int width, unsigned int height); | |
23 | |
24 void GetVRDevice(blink::WebVRDevice* device) override; | |
25 void GetHMDSensorState(blink::WebHMDSensorState* state) override; | |
26 void ResetSensor() override {}; | |
27 void GetRenderTargetRects( | |
28 blink::WebVRFieldOfView leftFov, | |
29 blink::WebVRFieldOfView rightFov, | |
30 blink::WebVRVector4* leftRect, | |
31 blink::WebVRVector4* rightRect) override; | |
32 | |
33 private: | |
34 blink::WebVRDevice device_; | |
35 blink::WebHMDSensorState state_; | |
36 unsigned int width_; | |
37 unsigned int height_; | |
38 }; | |
39 | |
40 // Data fetcher that returns canned data for the gamepad provider. | |
41 class MockVRDeviceProvider : public VRDeviceProvider { | |
42 public: | |
43 MockVRDeviceProvider(); | |
44 ~MockVRDeviceProvider() override; | |
45 | |
46 // Adds devices to the provider with the given device, which will be | |
47 // returned when GetDevices is queried. | |
48 void AddDevice(VRDevice* device); | |
49 void RemoveDevice(VRDevice* device); | |
50 bool IsInitialized() { return initialized_; } | |
51 | |
52 void GetDevices(std::vector<VRDevice*>& devices) override; | |
53 void Initialize() override; | |
54 void Shutdown() override; | |
55 | |
56 private: | |
57 std::vector<VRDevice*> devices_; | |
58 bool initialized_; | |
59 }; | |
60 | |
61 } // namespace content | |
62 | |
63 #endif // CONTENT_BROWSER_VR_VR_TEST_HELPERS_H_ | |
OLD | NEW |