| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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++ wrappers in mojo/public/cpp/system/data_pipe.h. | 5 // This file tests the C++ wrappers in mojo/public/cpp/system/data_pipe.h. |
| 6 | 6 |
| 7 #include "mojo/public/cpp/system/data_pipe.h" | 7 #include "mojo/public/cpp/system/data_pipe.h" |
| 8 | 8 |
| 9 #include "gtest/gtest.h" |
| 9 #include "mojo/public/cpp/system/handle.h" | 10 #include "mojo/public/cpp/system/handle.h" |
| 10 #include "mojo/public/cpp/system/macros.h" | 11 #include "mojo/public/cpp/system/macros.h" |
| 11 #include "mojo/public/cpp/system/wait.h" | 12 #include "mojo/public/cpp/system/wait.h" |
| 12 #include "testing/gtest/include/gtest/gtest.h" | |
| 13 | 13 |
| 14 namespace mojo { | 14 namespace mojo { |
| 15 namespace { | 15 namespace { |
| 16 | 16 |
| 17 TEST(DataPipe, Basic) { | 17 TEST(DataPipe, Basic) { |
| 18 // Cursory compilation tests of |MakeScopedHandle()| with data pipe handles. | 18 // Cursory compilation tests of |MakeScopedHandle()| with data pipe handles. |
| 19 EXPECT_FALSE(MakeScopedHandle(DataPipeProducerHandle()).is_valid()); | 19 EXPECT_FALSE(MakeScopedHandle(DataPipeProducerHandle()).is_valid()); |
| 20 EXPECT_FALSE(MakeScopedHandle(DataPipeConsumerHandle()).is_valid()); | 20 EXPECT_FALSE(MakeScopedHandle(DataPipeConsumerHandle()).is_valid()); |
| 21 | 21 |
| 22 ScopedDataPipeProducerHandle ph; | 22 ScopedDataPipeProducerHandle ph; |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 // Close the producer. | 112 // Close the producer. |
| 113 ph.reset(); | 113 ph.reset(); |
| 114 | 114 |
| 115 // Waiting for "read" should now fail. | 115 // Waiting for "read" should now fail. |
| 116 EXPECT_EQ(MOJO_RESULT_FAILED_PRECONDITION, | 116 EXPECT_EQ(MOJO_RESULT_FAILED_PRECONDITION, |
| 117 Wait(ch.get(), MOJO_HANDLE_SIGNAL_READ_THRESHOLD, 1000, nullptr)); | 117 Wait(ch.get(), MOJO_HANDLE_SIGNAL_READ_THRESHOLD, 1000, nullptr)); |
| 118 } | 118 } |
| 119 | 119 |
| 120 } // namespace mojo | 120 } // namespace mojo |
| 121 } // namespace | 121 } // namespace |
| OLD | NEW |