| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 <utility> |
| 6 |
| 5 #include "base/macros.h" | 7 #include "base/macros.h" |
| 6 #include "base/memory/linked_ptr.h" | 8 #include "base/memory/linked_ptr.h" |
| 7 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 8 #include "content/browser/vr/test/fake_vr_device.h" | 10 #include "content/browser/vr/test/fake_vr_device.h" |
| 9 #include "content/browser/vr/test/fake_vr_device_provider.h" | 11 #include "content/browser/vr/test/fake_vr_device_provider.h" |
| 10 #include "content/browser/vr/vr_device_manager.h" | 12 #include "content/browser/vr/vr_device_manager.h" |
| 11 #include "content/browser/vr/vr_device_provider.h" | 13 #include "content/browser/vr/vr_device_provider.h" |
| 12 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
| 13 | 15 |
| 14 namespace content { | 16 namespace content { |
| (...skipping 16 matching lines...) Expand all Loading... |
| 31 | 33 |
| 32 VRDeviceManagerTest::VRDeviceManagerTest() { | 34 VRDeviceManagerTest::VRDeviceManagerTest() { |
| 33 } | 35 } |
| 34 | 36 |
| 35 VRDeviceManagerTest::~VRDeviceManagerTest() { | 37 VRDeviceManagerTest::~VRDeviceManagerTest() { |
| 36 } | 38 } |
| 37 | 39 |
| 38 void VRDeviceManagerTest::SetUp() { | 40 void VRDeviceManagerTest::SetUp() { |
| 39 scoped_ptr<FakeVRDeviceProvider> provider(new FakeVRDeviceProvider()); | 41 scoped_ptr<FakeVRDeviceProvider> provider(new FakeVRDeviceProvider()); |
| 40 provider_ = provider.get(); | 42 provider_ = provider.get(); |
| 41 device_manager_.reset(new VRDeviceManager(provider.Pass())); | 43 device_manager_.reset(new VRDeviceManager(std::move(provider))); |
| 42 } | 44 } |
| 43 | 45 |
| 44 TEST_F(VRDeviceManagerTest, InitializationTest) { | 46 TEST_F(VRDeviceManagerTest, InitializationTest) { |
| 45 EXPECT_FALSE(provider_->IsInitialized()); | 47 EXPECT_FALSE(provider_->IsInitialized()); |
| 46 | 48 |
| 47 // Calling GetDevices should initialize the service if it hasn't been | 49 // Calling GetDevices should initialize the service if it hasn't been |
| 48 // initialized yet or the providesr have been released. | 50 // initialized yet or the providesr have been released. |
| 49 // The VRService should initialize each of it's providers upon it's own | 51 // The VRService should initialize each of it's providers upon it's own |
| 50 // initialization. | 52 // initialization. |
| 51 mojo::Array<VRDeviceInfoPtr> webvr_devices; | 53 mojo::Array<VRDeviceInfoPtr> webvr_devices; |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 | 90 |
| 89 provider_->RemoveDevice(device1.get()); | 91 provider_->RemoveDevice(device1.get()); |
| 90 webvr_devices = device_manager_->GetVRDevices(); | 92 webvr_devices = device_manager_->GetVRDevices(); |
| 91 // Should have successfully returned one device. | 93 // Should have successfully returned one device. |
| 92 EXPECT_EQ(1u, webvr_devices.size()); | 94 EXPECT_EQ(1u, webvr_devices.size()); |
| 93 // The WebVRDevice index should match the only remaining device id. | 95 // The WebVRDevice index should match the only remaining device id. |
| 94 EXPECT_EQ(webvr_devices[0]->index, device2->id()); | 96 EXPECT_EQ(webvr_devices[0]->index, device2->id()); |
| 95 } | 97 } |
| 96 | 98 |
| 97 } // namespace content | 99 } // namespace content |
| OLD | NEW |