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

Side by Side Diff: mojo/edk/system/remote_data_pipe_impl_unittest.cc

Issue 1947733002: EDK: Rename DispatcherTransport to HandleTransport. (Closed) Base URL: https://github.com/domokit/mojo.git@work790_edk_handle_11-x-work788_edk_handle_10
Patch Set: Created 4 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
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 // This file tests both |RemoteProducerDataPipeImpl| and 5 // This file tests both |RemoteProducerDataPipeImpl| and
6 // |RemoteConsumerDataPipeImpl|. 6 // |RemoteConsumerDataPipeImpl|.
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory> 10 #include <memory>
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 dp->ProducerClose(); 191 dp->ProducerClose();
192 192
193 // Write the consumer to MP 0 (port 0). Wait and receive on MP 1 (port 0). 193 // Write the consumer to MP 0 (port 0). Wait and receive on MP 1 (port 0).
194 // (Add the waiter first, to avoid any handling the case where it's already 194 // (Add the waiter first, to avoid any handling the case where it's already
195 // readable.) 195 // readable.)
196 waiter.Init(); 196 waiter.Init();
197 ASSERT_EQ(MOJO_RESULT_OK, 197 ASSERT_EQ(MOJO_RESULT_OK,
198 message_pipe(1)->AddAwakable( 198 message_pipe(1)->AddAwakable(
199 0, &waiter, MOJO_HANDLE_SIGNAL_READABLE, 123, nullptr)); 199 0, &waiter, MOJO_HANDLE_SIGNAL_READABLE, 123, nullptr));
200 { 200 {
201 DispatcherTransport transport( 201 HandleTransport transport(test::HandleTryStartTransport(consumer_handle));
202 test::HandleTryStartTransport(consumer_handle));
203 EXPECT_TRUE(transport.is_valid()); 202 EXPECT_TRUE(transport.is_valid());
204 203
205 std::vector<DispatcherTransport> transports; 204 std::vector<HandleTransport> transports;
206 transports.push_back(transport); 205 transports.push_back(transport);
207 EXPECT_EQ(MOJO_RESULT_OK, message_pipe(0)->WriteMessage( 206 EXPECT_EQ(MOJO_RESULT_OK, message_pipe(0)->WriteMessage(
208 0, NullUserPointer(), 0, &transports, 207 0, NullUserPointer(), 0, &transports,
209 MOJO_WRITE_MESSAGE_FLAG_NONE)); 208 MOJO_WRITE_MESSAGE_FLAG_NONE));
210 transport.End(); 209 transport.End();
211 210
212 // |consumer_handle.dispatcher| should have been closed. This is 211 // |consumer_handle.dispatcher| should have been closed. This is
213 // |DCHECK()|ed when it is destroyed. 212 // |DCHECK()|ed when it is destroyed.
214 EXPECT_TRUE(consumer_handle.dispatcher->HasOneRef()); 213 EXPECT_TRUE(consumer_handle.dispatcher->HasOneRef());
215 consumer_handle.reset(); 214 consumer_handle.reset();
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
313 ASSERT_GE(num_bytes, 1u * sizeof(int32_t)); 312 ASSERT_GE(num_bytes, 1u * sizeof(int32_t));
314 313
315 // Write the consumer to MP 0 (port 0). Wait and receive on MP 1 (port 0). 314 // Write the consumer to MP 0 (port 0). Wait and receive on MP 1 (port 0).
316 // (Add the waiter first, to avoid any handling the case where it's already 315 // (Add the waiter first, to avoid any handling the case where it's already
317 // readable.) 316 // readable.)
318 waiter.Init(); 317 waiter.Init();
319 ASSERT_EQ(MOJO_RESULT_OK, 318 ASSERT_EQ(MOJO_RESULT_OK,
320 message_pipe(1)->AddAwakable( 319 message_pipe(1)->AddAwakable(
321 0, &waiter, MOJO_HANDLE_SIGNAL_READABLE, 123, nullptr)); 320 0, &waiter, MOJO_HANDLE_SIGNAL_READABLE, 123, nullptr));
322 { 321 {
323 DispatcherTransport transport( 322 HandleTransport transport(test::HandleTryStartTransport(consumer_handle));
324 test::HandleTryStartTransport(consumer_handle));
325 EXPECT_TRUE(transport.is_valid()); 323 EXPECT_TRUE(transport.is_valid());
326 324
327 std::vector<DispatcherTransport> transports; 325 std::vector<HandleTransport> transports;
328 transports.push_back(transport); 326 transports.push_back(transport);
329 EXPECT_EQ(MOJO_RESULT_OK, message_pipe(0)->WriteMessage( 327 EXPECT_EQ(MOJO_RESULT_OK, message_pipe(0)->WriteMessage(
330 0, NullUserPointer(), 0, &transports, 328 0, NullUserPointer(), 0, &transports,
331 MOJO_WRITE_MESSAGE_FLAG_NONE)); 329 MOJO_WRITE_MESSAGE_FLAG_NONE));
332 transport.End(); 330 transport.End();
333 331
334 // |consumer_handle.dispatcher| should have been closed. This is 332 // |consumer_handle.dispatcher| should have been closed. This is
335 // |DCHECK()|ed when it is destroyed. 333 // |DCHECK()|ed when it is destroyed.
336 EXPECT_TRUE(consumer_handle.dispatcher->HasOneRef()); 334 EXPECT_TRUE(consumer_handle.dispatcher->HasOneRef());
337 consumer_handle.reset(); 335 consumer_handle.reset();
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
439 ASSERT_GE(num_bytes, 1u * sizeof(int32_t)); 437 ASSERT_GE(num_bytes, 1u * sizeof(int32_t));
440 438
441 // Write the consumer to MP 0 (port 0). Wait and receive on MP 1 (port 0). 439 // Write the consumer to MP 0 (port 0). Wait and receive on MP 1 (port 0).
442 // (Add the waiter first, to avoid any handling the case where it's already 440 // (Add the waiter first, to avoid any handling the case where it's already
443 // readable.) 441 // readable.)
444 waiter.Init(); 442 waiter.Init();
445 ASSERT_EQ(MOJO_RESULT_OK, 443 ASSERT_EQ(MOJO_RESULT_OK,
446 message_pipe(1)->AddAwakable( 444 message_pipe(1)->AddAwakable(
447 0, &waiter, MOJO_HANDLE_SIGNAL_READABLE, 123, nullptr)); 445 0, &waiter, MOJO_HANDLE_SIGNAL_READABLE, 123, nullptr));
448 { 446 {
449 DispatcherTransport transport( 447 HandleTransport transport(test::HandleTryStartTransport(consumer_handle));
450 test::HandleTryStartTransport(consumer_handle));
451 EXPECT_TRUE(transport.is_valid()); 448 EXPECT_TRUE(transport.is_valid());
452 449
453 std::vector<DispatcherTransport> transports; 450 std::vector<HandleTransport> transports;
454 transports.push_back(transport); 451 transports.push_back(transport);
455 EXPECT_EQ(MOJO_RESULT_OK, message_pipe(0)->WriteMessage( 452 EXPECT_EQ(MOJO_RESULT_OK, message_pipe(0)->WriteMessage(
456 0, NullUserPointer(), 0, &transports, 453 0, NullUserPointer(), 0, &transports,
457 MOJO_WRITE_MESSAGE_FLAG_NONE)); 454 MOJO_WRITE_MESSAGE_FLAG_NONE));
458 transport.End(); 455 transport.End();
459 456
460 // |consumer_handle.dispatcher| should have been closed. This is 457 // |consumer_handle.dispatcher| should have been closed. This is
461 // |DCHECK()|ed when it is destroyed. 458 // |DCHECK()|ed when it is destroyed.
462 EXPECT_TRUE(consumer_handle.dispatcher->HasOneRef()); 459 EXPECT_TRUE(consumer_handle.dispatcher->HasOneRef());
463 consumer_handle.reset(); 460 consumer_handle.reset();
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
525 EXPECT_EQ(123456, elements[0]); 522 EXPECT_EQ(123456, elements[0]);
526 EXPECT_EQ(789012, elements[1]); 523 EXPECT_EQ(789012, elements[1]);
527 EXPECT_EQ(0, elements[2]); 524 EXPECT_EQ(0, elements[2]);
528 525
529 consumer->Close(); 526 consumer->Close();
530 } 527 }
531 528
532 } // namespace 529 } // namespace
533 } // namespace system 530 } // namespace system
534 } // namespace mojo 531 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/edk/system/platform_handle_dispatcher_unittest.cc ('k') | mojo/edk/system/remote_message_pipe_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698