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

Unified Diff: device/vr/vr_service_impl_unittest.cc

Issue 2317483002: Add support of vrdisplayconnect and vrdisplaydisconnect event (Closed)
Patch Set: fix missing brace Created 4 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « device/vr/vr_service.mojom ('k') | third_party/WebKit/Source/modules/vr/NavigatorVR.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: device/vr/vr_service_impl_unittest.cc
diff --git a/device/vr/vr_service_impl_unittest.cc b/device/vr/vr_service_impl_unittest.cc
index cefe287a661f1805245efc6e7dec30ab39aca2dc..835a57dbb007f0a91764ff1452063f0045d028a4 100644
--- a/device/vr/vr_service_impl_unittest.cc
+++ b/device/vr/vr_service_impl_unittest.cc
@@ -27,6 +27,13 @@ class MockVRServiceClient : public VRServiceClient {
MOCK_METHOD1(OnExitPresent, void(uint32_t index));
+ MOCK_METHOD1(OnDisplayConnected, void(const VRDisplay& display));
+ void OnDisplayConnected(VRDisplayPtr display) override {
+ OnDisplayConnected(*display);
+ last_display_ = std::move(display);
+ }
+ void OnDisplayDisconnected(unsigned index) override {}
+
const VRDisplayPtr& LastDisplay() { return last_display_; }
private:
@@ -180,4 +187,21 @@ TEST_F(VRServiceImplTest, DevicePresentationIsolation) {
EXPECT_EQ(device.get(), VRDeviceManager::GetAllowedDevice(
service_2->service(), device->id()));
}
+
+// Ensure that DeviceChanged calls are dispatched to all active services.
+TEST_F(VRServiceImplTest, DeviceConnectedDispatched) {
+ std::unique_ptr<VRServiceTestBinding> service_1 = BindService();
+ std::unique_ptr<VRServiceTestBinding> service_2 = BindService();
+
+ EXPECT_CALL(service_1->client(), OnDisplayConnected(_));
+ EXPECT_CALL(service_2->client(), OnDisplayConnected(_));
+
+ std::unique_ptr<FakeVRDevice> device(new FakeVRDevice(provider_));
+ device_manager_->OnDeviceConnectionStatusChanged(device.get(), true);
+
+ base::RunLoop().RunUntilIdle();
+
+ EXPECT_EQ(device->id(), service_1->client().LastDisplay()->index);
+ EXPECT_EQ(device->id(), service_2->client().LastDisplay()->index);
+}
}
« no previous file with comments | « device/vr/vr_service.mojom ('k') | third_party/WebKit/Source/modules/vr/NavigatorVR.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698