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

Side by Side Diff: content/browser/vr/vr_device_manager_unittest.cc

Issue 1832813002: Add mojom module suffix in .mojom files in content. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address Tom's comment Created 4 years, 9 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 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> 5 #include <utility>
6 6
7 #include "base/macros.h" 7 #include "base/macros.h"
8 #include "base/memory/linked_ptr.h" 8 #include "base/memory/linked_ptr.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "content/browser/vr/test/fake_vr_device.h" 10 #include "content/browser/vr/test/fake_vr_device.h"
(...skipping 30 matching lines...) Expand all
41 scoped_ptr<FakeVRDeviceProvider> provider(new FakeVRDeviceProvider()); 41 scoped_ptr<FakeVRDeviceProvider> provider(new FakeVRDeviceProvider());
42 provider_ = provider.get(); 42 provider_ = provider.get();
43 device_manager_.reset(new VRDeviceManager(std::move(provider))); 43 device_manager_.reset(new VRDeviceManager(std::move(provider)));
44 } 44 }
45 45
46 TEST_F(VRDeviceManagerTest, InitializationTest) { 46 TEST_F(VRDeviceManagerTest, InitializationTest) {
47 EXPECT_FALSE(provider_->IsInitialized()); 47 EXPECT_FALSE(provider_->IsInitialized());
48 48
49 // Calling GetDevices should initialize the service if it hasn't been 49 // Calling GetDevices should initialize the service if it hasn't been
50 // initialized yet or the providesr have been released. 50 // initialized yet or the providesr have been released.
51 // The VRService should initialize each of it's providers upon it's own 51 // The mojom::VRService should initialize each of it's providers upon it's own
52 // initialization. 52 // initialization.
53 mojo::Array<VRDeviceInfoPtr> webvr_devices; 53 mojo::Array<mojom::VRDeviceInfoPtr> webvr_devices;
54 webvr_devices = device_manager_->GetVRDevices(); 54 webvr_devices = device_manager_->GetVRDevices();
55 EXPECT_TRUE(provider_->IsInitialized()); 55 EXPECT_TRUE(provider_->IsInitialized());
56 } 56 }
57 57
58 TEST_F(VRDeviceManagerTest, GetDevicesBasicTest) { 58 TEST_F(VRDeviceManagerTest, GetDevicesBasicTest) {
59 mojo::Array<VRDeviceInfoPtr> webvr_devices; 59 mojo::Array<mojom::VRDeviceInfoPtr> webvr_devices;
60 webvr_devices = device_manager_->GetVRDevices(); 60 webvr_devices = device_manager_->GetVRDevices();
61 // Calling GetVRDevices should initialize the providers. 61 // Calling GetVRDevices should initialize the providers.
62 EXPECT_TRUE(provider_->IsInitialized()); 62 EXPECT_TRUE(provider_->IsInitialized());
63 // Should successfully return zero devices when none are available. 63 // Should successfully return zero devices when none are available.
64 EXPECT_EQ(0u, webvr_devices.size()); 64 EXPECT_EQ(0u, webvr_devices.size());
65 65
66 // GetDeviceByIndex should return nullptr if an invalid index in queried. 66 // GetDeviceByIndex should return nullptr if an invalid index in queried.
67 VRDevice* queried_device = device_manager_->GetDevice(1); 67 VRDevice* queried_device = device_manager_->GetDevice(1);
68 EXPECT_EQ(nullptr, queried_device); 68 EXPECT_EQ(nullptr, queried_device);
69 69
(...skipping 20 matching lines...) Expand all
90 90
91 provider_->RemoveDevice(device1.get()); 91 provider_->RemoveDevice(device1.get());
92 webvr_devices = device_manager_->GetVRDevices(); 92 webvr_devices = device_manager_->GetVRDevices();
93 // Should have successfully returned one device. 93 // Should have successfully returned one device.
94 EXPECT_EQ(1u, webvr_devices.size()); 94 EXPECT_EQ(1u, webvr_devices.size());
95 // The WebVRDevice index should match the only remaining device id. 95 // The WebVRDevice index should match the only remaining device id.
96 EXPECT_EQ(webvr_devices[0]->index, device2->id()); 96 EXPECT_EQ(webvr_devices[0]->index, device2->id());
97 } 97 }
98 98
99 } // namespace content 99 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/vr/vr_device_manager.cc ('k') | content/browser/wake_lock/wake_lock_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698