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; | |
54 display_impl->RequestPresent( | 50 display_impl->RequestPresent( |
55 true, std::move(submit_client), | 51 true, base::Bind(&VRDisplayImplTest::onPresentComplete, |
56 base::Bind(&VRDisplayImplTest::onPresentComplete, | 52 base::Unretained(this))); |
57 base::Unretained(this))); | |
58 } | 53 } |
59 | 54 |
60 void ExitPresent(VRDisplayImpl* display_impl) { display_impl->ExitPresent(); } | 55 void ExitPresent(VRDisplayImpl* display_impl) { display_impl->ExitPresent(); } |
61 | 56 |
62 void TearDown() override { base::RunLoop().RunUntilIdle(); } | 57 void TearDown() override { base::RunLoop().RunUntilIdle(); } |
63 | 58 |
64 VRDevice* device() { return device_; } | 59 VRDevice* device() { return device_; } |
65 | 60 |
66 bool presenting() { return !!device_->presenting_display_; } | 61 bool presenting() { return !!device_->presenting_display_; } |
67 | 62 |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 auto service_2 = BindService(); | 116 auto service_2 = BindService(); |
122 | 117 |
123 device()->OnChanged(); | 118 device()->OnChanged(); |
124 | 119 |
125 base::RunLoop().RunUntilIdle(); | 120 base::RunLoop().RunUntilIdle(); |
126 | 121 |
127 for (auto* client : clients_) | 122 for (auto* client : clients_) |
128 EXPECT_TRUE(client->CheckDeviceId(device()->id())); | 123 EXPECT_TRUE(client->CheckDeviceId(device()->id())); |
129 } | 124 } |
130 } | 125 } |
OLD | NEW |