OLD | NEW |
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 "base/memory/ref_counted.h" | 5 #include "base/memory/ref_counted.h" |
6 #include "mojo/edk/system/test_utils.h" | 6 #include "mojo/edk/system/test_utils.h" |
7 #include "mojo/public/c/system/core.h" | 7 #include "mojo/public/c/system/core.h" |
8 #include "mojo/public/c/system/types.h" | 8 #include "mojo/public/c/system/types.h" |
9 | 9 |
10 namespace mojo { | 10 namespace mojo { |
11 namespace edk { | 11 namespace edk { |
12 namespace { | 12 namespace { |
13 | 13 |
14 const MojoHandleSignals kAllSignals = MOJO_HANDLE_SIGNAL_READABLE | | 14 const MojoHandleSignals kAllSignals = MOJO_HANDLE_SIGNAL_READABLE | |
15 MOJO_HANDLE_SIGNAL_WRITABLE | | 15 MOJO_HANDLE_SIGNAL_WRITABLE | |
16 MOJO_HANDLE_SIGNAL_PEER_CLOSED; | 16 MOJO_HANDLE_SIGNAL_PEER_CLOSED; |
17 static const char kHelloWorld[] = "hello world"; | 17 static const char kHelloWorld[] = "hello world"; |
18 | 18 |
19 class MessagePipeTest : public test::MojoSystemTest { | 19 class MessagePipeTest : public testing::Test { |
20 public: | 20 public: |
21 MessagePipeTest() { | 21 MessagePipeTest() { |
22 CHECK_EQ(MOJO_RESULT_OK, MojoCreateMessagePipe(nullptr, &pipe0_, &pipe1_)); | 22 CHECK_EQ(MOJO_RESULT_OK, MojoCreateMessagePipe(nullptr, &pipe0_, &pipe1_)); |
23 } | 23 } |
24 | 24 |
25 ~MessagePipeTest() override { | 25 ~MessagePipeTest() override { |
26 if (pipe0_ != MOJO_HANDLE_INVALID) | 26 if (pipe0_ != MOJO_HANDLE_INVALID) |
27 CHECK_EQ(MOJO_RESULT_OK, MojoClose(pipe0_)); | 27 CHECK_EQ(MOJO_RESULT_OK, MojoClose(pipe0_)); |
28 if (pipe1_ != MOJO_HANDLE_INVALID) | 28 if (pipe1_ != MOJO_HANDLE_INVALID) |
29 CHECK_EQ(MOJO_RESULT_OK, MojoClose(pipe1_)); | 29 CHECK_EQ(MOJO_RESULT_OK, MojoClose(pipe1_)); |
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
400 ASSERT_EQ(MOJO_RESULT_FAILED_PRECONDITION, | 400 ASSERT_EQ(MOJO_RESULT_FAILED_PRECONDITION, |
401 MojoWait(pipe1_, MOJO_HANDLE_SIGNAL_READABLE, | 401 MojoWait(pipe1_, MOJO_HANDLE_SIGNAL_READABLE, |
402 MOJO_DEADLINE_INDEFINITE, &hss)); | 402 MOJO_DEADLINE_INDEFINITE, &hss)); |
403 ASSERT_EQ(MOJO_HANDLE_SIGNAL_PEER_CLOSED, hss.satisfied_signals); | 403 ASSERT_EQ(MOJO_HANDLE_SIGNAL_PEER_CLOSED, hss.satisfied_signals); |
404 ASSERT_EQ(MOJO_HANDLE_SIGNAL_PEER_CLOSED, hss.satisfiable_signals); | 404 ASSERT_EQ(MOJO_HANDLE_SIGNAL_PEER_CLOSED, hss.satisfiable_signals); |
405 } | 405 } |
406 | 406 |
407 } // namespace | 407 } // namespace |
408 } // namespace edk | 408 } // namespace edk |
409 } // namespace mojo | 409 } // namespace mojo |
OLD | NEW |