OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 <stdint.h> | 5 #include <stdint.h> |
6 #include <string.h> | 6 #include <string.h> |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "base/bind.h" | 11 #include "base/bind.h" |
12 #include "base/location.h" | 12 #include "base/location.h" |
13 #include "base/logging.h" | 13 #include "base/logging.h" |
14 #include "base/message_loop/message_loop.h" | 14 #include "base/message_loop/message_loop.h" |
15 #include "base/threading/platform_thread.h" // For |Sleep()|. | 15 #include "base/threading/platform_thread.h" // For |Sleep()|. |
16 #include "mojo/embedder/platform_channel_pair.h" | 16 #include "mojo/embedder/platform_channel_pair.h" |
17 #include "mojo/embedder/scoped_platform_handle.h" | 17 #include "mojo/embedder/scoped_platform_handle.h" |
18 #include "mojo/system/channel.h" | 18 #include "mojo/system/channel.h" |
19 #include "mojo/system/local_message_pipe_endpoint.h" | 19 #include "mojo/system/local_message_pipe_endpoint.h" |
20 #include "mojo/system/message_pipe.h" | 20 #include "mojo/system/message_pipe.h" |
21 #include "mojo/system/message_pipe_dispatcher.h" | 21 #include "mojo/system/message_pipe_dispatcher.h" |
22 #include "mojo/system/proxy_message_pipe_endpoint.h" | 22 #include "mojo/system/proxy_message_pipe_endpoint.h" |
| 23 #include "mojo/system/raw_channel.h" |
23 #include "mojo/system/test_utils.h" | 24 #include "mojo/system/test_utils.h" |
24 #include "mojo/system/waiter.h" | 25 #include "mojo/system/waiter.h" |
25 #include "testing/gtest/include/gtest/gtest.h" | 26 #include "testing/gtest/include/gtest/gtest.h" |
26 | 27 |
27 namespace mojo { | 28 namespace mojo { |
28 namespace system { | 29 namespace system { |
29 namespace { | 30 namespace { |
30 | 31 |
31 class RemoteMessagePipeTest : public testing::Test { | 32 class RemoteMessagePipeTest : public testing::Test { |
32 public: | 33 public: |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 } | 103 } |
103 } | 104 } |
104 | 105 |
105 void CreateAndInitChannel(unsigned channel_index) { | 106 void CreateAndInitChannel(unsigned channel_index) { |
106 CHECK_EQ(base::MessageLoop::current(), io_thread()->message_loop()); | 107 CHECK_EQ(base::MessageLoop::current(), io_thread()->message_loop()); |
107 CHECK(channel_index == 0 || channel_index == 1); | 108 CHECK(channel_index == 0 || channel_index == 1); |
108 CHECK(!channels_[channel_index].get()); | 109 CHECK(!channels_[channel_index].get()); |
109 | 110 |
110 channels_[channel_index] = new Channel(); | 111 channels_[channel_index] = new Channel(); |
111 CHECK(channels_[channel_index]->Init( | 112 CHECK(channels_[channel_index]->Init( |
112 platform_handles_[channel_index].Pass())); | 113 RawChannel::Create(platform_handles_[channel_index].Pass()))); |
113 } | 114 } |
114 | 115 |
115 void ConnectMessagePipesOnIOThread(scoped_refptr<MessagePipe> mp0, | 116 void ConnectMessagePipesOnIOThread(scoped_refptr<MessagePipe> mp0, |
116 scoped_refptr<MessagePipe> mp1) { | 117 scoped_refptr<MessagePipe> mp1) { |
117 CHECK_EQ(base::MessageLoop::current(), io_thread()->message_loop()); | 118 CHECK_EQ(base::MessageLoop::current(), io_thread()->message_loop()); |
118 | 119 |
119 if (!channels_[0].get()) | 120 if (!channels_[0].get()) |
120 CreateAndInitChannel(0); | 121 CreateAndInitChannel(0); |
121 if (!channels_[1].get()) | 122 if (!channels_[1].get()) |
122 CreateAndInitChannel(1); | 123 CreateAndInitChannel(1); |
(...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
584 | 585 |
585 mp1->Close(1); | 586 mp1->Close(1); |
586 | 587 |
587 RestoreInitialState(); | 588 RestoreInitialState(); |
588 } | 589 } |
589 } | 590 } |
590 | 591 |
591 } // namespace | 592 } // namespace |
592 } // namespace system | 593 } // namespace system |
593 } // namespace mojo | 594 } // namespace mojo |
OLD | NEW |