| 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 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 "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 219 message_pipe(1)->ReadMessage( | 219 message_pipe(1)->ReadMessage( |
| 220 0, UserPointer<void>(read_buffer), | 220 0, UserPointer<void>(read_buffer), |
| 221 MakeUserPointer(&read_buffer_size), &read_dispatchers, | 221 MakeUserPointer(&read_buffer_size), &read_dispatchers, |
| 222 &read_num_dispatchers, MOJO_READ_MESSAGE_FLAG_NONE)); | 222 &read_num_dispatchers, MOJO_READ_MESSAGE_FLAG_NONE)); |
| 223 EXPECT_EQ(0u, static_cast<size_t>(read_buffer_size)); | 223 EXPECT_EQ(0u, static_cast<size_t>(read_buffer_size)); |
| 224 EXPECT_EQ(1u, read_dispatchers.size()); | 224 EXPECT_EQ(1u, read_dispatchers.size()); |
| 225 EXPECT_EQ(1u, read_num_dispatchers); | 225 EXPECT_EQ(1u, read_num_dispatchers); |
| 226 ASSERT_TRUE(read_dispatchers[0]); | 226 ASSERT_TRUE(read_dispatchers[0]); |
| 227 EXPECT_TRUE(read_dispatchers[0]->HasOneRef()); | 227 EXPECT_TRUE(read_dispatchers[0]->HasOneRef()); |
| 228 | 228 |
| 229 EXPECT_EQ(Dispatcher::kTypeDataPipeConsumer, read_dispatchers[0]->GetType()); | 229 EXPECT_EQ(Dispatcher::Type::DATA_PIPE_CONSUMER, |
| 230 read_dispatchers[0]->GetType()); |
| 230 consumer = | 231 consumer = |
| 231 static_cast<DataPipeConsumerDispatcher*>(read_dispatchers[0].get()); | 232 static_cast<DataPipeConsumerDispatcher*>(read_dispatchers[0].get()); |
| 232 read_dispatchers.clear(); | 233 read_dispatchers.clear(); |
| 233 | 234 |
| 234 waiter.Init(); | 235 waiter.Init(); |
| 235 hss = HandleSignalsState(); | 236 hss = HandleSignalsState(); |
| 236 MojoResult result = | 237 MojoResult result = |
| 237 consumer->AddAwakable(&waiter, MOJO_HANDLE_SIGNAL_READABLE, 456, &hss); | 238 consumer->AddAwakable(&waiter, MOJO_HANDLE_SIGNAL_READABLE, 456, &hss); |
| 238 if (result == MOJO_RESULT_OK) { | 239 if (result == MOJO_RESULT_OK) { |
| 239 context = 0; | 240 context = 0; |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 273 } | 274 } |
| 274 EXPECT_EQ(MOJO_HANDLE_SIGNAL_PEER_CLOSED, hss.satisfied_signals); | 275 EXPECT_EQ(MOJO_HANDLE_SIGNAL_PEER_CLOSED, hss.satisfied_signals); |
| 275 EXPECT_EQ(MOJO_HANDLE_SIGNAL_PEER_CLOSED, hss.satisfiable_signals); | 276 EXPECT_EQ(MOJO_HANDLE_SIGNAL_PEER_CLOSED, hss.satisfiable_signals); |
| 276 | 277 |
| 277 consumer->Close(); | 278 consumer->Close(); |
| 278 } | 279 } |
| 279 | 280 |
| 280 } // namespace | 281 } // namespace |
| 281 } // namespace system | 282 } // namespace system |
| 282 } // namespace mojo | 283 } // namespace mojo |
| OLD | NEW |