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 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> |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 | 84 |
85 private: | 85 private: |
86 void SetUpOnIOThread(RefPtr<ChannelEndpoint>&& ep0, | 86 void SetUpOnIOThread(RefPtr<ChannelEndpoint>&& ep0, |
87 RefPtr<ChannelEndpoint>&& ep1) { | 87 RefPtr<ChannelEndpoint>&& ep1) { |
88 CHECK(io_thread_.IsCurrentAndRunning()); | 88 CHECK(io_thread_.IsCurrentAndRunning()); |
89 | 89 |
90 embedder::PlatformChannelPair channel_pair; | 90 embedder::PlatformChannelPair channel_pair; |
91 channels_[0] = MakeRefCounted<Channel>(&platform_support_); | 91 channels_[0] = MakeRefCounted<Channel>(&platform_support_); |
92 channels_[0]->Init(io_thread_.task_runner().Clone(), | 92 channels_[0]->Init(io_thread_.task_runner().Clone(), |
93 io_thread_.platform_handle_watcher(), | 93 io_thread_.platform_handle_watcher(), |
94 RawChannel::Create(channel_pair.PassServerHandle())); | 94 RawChannel::Create(channel_pair.handle0.Pass())); |
95 channels_[0]->SetBootstrapEndpoint(std::move(ep0)); | 95 channels_[0]->SetBootstrapEndpoint(std::move(ep0)); |
96 channels_[1] = MakeRefCounted<Channel>(&platform_support_); | 96 channels_[1] = MakeRefCounted<Channel>(&platform_support_); |
97 channels_[1]->Init(io_thread_.task_runner().Clone(), | 97 channels_[1]->Init(io_thread_.task_runner().Clone(), |
98 io_thread_.platform_handle_watcher(), | 98 io_thread_.platform_handle_watcher(), |
99 RawChannel::Create(channel_pair.PassClientHandle())); | 99 RawChannel::Create(channel_pair.handle1.Pass())); |
100 channels_[1]->SetBootstrapEndpoint(std::move(ep1)); | 100 channels_[1]->SetBootstrapEndpoint(std::move(ep1)); |
101 } | 101 } |
102 | 102 |
103 void TearDownOnIOThread() { | 103 void TearDownOnIOThread() { |
104 CHECK(io_thread_.IsCurrentAndRunning()); | 104 CHECK(io_thread_.IsCurrentAndRunning()); |
105 | 105 |
106 if (channels_[0]) { | 106 if (channels_[0]) { |
107 channels_[0]->Shutdown(); | 107 channels_[0]->Shutdown(); |
108 channels_[0] = nullptr; | 108 channels_[0] = nullptr; |
109 } | 109 } |
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
500 EXPECT_EQ(123456, elements[0]); | 500 EXPECT_EQ(123456, elements[0]); |
501 EXPECT_EQ(789012, elements[1]); | 501 EXPECT_EQ(789012, elements[1]); |
502 EXPECT_EQ(0, elements[2]); | 502 EXPECT_EQ(0, elements[2]); |
503 | 503 |
504 consumer->Close(); | 504 consumer->Close(); |
505 } | 505 } |
506 | 506 |
507 } // namespace | 507 } // namespace |
508 } // namespace system | 508 } // namespace system |
509 } // namespace mojo | 509 } // namespace mojo |
OLD | NEW |