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

Side by Side Diff: mojo/edk/embedder/embedder_unittest.cc

Issue 1529303004: Convert Pass()→std::move() in mojo/edk/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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 | « mojo/edk/embedder/embedder.cc ('k') | mojo/edk/embedder/platform_channel_pair.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 "mojo/edk/embedder/embedder.h" 5 #include "mojo/edk/embedder/embedder.h"
6 6
7 #include <utility>
8
7 #include "base/bind.h" 9 #include "base/bind.h"
8 #include "base/command_line.h" 10 #include "base/command_line.h"
9 #include "base/logging.h" 11 #include "base/logging.h"
10 #include "base/message_loop/message_loop.h" 12 #include "base/message_loop/message_loop.h"
11 #include "base/synchronization/waitable_event.h" 13 #include "base/synchronization/waitable_event.h"
12 #include "base/test/test_timeouts.h" 14 #include "base/test/test_timeouts.h"
13 #include "mojo/edk/embedder/embedder.h" 15 #include "mojo/edk/embedder/embedder.h"
14 #include "mojo/edk/embedder/platform_channel_pair.h" 16 #include "mojo/edk/embedder/platform_channel_pair.h"
15 #include "mojo/edk/embedder/simple_platform_support.h" 17 #include "mojo/edk/embedder/simple_platform_support.h"
16 #include "mojo/edk/embedder/test_embedder.h" 18 #include "mojo/edk/embedder/test_embedder.h"
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after
350 // Android multi-process tests are not executing the new process. This is flaky. 352 // Android multi-process tests are not executing the new process. This is flaky.
351 #define MAYBE_MultiprocessChannels DISABLED_MultiprocessChannels 353 #define MAYBE_MultiprocessChannels DISABLED_MultiprocessChannels
352 #else 354 #else
353 #define MAYBE_MultiprocessChannels MultiprocessChannels 355 #define MAYBE_MultiprocessChannels MultiprocessChannels
354 #endif // defined(OS_ANDROID) 356 #endif // defined(OS_ANDROID)
355 TEST_F(EmbedderTest, MAYBE_MultiprocessChannels) { 357 TEST_F(EmbedderTest, MAYBE_MultiprocessChannels) {
356 test::MultiprocessTestHelper multiprocess_test_helper; 358 test::MultiprocessTestHelper multiprocess_test_helper;
357 multiprocess_test_helper.StartChild("MultiprocessChannelsClient"); 359 multiprocess_test_helper.StartChild("MultiprocessChannelsClient");
358 360
359 { 361 {
360 MojoHandle server_mp = CreateMessagePipe( 362 MojoHandle server_mp =
361 multiprocess_test_helper.server_platform_handle.Pass()).release(). 363 CreateMessagePipe(
362 value(); 364 std::move(multiprocess_test_helper.server_platform_handle))
365 .release()
366 .value();
363 367
364 // 1. Write a message to |server_mp| (attaching nothing). 368 // 1. Write a message to |server_mp| (attaching nothing).
365 const char kHello[] = "hello"; 369 const char kHello[] = "hello";
366 ASSERT_EQ(MOJO_RESULT_OK, 370 ASSERT_EQ(MOJO_RESULT_OK,
367 MojoWriteMessage(server_mp, kHello, 371 MojoWriteMessage(server_mp, kHello,
368 static_cast<uint32_t>(sizeof(kHello)), nullptr, 372 static_cast<uint32_t>(sizeof(kHello)), nullptr,
369 0, MOJO_WRITE_MESSAGE_FLAG_NONE)); 373 0, MOJO_WRITE_MESSAGE_FLAG_NONE));
370 374
371 // TODO(vtl): If the scope were ended immediately here (maybe after closing 375 // TODO(vtl): If the scope were ended immediately here (maybe after closing
372 // |server_mp|), we die with a fatal error in |Channel::HandleLocalError()|. 376 // |server_mp|), we die with a fatal error in |Channel::HandleLocalError()|.
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
458 ASSERT_EQ(MOJO_HANDLE_SIGNAL_NONE, state.satisfiable_signals); 462 ASSERT_EQ(MOJO_HANDLE_SIGNAL_NONE, state.satisfiable_signals);
459 #endif 463 #endif
460 ASSERT_EQ(MOJO_RESULT_OK, MojoClose(mp2)); 464 ASSERT_EQ(MOJO_RESULT_OK, MojoClose(mp2));
461 } 465 }
462 466
463 EXPECT_TRUE(multiprocess_test_helper.WaitForChildTestShutdown()); 467 EXPECT_TRUE(multiprocess_test_helper.WaitForChildTestShutdown());
464 } 468 }
465 469
466 MOJO_MULTIPROCESS_TEST_CHILD_TEST(MultiprocessChannelsClient) { 470 MOJO_MULTIPROCESS_TEST_CHILD_TEST(MultiprocessChannelsClient) {
467 ScopedPlatformHandle client_platform_handle = 471 ScopedPlatformHandle client_platform_handle =
468 test::MultiprocessTestHelper::client_platform_handle.Pass(); 472 std::move(test::MultiprocessTestHelper::client_platform_handle);
469 EXPECT_TRUE(client_platform_handle.is_valid()); 473 EXPECT_TRUE(client_platform_handle.is_valid());
470 474
471 MojoHandle client_mp = CreateMessagePipe( 475 MojoHandle client_mp =
472 client_platform_handle.Pass()).release().value(); 476 CreateMessagePipe(std::move(client_platform_handle)).release().value();
473 477
474 // 1. Read the first message from |client_mp|. 478 // 1. Read the first message from |client_mp|.
475 MojoHandleSignalsState state; 479 MojoHandleSignalsState state;
476 ASSERT_EQ(MOJO_RESULT_OK, MojoWait(client_mp, MOJO_HANDLE_SIGNAL_READABLE, 480 ASSERT_EQ(MOJO_RESULT_OK, MojoWait(client_mp, MOJO_HANDLE_SIGNAL_READABLE,
477 MOJO_DEADLINE_INDEFINITE, &state)); 481 MOJO_DEADLINE_INDEFINITE, &state));
478 ASSERT_EQ(kSignalReadadableWritable, state.satisfied_signals); 482 ASSERT_EQ(kSignalReadadableWritable, state.satisfied_signals);
479 ASSERT_EQ(kSignalAll, state.satisfiable_signals); 483 ASSERT_EQ(kSignalAll, state.satisfiable_signals);
480 484
481 char buffer[1000] = {}; 485 char buffer[1000] = {};
482 uint32_t num_bytes = static_cast<uint32_t>(sizeof(buffer)); 486 uint32_t num_bytes = static_cast<uint32_t>(sizeof(buffer));
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
567 ASSERT_EQ(MOJO_HANDLE_SIGNAL_PEER_CLOSED, state.satisfiable_signals); 571 ASSERT_EQ(MOJO_HANDLE_SIGNAL_PEER_CLOSED, state.satisfiable_signals);
568 ASSERT_EQ(MOJO_RESULT_OK, MojoClose(mp1)); 572 ASSERT_EQ(MOJO_RESULT_OK, MojoClose(mp1));
569 } 573 }
570 574
571 // TODO(vtl): Test immediate write & close. 575 // TODO(vtl): Test immediate write & close.
572 // TODO(vtl): Test broken-connection cases. 576 // TODO(vtl): Test broken-connection cases.
573 577
574 } // namespace 578 } // namespace
575 } // namespace edk 579 } // namespace edk
576 } // namespace mojo 580 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/edk/embedder/embedder.cc ('k') | mojo/edk/embedder/platform_channel_pair.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698