| 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/dispatcher.h" | 5 #include "mojo/edk/system/dispatcher.h" |
| 6 | 6 |
| 7 #include <memory> |
| 8 |
| 7 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 8 #include "base/memory/scoped_vector.h" | 10 #include "base/memory/scoped_vector.h" |
| 9 #include "base/synchronization/waitable_event.h" | 11 #include "base/synchronization/waitable_event.h" |
| 10 #include "base/threading/simple_thread.h" | 12 #include "base/threading/simple_thread.h" |
| 11 #include "mojo/edk/embedder/platform_shared_buffer.h" | 13 #include "mojo/edk/embedder/platform_shared_buffer.h" |
| 12 #include "mojo/edk/system/memory.h" | 14 #include "mojo/edk/system/memory.h" |
| 13 #include "mojo/edk/system/waiter.h" | 15 #include "mojo/edk/system/waiter.h" |
| 14 #include "mojo/public/cpp/system/macros.h" | 16 #include "mojo/public/cpp/system/macros.h" |
| 15 #include "testing/gtest/include/gtest/gtest.h" | 17 #include "testing/gtest/include/gtest/gtest.h" |
| 16 | 18 |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT, dispatcher_->EndReadData(0)); | 199 EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT, dispatcher_->EndReadData(0)); |
| 198 break; | 200 break; |
| 199 case DUPLICATE_BUFFER_HANDLE: { | 201 case DUPLICATE_BUFFER_HANDLE: { |
| 200 scoped_refptr<Dispatcher> unused; | 202 scoped_refptr<Dispatcher> unused; |
| 201 EXPECT_EQ( | 203 EXPECT_EQ( |
| 202 MOJO_RESULT_INVALID_ARGUMENT, | 204 MOJO_RESULT_INVALID_ARGUMENT, |
| 203 dispatcher_->DuplicateBufferHandle(NullUserPointer(), &unused)); | 205 dispatcher_->DuplicateBufferHandle(NullUserPointer(), &unused)); |
| 204 break; | 206 break; |
| 205 } | 207 } |
| 206 case MAP_BUFFER: { | 208 case MAP_BUFFER: { |
| 207 scoped_ptr<embedder::PlatformSharedBufferMapping> unused; | 209 std::unique_ptr<embedder::PlatformSharedBufferMapping> unused; |
| 208 EXPECT_EQ( | 210 EXPECT_EQ( |
| 209 MOJO_RESULT_INVALID_ARGUMENT, | 211 MOJO_RESULT_INVALID_ARGUMENT, |
| 210 dispatcher_->MapBuffer(0u, 0u, MOJO_MAP_BUFFER_FLAG_NONE, &unused)); | 212 dispatcher_->MapBuffer(0u, 0u, MOJO_MAP_BUFFER_FLAG_NONE, &unused)); |
| 211 break; | 213 break; |
| 212 } | 214 } |
| 213 case ADD_WAITER: { | 215 case ADD_WAITER: { |
| 214 HandleSignalsState hss; | 216 HandleSignalsState hss; |
| 215 MojoResult r = dispatcher_->AddAwakable( | 217 MojoResult r = dispatcher_->AddAwakable( |
| 216 &waiter_, ~MOJO_HANDLE_SIGNAL_NONE, 0, &hss); | 218 &waiter_, ~MOJO_HANDLE_SIGNAL_NONE, 0, &hss); |
| 217 EXPECT_TRUE(r == MOJO_RESULT_FAILED_PRECONDITION || | 219 EXPECT_TRUE(r == MOJO_RESULT_FAILED_PRECONDITION || |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 298 event.Signal(); | 300 event.Signal(); |
| 299 } // Joins all the threads. | 301 } // Joins all the threads. |
| 300 | 302 |
| 301 EXPECT_EQ(MOJO_RESULT_OK, d->Close()); | 303 EXPECT_EQ(MOJO_RESULT_OK, d->Close()); |
| 302 } | 304 } |
| 303 } | 305 } |
| 304 | 306 |
| 305 } // namespace | 307 } // namespace |
| 306 } // namespace system | 308 } // namespace system |
| 307 } // namespace mojo | 309 } // namespace mojo |
| OLD | NEW |