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

Side by Side Diff: device/usb/mojo/device_manager_impl_unittest.cc

Issue 2589663003: mojo:: Rename mojo::GetProxy() to mojo::MakeRequest() (Closed)
Patch Set: Rebase Created 4 years 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
« no previous file with comments | « device/usb/mojo/device_impl_unittest.cc ('k') | device/vr/vr_device_manager_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "device/usb/mojo/device_manager_impl.h" 5 #include "device/usb/mojo/device_manager_impl.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <memory> 9 #include <memory>
10 #include <set> 10 #include <set>
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 43
44 class USBDeviceManagerImplTest : public testing::Test { 44 class USBDeviceManagerImplTest : public testing::Test {
45 public: 45 public:
46 USBDeviceManagerImplTest() : message_loop_(new base::MessageLoop) {} 46 USBDeviceManagerImplTest() : message_loop_(new base::MessageLoop) {}
47 ~USBDeviceManagerImplTest() override {} 47 ~USBDeviceManagerImplTest() override {}
48 48
49 protected: 49 protected:
50 DeviceManagerPtr ConnectToDeviceManager() { 50 DeviceManagerPtr ConnectToDeviceManager() {
51 DeviceManagerPtr device_manager; 51 DeviceManagerPtr device_manager;
52 DeviceManagerImpl::Create(permission_provider_.GetWeakPtr(), 52 DeviceManagerImpl::Create(permission_provider_.GetWeakPtr(),
53 mojo::GetProxy(&device_manager)); 53 mojo::MakeRequest(&device_manager));
54 return device_manager; 54 return device_manager;
55 } 55 }
56 56
57 MockDeviceClient device_client_; 57 MockDeviceClient device_client_;
58 58
59 private: 59 private:
60 MockPermissionProvider permission_provider_; 60 MockPermissionProvider permission_provider_;
61 std::unique_ptr<base::MessageLoop> message_loop_; 61 std::unique_ptr<base::MessageLoop> message_loop_;
62 }; 62 };
63 63
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 scoped_refptr<MockUsbDevice> mock_device = 145 scoped_refptr<MockUsbDevice> mock_device =
146 new MockUsbDevice(0x1234, 0x5678, "ACME", "Frobinator", "ABCDEF"); 146 new MockUsbDevice(0x1234, 0x5678, "ACME", "Frobinator", "ABCDEF");
147 147
148 device_client_.usb_service()->AddDevice(mock_device); 148 device_client_.usb_service()->AddDevice(mock_device);
149 149
150 DeviceManagerPtr device_manager = ConnectToDeviceManager(); 150 DeviceManagerPtr device_manager = ConnectToDeviceManager();
151 151
152 { 152 {
153 base::RunLoop loop; 153 base::RunLoop loop;
154 DevicePtr device; 154 DevicePtr device;
155 device_manager->GetDevice(mock_device->guid(), mojo::GetProxy(&device)); 155 device_manager->GetDevice(mock_device->guid(), mojo::MakeRequest(&device));
156 device->GetDeviceInfo(base::Bind(&ExpectDeviceInfoAndThen, 156 device->GetDeviceInfo(base::Bind(&ExpectDeviceInfoAndThen,
157 mock_device->guid(), loop.QuitClosure())); 157 mock_device->guid(), loop.QuitClosure()));
158 loop.Run(); 158 loop.Run();
159 } 159 }
160 160
161 DevicePtr bad_device; 161 DevicePtr bad_device;
162 device_manager->GetDevice("not a real guid", mojo::GetProxy(&bad_device)); 162 device_manager->GetDevice("not a real guid", mojo::MakeRequest(&bad_device));
163 163
164 { 164 {
165 base::RunLoop loop; 165 base::RunLoop loop;
166 bad_device.set_connection_error_handler(loop.QuitClosure()); 166 bad_device.set_connection_error_handler(loop.QuitClosure());
167 loop.Run(); 167 loop.Run();
168 } 168 }
169 } 169 }
170 170
171 // Test requesting device enumeration updates with GetDeviceChanges. 171 // Test requesting device enumeration updates with GetDeviceChanges.
172 TEST_F(USBDeviceManagerImplTest, Client) { 172 TEST_F(USBDeviceManagerImplTest, Client) {
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 .WillOnce(ExpectGuidAndThen(device0->guid(), barrier)) 215 .WillOnce(ExpectGuidAndThen(device0->guid(), barrier))
216 .WillOnce(ExpectGuidAndThen(device2->guid(), barrier)); 216 .WillOnce(ExpectGuidAndThen(device2->guid(), barrier));
217 EXPECT_CALL(mock_client, DoOnDeviceAdded(_)) 217 EXPECT_CALL(mock_client, DoOnDeviceAdded(_))
218 .WillOnce(ExpectGuidAndThen(device3->guid(), barrier)); 218 .WillOnce(ExpectGuidAndThen(device3->guid(), barrier));
219 loop.Run(); 219 loop.Run();
220 } 220 }
221 } 221 }
222 222
223 } // namespace usb 223 } // namespace usb
224 } // namespace device 224 } // namespace device
OLDNEW
« no previous file with comments | « device/usb/mojo/device_impl_unittest.cc ('k') | device/vr/vr_device_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698