| Index: device/vr/vr_device_client_impl_unittest.cc
|
| diff --git a/device/vr/vr_service_impl_unittest.cc b/device/vr/vr_device_client_impl_unittest.cc
|
| similarity index 77%
|
| copy from device/vr/vr_service_impl_unittest.cc
|
| copy to device/vr/vr_device_client_impl_unittest.cc
|
| index 300bf0dbfb960c8fc738333a2253a3fca33e7504..8e92ebd6cf5be78074d9a69397c0ace2513a185e 100644
|
| --- a/device/vr/vr_service_impl_unittest.cc
|
| +++ b/device/vr/vr_device_client_impl_unittest.cc
|
| @@ -2,7 +2,7 @@
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| -#include "device/vr/vr_service_impl.h"
|
| +/*#include "device/vr/vr_service_impl.h"
|
|
|
| #include "base/message_loop/message_loop.h"
|
| #include "base/run_loop.h"
|
| @@ -17,35 +17,33 @@ using ::testing::Mock;
|
|
|
| namespace device {
|
|
|
| -class MockVRServiceClient : public VRServiceClient {
|
| +class MockVRDisplayClient : public VRDisplayClient {
|
| public:
|
| - MOCK_METHOD1(OnDisplayChanged, void(const VRDisplay& display));
|
| + MOCK_METHOD1(RegisterDeviceClient, void(VRDeviceClientPtr& device_client));
|
| +
|
| + MOCK_METHOD1(UpdateDisplayInfo, void(const VRDisplayPtr& display));
|
| +
|
| + MOCK_METHOD1(OnDisplayChanged, void(const VRDisplayPtr& display));
|
| void OnDisplayChanged(VRDisplayPtr display) override {
|
| OnDisplayChanged(*display);
|
| last_display_ = std::move(display);
|
| }
|
|
|
| - MOCK_METHOD1(OnExitPresent, void(uint32_t index));
|
| + MOCK_METHOD0(OnExitPresent, void());
|
|
|
| - MOCK_METHOD1(OnDisplayConnected, void(const VRDisplay& display));
|
| - void OnDisplayConnected(VRDisplayPtr display) override {
|
| - OnDisplayConnected(*display);
|
| - last_display_ = std::move(display);
|
| - }
|
| - void OnDisplayDisconnected(unsigned index) override {}
|
| + MOCK_METHOD1(OnDisplayConnected, void(const VRDisplayPtr& display));
|
|
|
| - const VRDisplayPtr& LastDisplay() { return last_display_; }
|
| + MOCK_METHOD0(OnDisplayDisconnected, void());
|
|
|
| private:
|
| VRDisplayPtr last_display_;
|
| };
|
|
|
| -class VRServiceTestBinding {
|
| +class VRDeviceClientTestBinding {
|
| public:
|
| - VRServiceTestBinding() {
|
| - auto request = mojo::GetProxy(&service_ptr_);
|
| - service_impl_.reset(new VRServiceImpl());
|
| - service_impl_->Bind(std::move(request));
|
| + VRDeviceClientTestBinding(VRDevice* device, VRServiceImpl* service) {
|
| + auto request = mojo::GetProxy(&device_client_ptr_);
|
| + device_client_impl_.reset(new VRDeviceClientImpl(request, device, service));
|
|
|
| VRServiceClientPtr client_ptr;
|
| client_binding_.reset(new mojo::Binding<VRServiceClient>(
|
| @@ -54,19 +52,19 @@ class VRServiceTestBinding {
|
| }
|
|
|
| void Close() {
|
| - service_ptr_.reset();
|
| - service_impl_.reset();
|
| + device_client_ptr_.reset();
|
| + device_client_impl_.reset();
|
| }
|
|
|
| MockVRServiceClient& client() { return mock_client_; }
|
| VRServiceImpl* service() { return service_impl_.get(); }
|
|
|
| private:
|
| - std::unique_ptr<VRServiceImpl> service_impl_;
|
| - mojo::InterfacePtr<VRService> service_ptr_;
|
| + std::unique_ptr<VRDeviceClientImpl> device_client_impl_;
|
| + mojo::InterfacePtr<VRDeviceClient> device_client_ptr_;
|
|
|
| - MockVRServiceClient mock_client_;
|
| - std::unique_ptr<mojo::Binding<VRServiceClient>> client_binding_;
|
| + MockVRDisplayClient mock_client_;
|
| + std::unique_ptr<mojo::Binding<VRDisplayClient>> client_binding_;
|
|
|
| DISALLOW_COPY_AND_ASSIGN(VRServiceTestBinding);
|
| };
|
| @@ -91,8 +89,6 @@ class VRServiceImplTest : public testing::Test {
|
|
|
| size_t ServiceCount() { return device_manager_->services_.size(); }
|
|
|
| - bool presenting() { return !!device_manager_->presenting_service_; }
|
| -
|
| base::MessageLoop message_loop_;
|
| FakeVRDeviceProvider* provider_;
|
| std::unique_ptr<VRDeviceManager> device_manager_;
|
| @@ -100,28 +96,6 @@ class VRServiceImplTest : public testing::Test {
|
| DISALLOW_COPY_AND_ASSIGN(VRServiceImplTest);
|
| };
|
|
|
| -// Ensure that services are registered with the device manager as they are
|
| -// created and removed from the device manager as their connections are closed.
|
| -TEST_F(VRServiceImplTest, DeviceManagerRegistration) {
|
| - EXPECT_EQ(0u, ServiceCount());
|
| -
|
| - std::unique_ptr<VRServiceTestBinding> service_1 = BindService();
|
| -
|
| - EXPECT_EQ(1u, ServiceCount());
|
| -
|
| - std::unique_ptr<VRServiceTestBinding> service_2 = BindService();
|
| -
|
| - EXPECT_EQ(2u, ServiceCount());
|
| -
|
| - service_1->Close();
|
| -
|
| - EXPECT_EQ(1u, ServiceCount());
|
| -
|
| - service_2->Close();
|
| -
|
| - EXPECT_EQ(0u, ServiceCount());
|
| -}
|
| -
|
| // Ensure that DeviceChanged calls are dispatched to all active services.
|
| TEST_F(VRServiceImplTest, DeviceChangedDispatched) {
|
| std::unique_ptr<VRServiceTestBinding> service_1 = BindService();
|
| @@ -204,4 +178,5 @@ TEST_F(VRServiceImplTest, DeviceConnectedDispatched) {
|
| EXPECT_EQ(device->id(), service_1->client().LastDisplay()->index);
|
| EXPECT_EQ(device->id(), service_2->client().LastDisplay()->index);
|
| }
|
| -}
|
| +
|
| +}*/
|
|
|