| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 the C++ Mojo system core wrappers. | 5 // This file tests the C++ Mojo system core wrappers. |
| 6 // TODO(vtl): Maybe rename "CoreCppTest" -> "CoreTest" if/when this gets | 6 // TODO(vtl): Maybe rename "CoreCppTest" -> "CoreTest" if/when this gets |
| 7 // compiled into a different binary from the C API tests. | 7 // compiled into a different binary from the C API tests. |
| 8 | 8 |
| 9 #include <stddef.h> | 9 #include <stddef.h> |
| 10 | 10 |
| (...skipping 526 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 537 | 537 |
| 538 { | 538 { |
| 539 WaitManyResult wmr(MOJO_RESULT_FAILED_PRECONDITION, 5u); | 539 WaitManyResult wmr(MOJO_RESULT_FAILED_PRECONDITION, 5u); |
| 540 EXPECT_TRUE(wmr.IsIndexValid()); | 540 EXPECT_TRUE(wmr.IsIndexValid()); |
| 541 EXPECT_TRUE(wmr.AreSignalsStatesValid()); | 541 EXPECT_TRUE(wmr.AreSignalsStatesValid()); |
| 542 EXPECT_EQ(MOJO_RESULT_FAILED_PRECONDITION, wmr.result); | 542 EXPECT_EQ(MOJO_RESULT_FAILED_PRECONDITION, wmr.result); |
| 543 EXPECT_EQ(5u, wmr.index); | 543 EXPECT_EQ(5u, wmr.index); |
| 544 } | 544 } |
| 545 } | 545 } |
| 546 | 546 |
| 547 // TODO(ncbray): enable this test once NaCl supports the corresponding APIs. | 547 TEST(CoreCppTest, DataPipe) { |
| 548 #ifdef __native_client__ | |
| 549 #define MAYBE_DataPipe DISABLED_DataPipe | |
| 550 #else | |
| 551 #define MAYBE_DataPipe DataPipe | |
| 552 #endif | |
| 553 TEST(CoreCppTest, MAYBE_DataPipe) { | |
| 554 ScopedDataPipeProducerHandle ph; | 548 ScopedDataPipeProducerHandle ph; |
| 555 ScopedDataPipeConsumerHandle ch; | 549 ScopedDataPipeConsumerHandle ch; |
| 556 | 550 |
| 557 ASSERT_EQ(MOJO_RESULT_OK, CreateDataPipe(nullptr, &ph, &ch)); | 551 ASSERT_EQ(MOJO_RESULT_OK, CreateDataPipe(nullptr, &ph, &ch)); |
| 558 ASSERT_TRUE(ph.get().is_valid()); | 552 ASSERT_TRUE(ph.get().is_valid()); |
| 559 ASSERT_TRUE(ch.get().is_valid()); | 553 ASSERT_TRUE(ch.get().is_valid()); |
| 560 | 554 |
| 561 uint32_t read_threshold = 123u; | 555 uint32_t read_threshold = 123u; |
| 562 EXPECT_EQ(MOJO_RESULT_OK, | 556 EXPECT_EQ(MOJO_RESULT_OK, |
| 563 GetDataPipeConsumerOptions(ch.get(), &read_threshold)); | 557 GetDataPipeConsumerOptions(ch.get(), &read_threshold)); |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 644 // Close the producer. | 638 // Close the producer. |
| 645 ph.reset(); | 639 ph.reset(); |
| 646 | 640 |
| 647 // Waiting for "read" should now fail. | 641 // Waiting for "read" should now fail. |
| 648 EXPECT_EQ(MOJO_RESULT_FAILED_PRECONDITION, | 642 EXPECT_EQ(MOJO_RESULT_FAILED_PRECONDITION, |
| 649 Wait(ch.get(), MOJO_HANDLE_SIGNAL_READ_THRESHOLD, 1000, nullptr)); | 643 Wait(ch.get(), MOJO_HANDLE_SIGNAL_READ_THRESHOLD, 1000, nullptr)); |
| 650 } | 644 } |
| 651 | 645 |
| 652 } // namespace | 646 } // namespace |
| 653 } // namespace mojo | 647 } // namespace mojo |
| OLD | NEW |