Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(173)

Side by Side Diff: mojo/edk/system/data_pipe_impl_unittest.cc

Issue 1659213002: Move PlatformChannelPair to //mojo/edk/platform and rename it PlatformPipe. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « mojo/edk/system/connection_manager_unittest.cc ('k') | mojo/edk/system/ipc_support_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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> 12 #include <memory>
13 #include <utility> 13 #include <utility>
14 14
15 #include "base/logging.h" 15 #include "base/logging.h"
16 #include "mojo/edk/embedder/platform_channel_pair.h"
17 #include "mojo/edk/embedder/simple_platform_support.h" 16 #include "mojo/edk/embedder/simple_platform_support.h"
17 #include "mojo/edk/platform/platform_pipe.h"
18 #include "mojo/edk/platform/thread_utils.h" 18 #include "mojo/edk/platform/thread_utils.h"
19 #include "mojo/edk/system/channel.h" 19 #include "mojo/edk/system/channel.h"
20 #include "mojo/edk/system/channel_endpoint.h" 20 #include "mojo/edk/system/channel_endpoint.h"
21 #include "mojo/edk/system/data_pipe.h" 21 #include "mojo/edk/system/data_pipe.h"
22 #include "mojo/edk/system/data_pipe_consumer_dispatcher.h" 22 #include "mojo/edk/system/data_pipe_consumer_dispatcher.h"
23 #include "mojo/edk/system/data_pipe_producer_dispatcher.h" 23 #include "mojo/edk/system/data_pipe_producer_dispatcher.h"
24 #include "mojo/edk/system/memory.h" 24 #include "mojo/edk/system/memory.h"
25 #include "mojo/edk/system/message_pipe.h" 25 #include "mojo/edk/system/message_pipe.h"
26 #include "mojo/edk/system/raw_channel.h" 26 #include "mojo/edk/system/raw_channel.h"
27 #include "mojo/edk/system/test/test_io_thread.h" 27 #include "mojo/edk/system/test/test_io_thread.h"
28 #include "mojo/edk/system/test/timeouts.h" 28 #include "mojo/edk/system/test/timeouts.h"
29 #include "mojo/edk/system/waiter.h" 29 #include "mojo/edk/system/waiter.h"
30 #include "mojo/edk/util/ref_ptr.h" 30 #include "mojo/edk/util/ref_ptr.h"
31 #include "mojo/public/cpp/system/macros.h" 31 #include "mojo/public/cpp/system/macros.h"
32 #include "testing/gtest/include/gtest/gtest.h" 32 #include "testing/gtest/include/gtest/gtest.h"
33 33
34 using mojo::platform::PlatformPipe;
34 using mojo::platform::ThreadSleep; 35 using mojo::platform::ThreadSleep;
35 using mojo::util::MakeRefCounted; 36 using mojo::util::MakeRefCounted;
36 using mojo::util::RefPtr; 37 using mojo::util::RefPtr;
37 38
38 namespace mojo { 39 namespace mojo {
39 namespace system { 40 namespace system {
40 namespace { 41 namespace {
41 42
42 const MojoHandleSignals kAllSignals = MOJO_HANDLE_SIGNAL_READABLE | 43 const MojoHandleSignals kAllSignals = MOJO_HANDLE_SIGNAL_READABLE |
43 MOJO_HANDLE_SIGNAL_WRITABLE | 44 MOJO_HANDLE_SIGNAL_WRITABLE |
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
313 if (!message_pipes_[i]) 314 if (!message_pipes_[i])
314 return; 315 return;
315 message_pipes_[i]->Close(0); 316 message_pipes_[i]->Close(0);
316 message_pipes_[i] = nullptr; 317 message_pipes_[i] = nullptr;
317 } 318 }
318 319
319 void SetUpOnIOThread(RefPtr<ChannelEndpoint>&& ep0, 320 void SetUpOnIOThread(RefPtr<ChannelEndpoint>&& ep0,
320 RefPtr<ChannelEndpoint>&& ep1) { 321 RefPtr<ChannelEndpoint>&& ep1) {
321 CHECK(io_thread_.IsCurrentAndRunning()); 322 CHECK(io_thread_.IsCurrentAndRunning());
322 323
323 embedder::PlatformChannelPair channel_pair; 324 PlatformPipe channel_pair;
324 channels_[0] = MakeRefCounted<Channel>(&platform_support_); 325 channels_[0] = MakeRefCounted<Channel>(&platform_support_);
325 channels_[0]->Init(io_thread_.task_runner().Clone(), 326 channels_[0]->Init(io_thread_.task_runner().Clone(),
326 io_thread_.platform_handle_watcher(), 327 io_thread_.platform_handle_watcher(),
327 RawChannel::Create(channel_pair.handle0.Pass())); 328 RawChannel::Create(channel_pair.handle0.Pass()));
328 channels_[0]->SetBootstrapEndpoint(std::move(ep0)); 329 channels_[0]->SetBootstrapEndpoint(std::move(ep0));
329 channels_[1] = MakeRefCounted<Channel>(&platform_support_); 330 channels_[1] = MakeRefCounted<Channel>(&platform_support_);
330 channels_[1]->Init(io_thread_.task_runner().Clone(), 331 channels_[1]->Init(io_thread_.task_runner().Clone(),
331 io_thread_.platform_handle_watcher(), 332 io_thread_.platform_handle_watcher(),
332 RawChannel::Create(channel_pair.handle1.Pass())); 333 RawChannel::Create(channel_pair.handle1.Pass()));
333 channels_[1]->SetBootstrapEndpoint(std::move(ep1)); 334 channels_[1]->SetBootstrapEndpoint(std::move(ep1));
(...skipping 2160 matching lines...) Expand 10 before | Expand all | Expand 10 after
2494 ThreadSleep(10u); 2495 ThreadSleep(10u);
2495 2496
2496 EXPECT_EQ(MOJO_RESULT_OK, this->ConsumerEndReadData(num_bytes)); 2497 EXPECT_EQ(MOJO_RESULT_OK, this->ConsumerEndReadData(num_bytes));
2497 2498
2498 this->ConsumerClose(); 2499 this->ConsumerClose();
2499 } 2500 }
2500 2501
2501 } // namespace 2502 } // namespace
2502 } // namespace system 2503 } // namespace system
2503 } // namespace mojo 2504 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/edk/system/connection_manager_unittest.cc ('k') | mojo/edk/system/ipc_support_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698