| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 // TODO(vtl): Factor out the remaining POSIX-specific bits of this test (once we | 5 // TODO(vtl): Factor out the remaining POSIX-specific bits of this test (once we |
| 6 // have a non-POSIX implementation). | 6 // have a non-POSIX implementation). |
| 7 | 7 |
| 8 #include "mojo/system/raw_channel.h" | 8 #include "mojo/system/raw_channel.h" |
| 9 | 9 |
| 10 #include <fcntl.h> | 10 #include <fcntl.h> |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 RawChannelPosixTest() : io_thread_("io_thread") { | 70 RawChannelPosixTest() : io_thread_("io_thread") { |
| 71 } | 71 } |
| 72 | 72 |
| 73 virtual ~RawChannelPosixTest() { | 73 virtual ~RawChannelPosixTest() { |
| 74 } | 74 } |
| 75 | 75 |
| 76 virtual void SetUp() OVERRIDE { | 76 virtual void SetUp() OVERRIDE { |
| 77 io_thread_.StartWithOptions( | 77 io_thread_.StartWithOptions( |
| 78 base::Thread::Options(base::MessageLoop::TYPE_IO, 0)); | 78 base::Thread::Options(base::MessageLoop::TYPE_IO, 0)); |
| 79 | 79 |
| 80 scoped_ptr<PlatformServerChannel> server_channel( | 80 PlatformChannelPair channel_pair; |
| 81 PlatformServerChannel::Create("channel")); | 81 scoped_ptr<PlatformChannel> server_channel( |
| 82 channel_pair.CreateServerChannel()); |
| 82 CHECK(server_channel.get()); | 83 CHECK(server_channel.get()); |
| 83 CHECK(server_channel->is_valid()); | 84 CHECK(server_channel->is_valid()); |
| 84 scoped_ptr<PlatformClientChannel> client_channel( | 85 scoped_ptr<PlatformChannel> client_channel( |
| 85 server_channel->CreateClientChannel()); | 86 channel_pair.CreateClientChannel()); |
| 86 CHECK(client_channel.get()); | 87 CHECK(client_channel.get()); |
| 87 CHECK(client_channel->is_valid()); | 88 CHECK(client_channel->is_valid()); |
| 88 | 89 |
| 89 handles_[0] = server_channel->PassHandle(); | 90 handles_[0] = server_channel->PassHandle(); |
| 90 handles_[1] = client_channel->PassHandle(); | 91 handles_[1] = client_channel->PassHandle(); |
| 91 } | 92 } |
| 92 | 93 |
| 93 virtual void TearDown() OVERRIDE { | 94 virtual void TearDown() OVERRIDE { |
| 94 if (handles_[0].is_valid()) | 95 if (handles_[0].is_valid()) |
| 95 close(handles_[0].fd); | 96 close(handles_[0].fd); |
| (...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 559 FROM_HERE, | 560 FROM_HERE, |
| 560 base::Bind(&RawChannel::Shutdown, | 561 base::Bind(&RawChannel::Shutdown, |
| 561 base::Unretained(rc.get()))); | 562 base::Unretained(rc.get()))); |
| 562 | 563 |
| 563 EXPECT_FALSE(rc->WriteMessage(MakeTestMessage(1))); | 564 EXPECT_FALSE(rc->WriteMessage(MakeTestMessage(1))); |
| 564 } | 565 } |
| 565 | 566 |
| 566 } // namespace | 567 } // namespace |
| 567 } // namespace system | 568 } // namespace system |
| 568 } // namespace mojo | 569 } // namespace mojo |
| OLD | NEW |