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/edk/system/shared_buffer_dispatcher.h" | 5 #include "mojo/edk/system/shared_buffer_dispatcher.h" |
6 | 6 |
7 #include <limits> | 7 #include <limits> |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "mojo/edk/embedder/simple_platform_support.h" | 10 #include "mojo/edk/embedder/simple_platform_support.h" |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 } | 184 } |
185 | 185 |
186 TEST_F(SharedBufferDispatcherTest, SupportsEntrypointClass) { | 186 TEST_F(SharedBufferDispatcherTest, SupportsEntrypointClass) { |
187 MojoResult result = MOJO_RESULT_INTERNAL; | 187 MojoResult result = MOJO_RESULT_INTERNAL; |
188 auto d = SharedBufferDispatcher::Create( | 188 auto d = SharedBufferDispatcher::Create( |
189 platform_support(), SharedBufferDispatcher::kDefaultCreateOptions, 100u, | 189 platform_support(), SharedBufferDispatcher::kDefaultCreateOptions, 100u, |
190 &result); | 190 &result); |
191 ASSERT_TRUE(d); | 191 ASSERT_TRUE(d); |
192 EXPECT_EQ(MOJO_RESULT_OK, result); | 192 EXPECT_EQ(MOJO_RESULT_OK, result); |
193 | 193 |
194 EXPECT_FALSE( | 194 EXPECT_FALSE(d->SupportsEntrypointClass(EntrypointClass::MESSAGE_PIPE)); |
195 d->SupportsEntrypointClass(Dispatcher::EntrypointClass::MESSAGE_PIPE)); | 195 EXPECT_FALSE(d->SupportsEntrypointClass(EntrypointClass::DATA_PIPE_PRODUCER)); |
196 EXPECT_FALSE(d->SupportsEntrypointClass( | 196 EXPECT_FALSE(d->SupportsEntrypointClass(EntrypointClass::DATA_PIPE_CONSUMER)); |
197 Dispatcher::EntrypointClass::DATA_PIPE_PRODUCER)); | 197 EXPECT_TRUE(d->SupportsEntrypointClass(EntrypointClass::BUFFER)); |
198 EXPECT_FALSE(d->SupportsEntrypointClass( | |
199 Dispatcher::EntrypointClass::DATA_PIPE_CONSUMER)); | |
200 EXPECT_TRUE(d->SupportsEntrypointClass(Dispatcher::EntrypointClass::BUFFER)); | |
201 | 198 |
202 // TODO(vtl): Check that it actually returns |MOJO_RESULT_INVALID_ARGUMENT| | 199 // TODO(vtl): Check that it actually returns |MOJO_RESULT_INVALID_ARGUMENT| |
203 // for methods in unsupported entrypoint classes. | 200 // for methods in unsupported entrypoint classes. |
204 | 201 |
205 EXPECT_EQ(MOJO_RESULT_OK, d->Close()); | 202 EXPECT_EQ(MOJO_RESULT_OK, d->Close()); |
206 } | 203 } |
207 | 204 |
208 TEST_F(SharedBufferDispatcherTest, DuplicateBufferHandle) { | 205 TEST_F(SharedBufferDispatcherTest, DuplicateBufferHandle) { |
209 const uint64_t kSize = 100u; | 206 const uint64_t kSize = 100u; |
210 | 207 |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
341 EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT, | 338 EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT, |
342 dispatcher->MapBuffer(0, 0, MOJO_MAP_BUFFER_FLAG_NONE, &mapping)); | 339 dispatcher->MapBuffer(0, 0, MOJO_MAP_BUFFER_FLAG_NONE, &mapping)); |
343 EXPECT_FALSE(mapping); | 340 EXPECT_FALSE(mapping); |
344 | 341 |
345 EXPECT_EQ(MOJO_RESULT_OK, dispatcher->Close()); | 342 EXPECT_EQ(MOJO_RESULT_OK, dispatcher->Close()); |
346 } | 343 } |
347 | 344 |
348 } // namespace | 345 } // namespace |
349 } // namespace system | 346 } // namespace system |
350 } // namespace mojo | 347 } // namespace mojo |
OLD | NEW |