| OLD | NEW |
| 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 contains tests that are shared between different implementations of | 5 // This file contains tests that are shared between different implementations of |
| 6 // |DataPipeImpl|. | 6 // |DataPipeImpl|. |
| 7 | 7 |
| 8 #include "mojo/edk/system/data_pipe_impl.h" | 8 #include "mojo/edk/system/data_pipe_impl.h" |
| 9 | 9 |
| 10 #include <stdint.h> | 10 #include <stdint.h> |
| (...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 309 ASSERT_EQ(MOJO_RESULT_OK, | 309 ASSERT_EQ(MOJO_RESULT_OK, |
| 310 message_pipe(dest_i)->ReadMessage( | 310 message_pipe(dest_i)->ReadMessage( |
| 311 0, UserPointer<void>(read_buffer), | 311 0, UserPointer<void>(read_buffer), |
| 312 MakeUserPointer(&read_buffer_size), &read_handles, | 312 MakeUserPointer(&read_buffer_size), &read_handles, |
| 313 &read_num_handles, MOJO_READ_MESSAGE_FLAG_NONE)); | 313 &read_num_handles, MOJO_READ_MESSAGE_FLAG_NONE)); |
| 314 EXPECT_EQ(0u, static_cast<size_t>(read_buffer_size)); | 314 EXPECT_EQ(0u, static_cast<size_t>(read_buffer_size)); |
| 315 ASSERT_EQ(1u, read_handles.size()); | 315 ASSERT_EQ(1u, read_handles.size()); |
| 316 ASSERT_EQ(1u, read_num_handles); | 316 ASSERT_EQ(1u, read_num_handles); |
| 317 ASSERT_TRUE(read_handles[0]); | 317 ASSERT_TRUE(read_handles[0]); |
| 318 EXPECT_TRUE(read_handles[0].dispatcher->HasOneRef()); | 318 EXPECT_TRUE(read_handles[0].dispatcher->HasOneRef()); |
| 319 // TODO(vtl): Also check the rights here once they're actually preserved? | 319 EXPECT_EQ(handle_to_send.rights, read_handles[0].rights); |
| 320 | 320 |
| 321 *handle_to_receive = std::move(read_handles[0]); | 321 *handle_to_receive = std::move(read_handles[0]); |
| 322 } | 322 } |
| 323 | 323 |
| 324 RefPtr<MessagePipe> message_pipe(size_t i) { return message_pipes_[i]; } | 324 RefPtr<MessagePipe> message_pipe(size_t i) { return message_pipes_[i]; } |
| 325 RefPtr<DataPipe> dp() { return dp_; } | 325 RefPtr<DataPipe> dp() { return dp_; } |
| 326 | 326 |
| 327 private: | 327 private: |
| 328 void EnsureMessagePipeClosed(size_t i) { | 328 void EnsureMessagePipeClosed(size_t i) { |
| 329 if (!message_pipes_[i]) | 329 if (!message_pipes_[i]) |
| (...skipping 2615 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2945 &waiter, MOJO_HANDLE_SIGNAL_READ_THRESHOLD, 0, &hss)); | 2945 &waiter, MOJO_HANDLE_SIGNAL_READ_THRESHOLD, 0, &hss)); |
| 2946 EXPECT_EQ(MOJO_HANDLE_SIGNAL_PEER_CLOSED, hss.satisfied_signals); | 2946 EXPECT_EQ(MOJO_HANDLE_SIGNAL_PEER_CLOSED, hss.satisfied_signals); |
| 2947 EXPECT_EQ(MOJO_HANDLE_SIGNAL_PEER_CLOSED, hss.satisfiable_signals); | 2947 EXPECT_EQ(MOJO_HANDLE_SIGNAL_PEER_CLOSED, hss.satisfiable_signals); |
| 2948 | 2948 |
| 2949 this->ConsumerClose(); | 2949 this->ConsumerClose(); |
| 2950 } | 2950 } |
| 2951 | 2951 |
| 2952 } // namespace | 2952 } // namespace |
| 2953 } // namespace system | 2953 } // namespace system |
| 2954 } // namespace mojo | 2954 } // namespace mojo |
| OLD | NEW |