| 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 "mojo/edk/system/message_pipe.h" | 5 #include "mojo/edk/system/message_pipe.h" |
| 6 | 6 |
| 7 #include "mojo/edk/system/waiter.h" | 7 #include "mojo/edk/system/waiter.h" |
| 8 #include "mojo/edk/system/waiter_test_utils.h" | 8 #include "mojo/edk/system/waiter_test_utils.h" |
| 9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
| 10 | 10 |
| (...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 453 EXPECT_EQ(0u, hss.satisfiable_signals); | 453 EXPECT_EQ(0u, hss.satisfiable_signals); |
| 454 | 454 |
| 455 mp->Close(1); | 455 mp->Close(1); |
| 456 } | 456 } |
| 457 | 457 |
| 458 TEST(MessagePipeTest, ThreadedWaiting) { | 458 TEST(MessagePipeTest, ThreadedWaiting) { |
| 459 int32_t buffer[1]; | 459 int32_t buffer[1]; |
| 460 const uint32_t kBufferSize = static_cast<uint32_t>(sizeof(buffer)); | 460 const uint32_t kBufferSize = static_cast<uint32_t>(sizeof(buffer)); |
| 461 | 461 |
| 462 MojoResult result; | 462 MojoResult result; |
| 463 uint32_t context; | 463 uint64_t context; |
| 464 | 464 |
| 465 // Write to wake up waiter waiting for read. | 465 // Write to wake up waiter waiting for read. |
| 466 { | 466 { |
| 467 auto mp = MessagePipe::CreateLocalLocal(); | 467 auto mp = MessagePipe::CreateLocalLocal(); |
| 468 test::SimpleWaiterThread thread(&result, &context); | 468 test::SimpleWaiterThread thread(&result, &context); |
| 469 | 469 |
| 470 thread.waiter()->Init(); | 470 thread.waiter()->Init(); |
| 471 ASSERT_EQ(MOJO_RESULT_OK, | 471 ASSERT_EQ(MOJO_RESULT_OK, |
| 472 mp->AddAwakable(1, thread.waiter(), MOJO_HANDLE_SIGNAL_READABLE, | 472 mp->AddAwakable(1, thread.waiter(), MOJO_HANDLE_SIGNAL_READABLE, |
| 473 1, nullptr)); | 473 1, nullptr)); |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 562 mp->CancelAllState(1); | 562 mp->CancelAllState(1); |
| 563 mp->Close(1); | 563 mp->Close(1); |
| 564 } // Joins |thread|. | 564 } // Joins |thread|. |
| 565 EXPECT_EQ(MOJO_RESULT_FAILED_PRECONDITION, result); | 565 EXPECT_EQ(MOJO_RESULT_FAILED_PRECONDITION, result); |
| 566 EXPECT_EQ(4u, context); | 566 EXPECT_EQ(4u, context); |
| 567 } | 567 } |
| 568 | 568 |
| 569 } // namespace | 569 } // namespace |
| 570 } // namespace system | 570 } // namespace system |
| 571 } // namespace mojo | 571 } // namespace mojo |
| OLD | NEW |