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 <set> | 5 #include <set> |
6 #include <string> | 6 #include <string> |
7 | 7 |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 | 51 |
52 protected: | 52 protected: |
53 MockUsbService& mock_usb_service() { | 53 MockUsbService& mock_usb_service() { |
54 return device_client_->mock_usb_service(); | 54 return device_client_->mock_usb_service(); |
55 } | 55 } |
56 | 56 |
57 DeviceManagerPtr ConnectToDeviceManager() { | 57 DeviceManagerPtr ConnectToDeviceManager() { |
58 PermissionProviderPtr permission_provider; | 58 PermissionProviderPtr permission_provider; |
59 permission_provider_.Bind(mojo::GetProxy(&permission_provider)); | 59 permission_provider_.Bind(mojo::GetProxy(&permission_provider)); |
60 DeviceManagerPtr device_manager; | 60 DeviceManagerPtr device_manager; |
61 new DeviceManagerImpl(mojo::GetProxy(&device_manager), | 61 DeviceManagerImpl::Create(permission_provider.Pass(), |
62 permission_provider.Pass(), | 62 mojo::GetProxy(&device_manager)); |
63 base::ThreadTaskRunnerHandle::Get()); | |
64 return device_manager.Pass(); | 63 return device_manager.Pass(); |
65 } | 64 } |
66 | 65 |
67 private: | 66 private: |
68 FakePermissionProvider permission_provider_; | 67 FakePermissionProvider permission_provider_; |
69 scoped_ptr<TestDeviceClient> device_client_; | 68 scoped_ptr<TestDeviceClient> device_client_; |
70 scoped_ptr<base::MessageLoop> message_loop_; | 69 scoped_ptr<base::MessageLoop> message_loop_; |
71 }; | 70 }; |
72 | 71 |
73 void ExpectDevicesAndThen(const std::set<std::string>& expected_guids, | 72 void ExpectDevicesAndThen(const std::set<std::string>& expected_guids, |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 base::RunLoop loop; | 225 base::RunLoop loop; |
227 device_manager->GetDeviceChanges(base::Bind(&ExpectDeviceChangesAndThen, | 226 device_manager->GetDeviceChanges(base::Bind(&ExpectDeviceChangesAndThen, |
228 added_guids, removed_guids, | 227 added_guids, removed_guids, |
229 loop.QuitClosure())); | 228 loop.QuitClosure())); |
230 loop.Run(); | 229 loop.Run(); |
231 } | 230 } |
232 } | 231 } |
233 | 232 |
234 } // namespace usb | 233 } // namespace usb |
235 } // namespace device | 234 } // namespace device |
OLD | NEW |