| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 contains tests that are shared between different implementations of | 5 // This file contains tests that are shared between different implementations of |
| 6 // |DataPipeImpl|. | 6 // |DataPipeImpl|. |
| 7 | 7 |
| 8 #include "mojo/edk/system/data_pipe_impl.h" | 8 #include "mojo/edk/system/data_pipe_impl.h" |
| 9 | 9 |
| 10 #include <stdint.h> | 10 #include <stdint.h> |
| 11 | 11 |
| 12 #include <memory> |
| 13 |
| 12 #include "base/bind.h" | 14 #include "base/bind.h" |
| 13 #include "base/location.h" | 15 #include "base/location.h" |
| 14 #include "base/logging.h" | 16 #include "base/logging.h" |
| 15 #include "base/memory/scoped_ptr.h" | |
| 16 #include "base/message_loop/message_loop.h" | 17 #include "base/message_loop/message_loop.h" |
| 17 #include "mojo/edk/embedder/platform_channel_pair.h" | 18 #include "mojo/edk/embedder/platform_channel_pair.h" |
| 18 #include "mojo/edk/embedder/simple_platform_support.h" | 19 #include "mojo/edk/embedder/simple_platform_support.h" |
| 19 #include "mojo/edk/system/channel.h" | 20 #include "mojo/edk/system/channel.h" |
| 20 #include "mojo/edk/system/channel_endpoint.h" | 21 #include "mojo/edk/system/channel_endpoint.h" |
| 21 #include "mojo/edk/system/data_pipe.h" | 22 #include "mojo/edk/system/data_pipe.h" |
| 22 #include "mojo/edk/system/data_pipe_consumer_dispatcher.h" | 23 #include "mojo/edk/system/data_pipe_consumer_dispatcher.h" |
| 23 #include "mojo/edk/system/data_pipe_producer_dispatcher.h" | 24 #include "mojo/edk/system/data_pipe_producer_dispatcher.h" |
| 24 #include "mojo/edk/system/memory.h" | 25 #include "mojo/edk/system/memory.h" |
| 25 #include "mojo/edk/system/message_pipe.h" | 26 #include "mojo/edk/system/message_pipe.h" |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 } | 174 } |
| 174 void ConsumerRemoveAwakable(Awakable* awakable, | 175 void ConsumerRemoveAwakable(Awakable* awakable, |
| 175 HandleSignalsState* signals_state) { | 176 HandleSignalsState* signals_state) { |
| 176 return dpc()->ConsumerRemoveAwakable(awakable, signals_state); | 177 return dpc()->ConsumerRemoveAwakable(awakable, signals_state); |
| 177 } | 178 } |
| 178 | 179 |
| 179 private: | 180 private: |
| 180 DataPipe* dpp() { return helper_->DataPipeForProducer(); } | 181 DataPipe* dpp() { return helper_->DataPipeForProducer(); } |
| 181 DataPipe* dpc() { return helper_->DataPipeForConsumer(); } | 182 DataPipe* dpc() { return helper_->DataPipeForConsumer(); } |
| 182 | 183 |
| 183 scoped_ptr<Helper> helper_; | 184 std::unique_ptr<Helper> helper_; |
| 184 | 185 |
| 185 MOJO_DISALLOW_COPY_AND_ASSIGN(DataPipeImplTest); | 186 MOJO_DISALLOW_COPY_AND_ASSIGN(DataPipeImplTest); |
| 186 }; | 187 }; |
| 187 | 188 |
| 188 // LocalDataPipeImplTestHelper ------------------------------------------------- | 189 // LocalDataPipeImplTestHelper ------------------------------------------------- |
| 189 | 190 |
| 190 class LocalDataPipeImplTestHelper : public DataPipeImplTestHelper { | 191 class LocalDataPipeImplTestHelper : public DataPipeImplTestHelper { |
| 191 public: | 192 public: |
| 192 LocalDataPipeImplTestHelper() {} | 193 LocalDataPipeImplTestHelper() {} |
| 193 ~LocalDataPipeImplTestHelper() override {} | 194 ~LocalDataPipeImplTestHelper() override {} |
| (...skipping 2258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2452 test::Sleep(10u); | 2453 test::Sleep(10u); |
| 2453 | 2454 |
| 2454 EXPECT_EQ(MOJO_RESULT_OK, this->ConsumerEndReadData(num_bytes)); | 2455 EXPECT_EQ(MOJO_RESULT_OK, this->ConsumerEndReadData(num_bytes)); |
| 2455 | 2456 |
| 2456 this->ConsumerClose(); | 2457 this->ConsumerClose(); |
| 2457 } | 2458 } |
| 2458 | 2459 |
| 2459 } // namespace | 2460 } // namespace |
| 2460 } // namespace system | 2461 } // namespace system |
| 2461 } // namespace mojo | 2462 } // namespace mojo |
| OLD | NEW |