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

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

Issue 873293006: Revert of Remove Client= from device/serial/data_stream.mojom. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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/data_sink_receiver.cc ('k') | device/serial/data_source_sender.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 "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 "base/strings/string_piece.h" 8 #include "base/strings/string_piece.h"
9 #include "device/serial/data_sender.h" 9 #include "device/serial/data_sender.h"
10 #include "device/serial/data_sink_receiver.h" 10 #include "device/serial/data_sink_receiver.h"
(...skipping 20 matching lines...) Expand all
31 : bytes_sent_(0), 31 : bytes_sent_(0),
32 send_error_(0), 32 send_error_(0),
33 has_send_error_(false), 33 has_send_error_(false),
34 cancel_error_(0), 34 cancel_error_(0),
35 seen_connection_error_(false), 35 seen_connection_error_(false),
36 expected_event_(EVENT_NONE) {} 36 expected_event_(EVENT_NONE) {}
37 37
38 void SetUp() override { 38 void SetUp() override {
39 message_loop_.reset(new base::MessageLoop); 39 message_loop_.reset(new base::MessageLoop);
40 mojo::InterfacePtr<serial::DataSink> sink_handle; 40 mojo::InterfacePtr<serial::DataSink> sink_handle;
41 mojo::InterfacePtr<serial::DataSinkClient> sink_client_handle; 41 sink_receiver_ = mojo::WeakBindToProxy(
42 mojo::InterfaceRequest<serial::DataSinkClient> sink_client_request = 42 new DataSinkReceiver(
43 mojo::GetProxy(&sink_client_handle); 43 base::Bind(&DataSinkTest::OnDataToRead, base::Unretained(this)),
44 sink_receiver_ = new DataSinkReceiver( 44 base::Bind(&DataSinkTest::OnCancel, base::Unretained(this)),
45 mojo::GetProxy(&sink_handle), sink_client_handle.Pass(), 45 base::Bind(&DataSinkTest::OnError, base::Unretained(this))),
46 base::Bind(&DataSinkTest::OnDataToRead, base::Unretained(this)), 46 &sink_handle);
47 base::Bind(&DataSinkTest::OnCancel, base::Unretained(this)), 47 sender_.reset(new DataSender(sink_handle.Pass(), kBufferSize, kFatalError));
48 base::Bind(&DataSinkTest::OnError, base::Unretained(this)));
49 sender_.reset(new DataSender(sink_handle.Pass(), sink_client_request.Pass(),
50 kBufferSize, kFatalError));
51 } 48 }
52 49
53 void TearDown() override { 50 void TearDown() override {
54 read_buffer_.reset(); 51 read_buffer_.reset();
55 message_loop_.reset(); 52 message_loop_.reset();
56 if (sink_receiver_.get()) 53 if (sink_receiver_.get())
57 EXPECT_TRUE(sink_receiver_->HasOneRef()); 54 EXPECT_TRUE(sink_receiver_->HasOneRef());
58 } 55 }
59 56
60 void WaitForEvent(Event event) { 57 void WaitForEvent(Event event) {
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after
407 sender_.reset(); 404 sender_.reset();
408 ExpectSendError(0, kFatalError); 405 ExpectSendError(0, kFatalError);
409 ExpectSendError(0, kFatalError); 406 ExpectSendError(0, kFatalError);
410 ExpectCancelResult(); 407 ExpectCancelResult();
411 if (!seen_connection_error_) 408 if (!seen_connection_error_)
412 WaitForEvent(EVENT_ERROR); 409 WaitForEvent(EVENT_ERROR);
413 EXPECT_TRUE(seen_connection_error_); 410 EXPECT_TRUE(seen_connection_error_);
414 } 411 }
415 412
416 } // namespace device 413 } // namespace device
OLDNEW
« no previous file with comments | « device/serial/data_sink_receiver.cc ('k') | device/serial/data_source_sender.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698