| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "device/vr/vr_service_impl.h" | 5 #include "device/vr/vr_service_impl.h" |
| 6 | 6 |
| 7 #include "base/message_loop/message_loop.h" | 7 #include "base/message_loop/message_loop.h" |
| 8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
| 9 #include "device/vr/test/fake_vr_device.h" | 9 #include "device/vr/test/fake_vr_device.h" |
| 10 #include "device/vr/test/fake_vr_device_provider.h" | 10 #include "device/vr/test/fake_vr_device_provider.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 } | 26 } |
| 27 | 27 |
| 28 MOCK_METHOD1(OnExitPresent, void(uint32_t index)); | 28 MOCK_METHOD1(OnExitPresent, void(uint32_t index)); |
| 29 | 29 |
| 30 MOCK_METHOD1(OnDisplayConnected, void(const VRDisplay& display)); | 30 MOCK_METHOD1(OnDisplayConnected, void(const VRDisplay& display)); |
| 31 void OnDisplayConnected(VRDisplayPtr display) override { | 31 void OnDisplayConnected(VRDisplayPtr display) override { |
| 32 OnDisplayConnected(*display); | 32 OnDisplayConnected(*display); |
| 33 last_display_ = std::move(display); | 33 last_display_ = std::move(display); |
| 34 } | 34 } |
| 35 void OnDisplayDisconnected(unsigned index) override {} | 35 void OnDisplayDisconnected(unsigned index) override {} |
| 36 void OnDisplayBlur(unsigned index) override {} |
| 37 void OnDisplayFocus(unsigned index) override {} |
| 36 | 38 |
| 37 const VRDisplayPtr& LastDisplay() { return last_display_; } | 39 const VRDisplayPtr& LastDisplay() { return last_display_; } |
| 38 | 40 |
| 39 private: | 41 private: |
| 40 VRDisplayPtr last_display_; | 42 VRDisplayPtr last_display_; |
| 41 }; | 43 }; |
| 42 | 44 |
| 43 class VRServiceTestBinding { | 45 class VRServiceTestBinding { |
| 44 public: | 46 public: |
| 45 VRServiceTestBinding() { | 47 VRServiceTestBinding() { |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 | 200 |
| 199 std::unique_ptr<FakeVRDevice> device(new FakeVRDevice(provider_)); | 201 std::unique_ptr<FakeVRDevice> device(new FakeVRDevice(provider_)); |
| 200 device_manager_->OnDeviceConnectionStatusChanged(device.get(), true); | 202 device_manager_->OnDeviceConnectionStatusChanged(device.get(), true); |
| 201 | 203 |
| 202 base::RunLoop().RunUntilIdle(); | 204 base::RunLoop().RunUntilIdle(); |
| 203 | 205 |
| 204 EXPECT_EQ(device->id(), service_1->client().LastDisplay()->index); | 206 EXPECT_EQ(device->id(), service_1->client().LastDisplay()->index); |
| 205 EXPECT_EQ(device->id(), service_2->client().LastDisplay()->index); | 207 EXPECT_EQ(device->id(), service_2->client().LastDisplay()->index); |
| 206 } | 208 } |
| 207 } | 209 } |
| OLD | NEW |