| 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 #include "mojo/public/cpp/bindings/allocation_scope.h" | 5 #include "mojo/public/cpp/bindings/allocation_scope.h" |
| 6 #include "mojo/public/cpp/bindings/array.h" | 6 #include "mojo/public/cpp/bindings/array.h" |
| 7 #include "mojo/public/cpp/bindings/interface.h" | 7 #include "mojo/public/cpp/bindings/interface.h" |
| 8 #include "mojo/public/cpp/bindings/lib/fixed_buffer.h" | 8 #include "mojo/public/cpp/bindings/lib/fixed_buffer.h" |
| 9 #include "mojo/public/cpp/bindings/lib/scratch_buffer.h" | 9 #include "mojo/public/cpp/bindings/lib/scratch_buffer.h" |
| 10 #include "mojo/public/cpp/environment/environment.h" | 10 #include "mojo/public/cpp/environment/environment.h" |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 MOJO_ALLOW_UNUSED Array<MessagePipeHandle> handles = | 135 MOJO_ALLOW_UNUSED Array<MessagePipeHandle> handles = |
| 136 handles_builder.Finish(); | 136 handles_builder.Finish(); |
| 137 } | 137 } |
| 138 | 138 |
| 139 // We expect the pipes to have been closed. | 139 // We expect the pipes to have been closed. |
| 140 EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT, MojoClose(pipe0_value)); | 140 EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT, MojoClose(pipe0_value)); |
| 141 EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT, MojoClose(pipe1_value)); | 141 EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT, MojoClose(pipe1_value)); |
| 142 } | 142 } |
| 143 | 143 |
| 144 // Tests that Array<InterfaceHandle<S>> supports closing handles. | 144 // Tests that Array<InterfaceHandle<S>> supports closing handles. |
| 145 #if 0 |
| 145 TEST(ArrayTest, InterfaceHandlesAreClosed) { | 146 TEST(ArrayTest, InterfaceHandlesAreClosed) { |
| 146 Environment env; | 147 Environment env; |
| 147 | 148 |
| 148 InterfacePipe<sample::Port, sample::Port> pipe; | 149 InterfacePipe<sample::Port, sample::Port> pipe; |
| 149 | 150 |
| 150 MojoHandle pipe0_value = pipe.handle_to_self.get().value(); | 151 MojoHandle pipe0_value = pipe.handle_to_self.get().value(); |
| 151 MojoHandle pipe1_value = pipe.handle_to_peer.get().value(); | 152 MojoHandle pipe1_value = pipe.handle_to_peer.get().value(); |
| 152 | 153 |
| 153 { | 154 { |
| 154 AllocationScope scope; | 155 AllocationScope scope; |
| 155 | 156 |
| 156 Array<sample::PortHandle>::Builder handles_builder(2); | 157 Array<sample::PortHandle>::Builder handles_builder(2); |
| 157 handles_builder[0] = pipe.handle_to_self.Pass(); | 158 handles_builder[0] = pipe.handle_to_self.Pass(); |
| 158 handles_builder[1].reset(pipe.handle_to_peer.release()); | 159 handles_builder[1].reset(pipe.handle_to_peer.release()); |
| 159 | 160 |
| 160 MOJO_ALLOW_UNUSED Array<sample::PortHandle> handles = | 161 MOJO_ALLOW_UNUSED Array<sample::PortHandle> handles = |
| 161 handles_builder.Finish(); | 162 handles_builder.Finish(); |
| 162 } | 163 } |
| 163 | 164 |
| 164 // We expect the pipes to have been closed. | 165 // We expect the pipes to have been closed. |
| 165 EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT, MojoClose(pipe0_value)); | 166 EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT, MojoClose(pipe0_value)); |
| 166 EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT, MojoClose(pipe1_value)); | 167 EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT, MojoClose(pipe1_value)); |
| 167 } | 168 } |
| 169 #endif |
| 168 | 170 |
| 169 } // namespace | 171 } // namespace |
| 170 } // namespace test | 172 } // namespace test |
| 171 } // namespace mojo | 173 } // namespace mojo |
| OLD | NEW |