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

Side by Side Diff: device/devices_app/devices_apptest.cc

Issue 1455833005: Convert ConnectToApplication to take a params class (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 5 years, 1 month 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 | « content/browser/mojo/mojo_shell_context.cc ('k') | mandoline/ui/desktop_ui/browser_apptest.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 "base/bind.h" 5 #include "base/bind.h"
6 #include "base/callback.h" 6 #include "base/callback.h"
7 #include "base/macros.h" 7 #include "base/macros.h"
8 #include "base/run_loop.h" 8 #include "base/run_loop.h"
9 #include "device/devices_app/devices_app.h" 9 #include "device/devices_app/devices_app.h"
10 #include "device/devices_app/usb/public/interfaces/device_manager.mojom.h" 10 #include "device/devices_app/usb/public/interfaces/device_manager.mojom.h"
11 #include "mojo/application/public/cpp/application_impl.h" 11 #include "mojo/application/public/cpp/application_impl.h"
12 #include "mojo/application/public/cpp/application_test_base.h" 12 #include "mojo/application/public/cpp/application_test_base.h"
13 13
14 namespace device { 14 namespace device {
15 namespace { 15 namespace {
16 16
17 class DevicesAppTest : public mojo::test::ApplicationTestBase { 17 class DevicesAppTest : public mojo::test::ApplicationTestBase {
18 public: 18 public:
19 DevicesAppTest() {} 19 DevicesAppTest() {}
20 ~DevicesAppTest() override {} 20 ~DevicesAppTest() override {}
21 21
22 void SetUp() override { 22 void SetUp() override {
23 ApplicationTestBase::SetUp(); 23 ApplicationTestBase::SetUp();
24 mojo::URLRequestPtr request = mojo::URLRequest::New(); 24 application_impl()->ConnectToService("mojo:devices", &usb_device_manager_);
25 request->url = "mojo:devices";
26 application_impl()->ConnectToService(request.Pass(), &usb_device_manager_);
27 } 25 }
28 26
29 usb::DeviceManager* usb_device_manager() { return usb_device_manager_.get(); } 27 usb::DeviceManager* usb_device_manager() { return usb_device_manager_.get(); }
30 28
31 private: 29 private:
32 usb::DeviceManagerPtr usb_device_manager_; 30 usb::DeviceManagerPtr usb_device_manager_;
33 31
34 DISALLOW_COPY_AND_ASSIGN(DevicesAppTest); 32 DISALLOW_COPY_AND_ASSIGN(DevicesAppTest);
35 }; 33 };
36 34
(...skipping 10 matching lines...) Expand all
47 base::RunLoop loop; 45 base::RunLoop loop;
48 usb::EnumerationOptionsPtr options = usb::EnumerationOptions::New(); 46 usb::EnumerationOptionsPtr options = usb::EnumerationOptions::New();
49 options->filters = mojo::Array<usb::DeviceFilterPtr>(1); 47 options->filters = mojo::Array<usb::DeviceFilterPtr>(1);
50 options->filters[0] = usb::DeviceFilter::New(); 48 options->filters[0] = usb::DeviceFilter::New();
51 usb_device_manager()->GetDevices( 49 usb_device_manager()->GetDevices(
52 options.Pass(), base::Bind(&OnGetDevices, loop.QuitClosure())); 50 options.Pass(), base::Bind(&OnGetDevices, loop.QuitClosure()));
53 loop.Run(); 51 loop.Run();
54 } 52 }
55 53
56 } // namespace device 54 } // namespace device
OLDNEW
« no previous file with comments | « content/browser/mojo/mojo_shell_context.cc ('k') | mandoline/ui/desktop_ui/browser_apptest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698