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

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

Issue 2374153002: Expose secure origin state to WebVR renderer (Closed)
Patch Set: Add missing "RequestPresent" argument to unit test 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
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 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
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(
161 device_manager_->RequestPresent(service_1->service(), device->id())); 161 device_manager_->RequestPresent(service_1->service(), device->id(),
162 true));
162 163
163 EXPECT_TRUE(presenting()); 164 EXPECT_TRUE(presenting());
164 165
165 // Service 2 should not be able to present to the device while service 1 166 // Service 2 should not be able to present to the device while service 1
166 // is still presenting. 167 // is still presenting.
167 EXPECT_FALSE( 168 EXPECT_FALSE(
168 device_manager_->RequestPresent(service_2->service(), device->id())); 169 device_manager_->RequestPresent(service_2->service(), device->id(),
170 true));
169 171
170 // Only the presenting service should be able to access the device 172 // Only the presenting service should be able to access the device
171 EXPECT_EQ(device.get(), VRDeviceManager::GetAllowedDevice( 173 EXPECT_EQ(device.get(), VRDeviceManager::GetAllowedDevice(
172 service_1->service(), device->id())); 174 service_1->service(), device->id()));
173 EXPECT_EQ(nullptr, VRDeviceManager::GetAllowedDevice(service_2->service(), 175 EXPECT_EQ(nullptr, VRDeviceManager::GetAllowedDevice(service_2->service(),
174 device->id())); 176 device->id()));
175 177
176 // Service 2 should not be able to exit presentation to the device 178 // Service 2 should not be able to exit presentation to the device
177 device_manager_->ExitPresent(service_2->service(), device->id()); 179 device_manager_->ExitPresent(service_2->service(), device->id());
178 EXPECT_TRUE(presenting()); 180 EXPECT_TRUE(presenting());
(...skipping 19 matching lines...) Expand all
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 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698