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

Side by Side Diff: device/serial/serial_service_unittest.cc

Issue 646053002: Implement permission_broker for serial devices. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix device_unittests. Created 6 years, 2 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
« no previous file with comments | « device/serial/serial_service_impl.cc ('k') | device/serial/test_serial_io_handler.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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/message_loop/message_loop.h" 6 #include "base/message_loop/message_loop.h"
7 #include "base/run_loop.h" 7 #include "base/run_loop.h"
8 #include "device/serial/serial.mojom.h" 8 #include "device/serial/serial.mojom.h"
9 #include "device/serial/serial_service_impl.h" 9 #include "device/serial/serial_service_impl.h"
10 #include "device/serial/test_serial_io_handler.h" 10 #include "device/serial/test_serial_io_handler.h"
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 bool connected_; 106 bool connected_;
107 bool expecting_error_; 107 bool expecting_error_;
108 serial::ConnectionInfoPtr info_; 108 serial::ConnectionInfoPtr info_;
109 109
110 private: 110 private:
111 DISALLOW_COPY_AND_ASSIGN(SerialServiceTest); 111 DISALLOW_COPY_AND_ASSIGN(SerialServiceTest);
112 }; 112 };
113 113
114 TEST_F(SerialServiceTest, GetDevices) { 114 TEST_F(SerialServiceTest, GetDevices) {
115 mojo::InterfacePtr<serial::SerialService> service; 115 mojo::InterfacePtr<serial::SerialService> service;
116 SerialServiceImpl::Create(NULL, mojo::GetProxy(&service)); 116 SerialServiceImpl::Create(NULL, NULL, mojo::GetProxy(&service));
117 service.set_error_handler(this); 117 service.set_error_handler(this);
118 mojo::Array<serial::DeviceInfoPtr> result; 118 mojo::Array<serial::DeviceInfoPtr> result;
119 service->GetDevices( 119 service->GetDevices(
120 base::Bind(&SerialServiceTest::StoreDevices, base::Unretained(this))); 120 base::Bind(&SerialServiceTest::StoreDevices, base::Unretained(this)));
121 RunMessageLoop(); 121 RunMessageLoop();
122 122
123 // Because we're running on unknown hardware, only check that we received a 123 // Because we're running on unknown hardware, only check that we received a
124 // non-null result. 124 // non-null result.
125 EXPECT_TRUE(devices_); 125 EXPECT_TRUE(devices_);
126 } 126 }
127 127
128 TEST_F(SerialServiceTest, Connect) { 128 TEST_F(SerialServiceTest, Connect) {
129 RunConnectTest("device", true); 129 RunConnectTest("device", true);
130 } 130 }
131 131
132 TEST_F(SerialServiceTest, ConnectInvalidPath) { 132 TEST_F(SerialServiceTest, ConnectInvalidPath) {
133 RunConnectTest("invalid_path", false); 133 RunConnectTest("invalid_path", false);
134 } 134 }
135 135
136 TEST_F(SerialServiceTest, ConnectOpenFailed) { 136 TEST_F(SerialServiceTest, ConnectOpenFailed) {
137 io_handler_ = new FailToOpenIoHandler; 137 io_handler_ = new FailToOpenIoHandler;
138 RunConnectTest("device", false); 138 RunConnectTest("device", false);
139 } 139 }
140 140
141 } // namespace device 141 } // namespace device
OLDNEW
« no previous file with comments | « device/serial/serial_service_impl.cc ('k') | device/serial/test_serial_io_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698