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

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

Issue 628873002: replace OVERRIDE and FINAL with override and final in device/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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_connection.h ('k') | device/serial/serial_device_enumerator_linux.h » ('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 <string> 5 #include <string>
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "base/run_loop.h" 9 #include "base/run_loop.h"
10 #include "base/strings/string_piece.h" 10 #include "base/strings/string_piece.h"
11 #include "device/serial/data_receiver.h" 11 #include "device/serial/data_receiver.h"
12 #include "device/serial/data_sender.h" 12 #include "device/serial/data_sender.h"
13 #include "device/serial/data_stream.mojom.h" 13 #include "device/serial/data_stream.mojom.h"
14 #include "device/serial/serial.mojom.h" 14 #include "device/serial/serial.mojom.h"
15 #include "device/serial/serial_connection.h" 15 #include "device/serial/serial_connection.h"
16 #include "device/serial/serial_service_impl.h" 16 #include "device/serial/serial_service_impl.h"
17 #include "device/serial/test_serial_io_handler.h" 17 #include "device/serial/test_serial_io_handler.h"
18 #include "mojo/public/cpp/bindings/error_handler.h" 18 #include "mojo/public/cpp/bindings/error_handler.h"
19 #include "mojo/public/cpp/bindings/interface_ptr.h" 19 #include "mojo/public/cpp/bindings/interface_ptr.h"
20 #include "mojo/public/cpp/bindings/interface_request.h" 20 #include "mojo/public/cpp/bindings/interface_request.h"
21 #include "testing/gtest/include/gtest/gtest.h" 21 #include "testing/gtest/include/gtest/gtest.h"
22 22
23 namespace device { 23 namespace device {
24 namespace { 24 namespace {
25 25
26 class FakeSerialDeviceEnumerator : public SerialDeviceEnumerator { 26 class FakeSerialDeviceEnumerator : public SerialDeviceEnumerator {
27 virtual mojo::Array<serial::DeviceInfoPtr> GetDevices() OVERRIDE { 27 virtual mojo::Array<serial::DeviceInfoPtr> GetDevices() override {
28 mojo::Array<serial::DeviceInfoPtr> devices(1); 28 mojo::Array<serial::DeviceInfoPtr> devices(1);
29 devices[0] = serial::DeviceInfo::New(); 29 devices[0] = serial::DeviceInfo::New();
30 devices[0]->path = "device"; 30 devices[0]->path = "device";
31 return devices.Pass(); 31 return devices.Pass();
32 } 32 }
33 }; 33 };
34 34
35 } // namespace 35 } // namespace
36 36
37 class SerialConnectionTest : public testing::Test, public mojo::ErrorHandler { 37 class SerialConnectionTest : public testing::Test, public mojo::ErrorHandler {
(...skipping 17 matching lines...) Expand all
55 static const uint32_t kBufferSize; 55 static const uint32_t kBufferSize;
56 56
57 SerialConnectionTest() 57 SerialConnectionTest()
58 : connected_(false), 58 : connected_(false),
59 success_(false), 59 success_(false),
60 bytes_sent_(0), 60 bytes_sent_(0),
61 send_error_(serial::SEND_ERROR_NONE), 61 send_error_(serial::SEND_ERROR_NONE),
62 receive_error_(serial::RECEIVE_ERROR_NONE), 62 receive_error_(serial::RECEIVE_ERROR_NONE),
63 expected_event_(EVENT_NONE) {} 63 expected_event_(EVENT_NONE) {}
64 64
65 virtual void SetUp() OVERRIDE { 65 virtual void SetUp() override {
66 message_loop_.reset(new base::MessageLoop); 66 message_loop_.reset(new base::MessageLoop);
67 mojo::InterfacePtr<serial::SerialService> service; 67 mojo::InterfacePtr<serial::SerialService> service;
68 mojo::BindToProxy( 68 mojo::BindToProxy(
69 new SerialServiceImpl( 69 new SerialServiceImpl(
70 new SerialConnectionFactory( 70 new SerialConnectionFactory(
71 base::Bind(&SerialConnectionTest::CreateIoHandler, 71 base::Bind(&SerialConnectionTest::CreateIoHandler,
72 base::Unretained(this)), 72 base::Unretained(this)),
73 base::MessageLoopProxy::current()), 73 base::MessageLoopProxy::current()),
74 scoped_ptr<SerialDeviceEnumerator>(new FakeSerialDeviceEnumerator)), 74 scoped_ptr<SerialDeviceEnumerator>(new FakeSerialDeviceEnumerator)),
75 &service); 75 &service);
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 buffer->Done(buffer->GetSize()); 161 buffer->Done(buffer->GetSize());
162 receive_error_ = serial::RECEIVE_ERROR_NONE; 162 receive_error_ = serial::RECEIVE_ERROR_NONE;
163 EventReceived(EVENT_DATA_RECEIVED); 163 EventReceived(EVENT_DATA_RECEIVED);
164 } 164 }
165 165
166 void OnReceiveError(int32_t error) { 166 void OnReceiveError(int32_t error) {
167 receive_error_ = static_cast<serial::ReceiveError>(error); 167 receive_error_ = static_cast<serial::ReceiveError>(error);
168 EventReceived(EVENT_RECEIVE_ERROR); 168 EventReceived(EVENT_RECEIVE_ERROR);
169 } 169 }
170 170
171 virtual void OnConnectionError() OVERRIDE { 171 virtual void OnConnectionError() override {
172 EventReceived(EVENT_ERROR); 172 EventReceived(EVENT_ERROR);
173 FAIL() << "Connection error"; 173 FAIL() << "Connection error";
174 } 174 }
175 175
176 mojo::Array<serial::DeviceInfoPtr> devices_; 176 mojo::Array<serial::DeviceInfoPtr> devices_;
177 serial::ConnectionInfoPtr info_; 177 serial::ConnectionInfoPtr info_;
178 serial::DeviceControlSignalsPtr signals_; 178 serial::DeviceControlSignalsPtr signals_;
179 bool connected_; 179 bool connected_;
180 bool success_; 180 bool success_;
181 int bytes_sent_; 181 int bytes_sent_;
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
318 WaitForEvent(EVENT_DATA_SENT); 318 WaitForEvent(EVENT_DATA_SENT);
319 EXPECT_EQ(serial::SEND_ERROR_NONE, send_error_); 319 EXPECT_EQ(serial::SEND_ERROR_NONE, send_error_);
320 EXPECT_EQ(4, bytes_sent_); 320 EXPECT_EQ(4, bytes_sent_);
321 ASSERT_NO_FATAL_FAILURE(Receive()); 321 ASSERT_NO_FATAL_FAILURE(Receive());
322 WaitForEvent(EVENT_DATA_RECEIVED); 322 WaitForEvent(EVENT_DATA_RECEIVED);
323 EXPECT_EQ("data", data_received_); 323 EXPECT_EQ("data", data_received_);
324 EXPECT_EQ(serial::RECEIVE_ERROR_NONE, receive_error_); 324 EXPECT_EQ(serial::RECEIVE_ERROR_NONE, receive_error_);
325 } 325 }
326 326
327 } // namespace device 327 } // namespace device
OLDNEW
« no previous file with comments | « device/serial/serial_connection.h ('k') | device/serial/serial_device_enumerator_linux.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698