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

Side by Side Diff: mojo/edk/system/remote_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
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 tests both |RemoteProducerDataPipeImpl| and 5 // This file tests both |RemoteProducerDataPipeImpl| and
6 // |RemoteConsumerDataPipeImpl|. 6 // |RemoteConsumerDataPipeImpl|.
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <utility> 10 #include <utility>
11 11
12 #include "base/logging.h" 12 #include "base/logging.h"
13 #include "mojo/edk/embedder/platform_channel_pair.h"
14 #include "mojo/edk/embedder/simple_platform_support.h" 13 #include "mojo/edk/embedder/simple_platform_support.h"
14 #include "mojo/edk/platform/platform_pipe.h"
15 #include "mojo/edk/system/channel.h" 15 #include "mojo/edk/system/channel.h"
16 #include "mojo/edk/system/channel_endpoint.h" 16 #include "mojo/edk/system/channel_endpoint.h"
17 #include "mojo/edk/system/data_pipe.h" 17 #include "mojo/edk/system/data_pipe.h"
18 #include "mojo/edk/system/data_pipe_consumer_dispatcher.h" 18 #include "mojo/edk/system/data_pipe_consumer_dispatcher.h"
19 #include "mojo/edk/system/data_pipe_producer_dispatcher.h" 19 #include "mojo/edk/system/data_pipe_producer_dispatcher.h"
20 #include "mojo/edk/system/memory.h" 20 #include "mojo/edk/system/memory.h"
21 #include "mojo/edk/system/message_pipe.h" 21 #include "mojo/edk/system/message_pipe.h"
22 #include "mojo/edk/system/raw_channel.h" 22 #include "mojo/edk/system/raw_channel.h"
23 #include "mojo/edk/system/test/test_io_thread.h" 23 #include "mojo/edk/system/test/test_io_thread.h"
24 #include "mojo/edk/system/test/timeouts.h" 24 #include "mojo/edk/system/test/timeouts.h"
25 #include "mojo/edk/system/waiter.h" 25 #include "mojo/edk/system/waiter.h"
26 #include "mojo/edk/util/ref_ptr.h" 26 #include "mojo/edk/util/ref_ptr.h"
27 #include "mojo/public/cpp/system/macros.h" 27 #include "mojo/public/cpp/system/macros.h"
28 #include "testing/gtest/include/gtest/gtest.h" 28 #include "testing/gtest/include/gtest/gtest.h"
29 29
30 using mojo::platform::PlatformPipe;
30 using mojo::util::MakeRefCounted; 31 using mojo::util::MakeRefCounted;
31 using mojo::util::RefPtr; 32 using mojo::util::RefPtr;
32 33
33 namespace mojo { 34 namespace mojo {
34 namespace system { 35 namespace system {
35 namespace { 36 namespace {
36 37
37 const MojoHandleSignals kAllSignals = MOJO_HANDLE_SIGNAL_READABLE | 38 const MojoHandleSignals kAllSignals = MOJO_HANDLE_SIGNAL_READABLE |
38 MOJO_HANDLE_SIGNAL_WRITABLE | 39 MOJO_HANDLE_SIGNAL_WRITABLE |
39 MOJO_HANDLE_SIGNAL_PEER_CLOSED; 40 MOJO_HANDLE_SIGNAL_PEER_CLOSED;
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 return; 81 return;
81 message_pipes_[i]->Close(0); 82 message_pipes_[i]->Close(0);
82 message_pipes_[i] = nullptr; 83 message_pipes_[i] = nullptr;
83 } 84 }
84 85
85 private: 86 private:
86 void SetUpOnIOThread(RefPtr<ChannelEndpoint>&& ep0, 87 void SetUpOnIOThread(RefPtr<ChannelEndpoint>&& ep0,
87 RefPtr<ChannelEndpoint>&& ep1) { 88 RefPtr<ChannelEndpoint>&& ep1) {
88 CHECK(io_thread_.IsCurrentAndRunning()); 89 CHECK(io_thread_.IsCurrentAndRunning());
89 90
90 embedder::PlatformChannelPair channel_pair; 91 PlatformPipe channel_pair;
91 channels_[0] = MakeRefCounted<Channel>(&platform_support_); 92 channels_[0] = MakeRefCounted<Channel>(&platform_support_);
92 channels_[0]->Init(io_thread_.task_runner().Clone(), 93 channels_[0]->Init(io_thread_.task_runner().Clone(),
93 io_thread_.platform_handle_watcher(), 94 io_thread_.platform_handle_watcher(),
94 RawChannel::Create(channel_pair.handle0.Pass())); 95 RawChannel::Create(channel_pair.handle0.Pass()));
95 channels_[0]->SetBootstrapEndpoint(std::move(ep0)); 96 channels_[0]->SetBootstrapEndpoint(std::move(ep0));
96 channels_[1] = MakeRefCounted<Channel>(&platform_support_); 97 channels_[1] = MakeRefCounted<Channel>(&platform_support_);
97 channels_[1]->Init(io_thread_.task_runner().Clone(), 98 channels_[1]->Init(io_thread_.task_runner().Clone(),
98 io_thread_.platform_handle_watcher(), 99 io_thread_.platform_handle_watcher(),
99 RawChannel::Create(channel_pair.handle1.Pass())); 100 RawChannel::Create(channel_pair.handle1.Pass()));
100 channels_[1]->SetBootstrapEndpoint(std::move(ep1)); 101 channels_[1]->SetBootstrapEndpoint(std::move(ep1));
(...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after
500 EXPECT_EQ(123456, elements[0]); 501 EXPECT_EQ(123456, elements[0]);
501 EXPECT_EQ(789012, elements[1]); 502 EXPECT_EQ(789012, elements[1]);
502 EXPECT_EQ(0, elements[2]); 503 EXPECT_EQ(0, elements[2]);
503 504
504 consumer->Close(); 505 consumer->Close();
505 } 506 }
506 507
507 } // namespace 508 } // namespace
508 } // namespace system 509 } // namespace system
509 } // namespace mojo 510 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/edk/system/raw_channel_unittest.cc ('k') | mojo/edk/system/remote_message_pipe_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698