| 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_display_impl.h" | 5 #include "device/vr/vr_display_impl.h" |
| 6 | 6 |
| 7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
| 8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
| 9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
| 10 #include "device/vr/test/fake_vr_device.h" | 10 #include "device/vr/test/fake_vr_device.h" |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 clients_.push_back(new FakeVRServiceClient(mojo::MakeRequest(&proxy))); | 40 clients_.push_back(new FakeVRServiceClient(mojo::MakeRequest(&proxy))); |
| 41 | 41 |
| 42 auto service = base::WrapUnique(new VRServiceImpl()); | 42 auto service = base::WrapUnique(new VRServiceImpl()); |
| 43 service->SetClient(std::move(proxy), | 43 service->SetClient(std::move(proxy), |
| 44 base::Bind(&VRDisplayImplTest::onDisplaySynced, | 44 base::Bind(&VRDisplayImplTest::onDisplaySynced, |
| 45 base::Unretained(this))); | 45 base::Unretained(this))); |
| 46 return service; | 46 return service; |
| 47 } | 47 } |
| 48 | 48 |
| 49 void RequestPresent(VRDisplayImpl* display_impl) { | 49 void RequestPresent(VRDisplayImpl* display_impl) { |
| 50 // TODO(klausw,mthiesse): set up a VRSubmitFrameClient here? Currently, |
| 51 // the FakeVRDisplay doesn't access the submit client, so a nullptr |
| 52 // is ok. |
| 53 device::mojom::VRSubmitFrameClientPtr submit_client = nullptr; |
| 50 display_impl->RequestPresent( | 54 display_impl->RequestPresent( |
| 51 true, base::Bind(&VRDisplayImplTest::onPresentComplete, | 55 true, std::move(submit_client), |
| 52 base::Unretained(this))); | 56 base::Bind(&VRDisplayImplTest::onPresentComplete, |
| 57 base::Unretained(this))); |
| 53 } | 58 } |
| 54 | 59 |
| 55 void ExitPresent(VRDisplayImpl* display_impl) { display_impl->ExitPresent(); } | 60 void ExitPresent(VRDisplayImpl* display_impl) { display_impl->ExitPresent(); } |
| 56 | 61 |
| 57 void TearDown() override { base::RunLoop().RunUntilIdle(); } | 62 void TearDown() override { base::RunLoop().RunUntilIdle(); } |
| 58 | 63 |
| 59 VRDevice* device() { return device_; } | 64 VRDevice* device() { return device_; } |
| 60 | 65 |
| 61 bool presenting() { return !!device_->presenting_display_; } | 66 bool presenting() { return !!device_->presenting_display_; } |
| 62 | 67 |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 auto service_2 = BindService(); | 121 auto service_2 = BindService(); |
| 117 | 122 |
| 118 device()->OnChanged(); | 123 device()->OnChanged(); |
| 119 | 124 |
| 120 base::RunLoop().RunUntilIdle(); | 125 base::RunLoop().RunUntilIdle(); |
| 121 | 126 |
| 122 for (auto* client : clients_) | 127 for (auto* client : clients_) |
| 123 EXPECT_TRUE(client->CheckDeviceId(device()->id())); | 128 EXPECT_TRUE(client->CheckDeviceId(device()->id())); |
| 124 } | 129 } |
| 125 } | 130 } |
| OLD | NEW |