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

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

Issue 1143013002: Remove mojo::InterfaceImpl from device/serial. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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_factory.cc ('k') | device/serial/serial_service_impl.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"
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 void SetUp() override { 65 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 new SerialServiceImpl(
69 new SerialServiceImpl( 69 new SerialConnectionFactory(
70 new SerialConnectionFactory( 70 base::Bind(&SerialConnectionTest::CreateIoHandler,
71 base::Bind(&SerialConnectionTest::CreateIoHandler, 71 base::Unretained(this)),
72 base::Unretained(this)), 72 base::ThreadTaskRunnerHandle::Get()),
73 base::ThreadTaskRunnerHandle::Get()), 73 scoped_ptr<SerialDeviceEnumerator>(new FakeSerialDeviceEnumerator),
74 scoped_ptr<SerialDeviceEnumerator>(new FakeSerialDeviceEnumerator)), 74 mojo::GetProxy(&service));
75 &service);
76 service.set_error_handler(this); 75 service.set_error_handler(this);
77 mojo::InterfacePtr<serial::DataSink> sink; 76 mojo::InterfacePtr<serial::DataSink> sink;
78 mojo::InterfacePtr<serial::DataSource> source; 77 mojo::InterfacePtr<serial::DataSource> source;
79 mojo::InterfacePtr<serial::DataSourceClient> source_client; 78 mojo::InterfacePtr<serial::DataSourceClient> source_client;
80 mojo::InterfaceRequest<serial::DataSourceClient> source_client_request = 79 mojo::InterfaceRequest<serial::DataSourceClient> source_client_request =
81 mojo::GetProxy(&source_client); 80 mojo::GetProxy(&source_client);
82 service->Connect("device", serial::ConnectionOptions::New(), 81 service->Connect("device", serial::ConnectionOptions::New(),
83 mojo::GetProxy(&connection_), mojo::GetProxy(&sink), 82 mojo::GetProxy(&connection_), mojo::GetProxy(&sink),
84 mojo::GetProxy(&source), source_client.Pass()); 83 mojo::GetProxy(&source), source_client.Pass());
85 sender_.reset(new DataSender(sink.Pass(), kBufferSize, 84 sender_.reset(new DataSender(sink.Pass(), kBufferSize,
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 WaitForEvent(EVENT_DATA_SENT); 324 WaitForEvent(EVENT_DATA_SENT);
326 EXPECT_EQ(serial::SEND_ERROR_NONE, send_error_); 325 EXPECT_EQ(serial::SEND_ERROR_NONE, send_error_);
327 EXPECT_EQ(4, bytes_sent_); 326 EXPECT_EQ(4, bytes_sent_);
328 ASSERT_NO_FATAL_FAILURE(Receive()); 327 ASSERT_NO_FATAL_FAILURE(Receive());
329 WaitForEvent(EVENT_DATA_RECEIVED); 328 WaitForEvent(EVENT_DATA_RECEIVED);
330 EXPECT_EQ("data", data_received_); 329 EXPECT_EQ("data", data_received_);
331 EXPECT_EQ(serial::RECEIVE_ERROR_NONE, receive_error_); 330 EXPECT_EQ(serial::RECEIVE_ERROR_NONE, receive_error_);
332 } 331 }
333 332
334 } // namespace device 333 } // namespace device
OLDNEW
« no previous file with comments | « device/serial/serial_connection_factory.cc ('k') | device/serial/serial_service_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698