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

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

Issue 1910233003: Implement a new child test helper for Android. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Inject main(). Created 4 years, 8 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 <stdint.h> 5 #include <stdint.h>
6 6
7 #include "base/memory/ref_counted.h" 7 #include "base/memory/ref_counted.h"
8 #include "mojo/edk/system/test_utils.h" 8 #include "mojo/edk/system/test_utils.h"
9 #include "mojo/edk/test/mojo_test_base.h" 9 #include "mojo/edk/test/mojo_test_base.h"
10 #include "mojo/public/c/system/core.h" 10 #include "mojo/public/c/system/core.h"
(...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after
460 for (size_t i = 0; i < kPingPongIterations; i++) { 460 for (size_t i = 0; i < kPingPongIterations; i++) {
461 WriteMessageWithHandles(h, "", p, kPingPongHandlesPerIteration); 461 WriteMessageWithHandles(h, "", p, kPingPongHandlesPerIteration);
462 ReadMessageWithHandles(h, p, kPingPongHandlesPerIteration); 462 ReadMessageWithHandles(h, p, kPingPongHandlesPerIteration);
463 } 463 }
464 WriteMessage(h, "quit", 4); 464 WriteMessage(h, "quit", 4);
465 END_CHILD() 465 END_CHILD()
466 for (size_t i = 0; i < kPingPongHandlesPerIteration; ++i) 466 for (size_t i = 0; i < kPingPongHandlesPerIteration; ++i)
467 MojoClose(p[i]); 467 MojoClose(p[i]);
468 } 468 }
469 469
470 #if defined(OS_ANDROID) 470 TEST_F(MessagePipeTest, SharedBufferHandlePingPong) {
471 // Android multi-process tests are not executing the new process. This is flaky.
472 #define MAYBE_SharedBufferHandlePingPong DISABLED_SharedBufferHandlePingPong
473 #else
474 #define MAYBE_SharedBufferHandlePingPong SharedBufferHandlePingPong
475 #endif
476 TEST_F(MessagePipeTest, MAYBE_SharedBufferHandlePingPong) {
477 MojoHandle buffers[kPingPongHandlesPerIteration]; 471 MojoHandle buffers[kPingPongHandlesPerIteration];
478 for (size_t i = 0; i <kPingPongHandlesPerIteration; ++i) 472 for (size_t i = 0; i <kPingPongHandlesPerIteration; ++i)
479 EXPECT_EQ(MOJO_RESULT_OK, MojoCreateSharedBuffer(nullptr, 1, &buffers[i])); 473 EXPECT_EQ(MOJO_RESULT_OK, MojoCreateSharedBuffer(nullptr, 1, &buffers[i]));
480 474
481 RUN_CHILD_ON_PIPE(HandlePingPong, h) 475 RUN_CHILD_ON_PIPE(HandlePingPong, h)
482 for (size_t i = 0; i < kPingPongIterations; i++) { 476 for (size_t i = 0; i < kPingPongIterations; i++) {
483 WriteMessageWithHandles(h, "", buffers, kPingPongHandlesPerIteration); 477 WriteMessageWithHandles(h, "", buffers, kPingPongHandlesPerIteration);
484 ReadMessageWithHandles(h, buffers, kPingPongHandlesPerIteration); 478 ReadMessageWithHandles(h, buffers, kPingPongHandlesPerIteration);
485 } 479 }
486 WriteMessage(h, "quit", 4); 480 WriteMessage(h, "quit", 4);
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
641 EXPECT_EQ(kTestMessage, ReadMessage(d)); 635 EXPECT_EQ(kTestMessage, ReadMessage(d));
642 EXPECT_EQ(MOJO_RESULT_OK, MojoWait(d, MOJO_HANDLE_SIGNAL_PEER_CLOSED, 636 EXPECT_EQ(MOJO_RESULT_OK, MojoWait(d, MOJO_HANDLE_SIGNAL_PEER_CLOSED,
643 MOJO_DEADLINE_INDEFINITE, nullptr)); 637 MOJO_DEADLINE_INDEFINITE, nullptr));
644 638
645 EXPECT_EQ(MOJO_RESULT_OK, MojoClose(d)); 639 EXPECT_EQ(MOJO_RESULT_OK, MojoClose(d));
646 } 640 }
647 641
648 } // namespace 642 } // namespace
649 } // namespace edk 643 } // namespace edk
650 } // namespace mojo 644 } // namespace mojo
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698