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

Side by Side Diff: device/vr/vr_service_impl_unittest.cc

Issue 2374153002: Expose secure origin state to WebVR renderer (Closed)
Patch Set: Rebase, remove stray logging, set explicit default Created 4 years, 2 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 unified diff | Download patch
« no previous file with comments | « device/vr/vr_service_impl.cc ('k') | third_party/WebKit/Source/modules/vr/VRController.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 // Ensure the device manager has seen the fake device 150 // Ensure the device manager has seen the fake device
151 device_manager_->GetVRDevices(); 151 device_manager_->GetVRDevices();
152 152
153 // When not presenting either service should be able to access the device 153 // When not presenting either service should be able to access the device
154 EXPECT_EQ(device.get(), VRDeviceManager::GetAllowedDevice( 154 EXPECT_EQ(device.get(), VRDeviceManager::GetAllowedDevice(
155 service_1->service(), device->id())); 155 service_1->service(), device->id()));
156 EXPECT_EQ(device.get(), VRDeviceManager::GetAllowedDevice( 156 EXPECT_EQ(device.get(), VRDeviceManager::GetAllowedDevice(
157 service_2->service(), device->id())); 157 service_2->service(), device->id()));
158 158
159 // Begin presenting to the fake device with service 1 159 // Begin presenting to the fake device with service 1
160 EXPECT_TRUE( 160 EXPECT_TRUE(device_manager_->RequestPresent(service_1->service(),
161 device_manager_->RequestPresent(service_1->service(), device->id())); 161 device->id(), true));
162 162
163 EXPECT_TRUE(presenting()); 163 EXPECT_TRUE(presenting());
164 164
165 // Service 2 should not be able to present to the device while service 1 165 // Service 2 should not be able to present to the device while service 1
166 // is still presenting. 166 // is still presenting.
167 EXPECT_FALSE( 167 EXPECT_FALSE(device_manager_->RequestPresent(service_2->service(),
168 device_manager_->RequestPresent(service_2->service(), device->id())); 168 device->id(), true));
169 169
170 // Only the presenting service should be able to access the device 170 // Only the presenting service should be able to access the device
171 EXPECT_EQ(device.get(), VRDeviceManager::GetAllowedDevice( 171 EXPECT_EQ(device.get(), VRDeviceManager::GetAllowedDevice(
172 service_1->service(), device->id())); 172 service_1->service(), device->id()));
173 EXPECT_EQ(nullptr, VRDeviceManager::GetAllowedDevice(service_2->service(), 173 EXPECT_EQ(nullptr, VRDeviceManager::GetAllowedDevice(service_2->service(),
174 device->id())); 174 device->id()));
175 175
176 // Service 2 should not be able to exit presentation to the device 176 // Service 2 should not be able to exit presentation to the device
177 device_manager_->ExitPresent(service_2->service(), device->id()); 177 device_manager_->ExitPresent(service_2->service(), device->id());
178 EXPECT_TRUE(presenting()); 178 EXPECT_TRUE(presenting());
(...skipping 19 matching lines...) Expand all
198 198
199 std::unique_ptr<FakeVRDevice> device(new FakeVRDevice(provider_)); 199 std::unique_ptr<FakeVRDevice> device(new FakeVRDevice(provider_));
200 device_manager_->OnDeviceConnectionStatusChanged(device.get(), true); 200 device_manager_->OnDeviceConnectionStatusChanged(device.get(), true);
201 201
202 base::RunLoop().RunUntilIdle(); 202 base::RunLoop().RunUntilIdle();
203 203
204 EXPECT_EQ(device->id(), service_1->client().LastDisplay()->index); 204 EXPECT_EQ(device->id(), service_1->client().LastDisplay()->index);
205 EXPECT_EQ(device->id(), service_2->client().LastDisplay()->index); 205 EXPECT_EQ(device->id(), service_2->client().LastDisplay()->index);
206 } 206 }
207 } 207 }
OLDNEW
« no previous file with comments | « device/vr/vr_service_impl.cc ('k') | third_party/WebKit/Source/modules/vr/VRController.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698