| 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 "mojo/edk/system/channel.h" | 5 #include "mojo/edk/system/channel.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/location.h" | 8 #include "base/location.h" |
| 9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "base/test/test_io_thread.h" | 10 #include "base/test/test_io_thread.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 | 26 |
| 27 Tristate BoolToTristate(bool b) { | 27 Tristate BoolToTristate(bool b) { |
| 28 return b ? TRISTATE_TRUE : TRISTATE_FALSE; | 28 return b ? TRISTATE_TRUE : TRISTATE_FALSE; |
| 29 } | 29 } |
| 30 | 30 |
| 31 class ChannelTest : public testing::Test { | 31 class ChannelTest : public testing::Test { |
| 32 public: | 32 public: |
| 33 ChannelTest() | 33 ChannelTest() |
| 34 : io_thread_(base::TestIOThread::kAutoStart), | 34 : io_thread_(base::TestIOThread::kAutoStart), |
| 35 init_result_(TRISTATE_UNKNOWN) {} | 35 init_result_(TRISTATE_UNKNOWN) {} |
| 36 virtual ~ChannelTest() {} | 36 ~ChannelTest() override {} |
| 37 | 37 |
| 38 virtual void SetUp() override { | 38 void SetUp() override { |
| 39 io_thread_.PostTaskAndWait( | 39 io_thread_.PostTaskAndWait( |
| 40 FROM_HERE, | 40 FROM_HERE, |
| 41 base::Bind(&ChannelTest::SetUpOnIOThread, base::Unretained(this))); | 41 base::Bind(&ChannelTest::SetUpOnIOThread, base::Unretained(this))); |
| 42 } | 42 } |
| 43 | 43 |
| 44 void CreateChannelOnIOThread() { | 44 void CreateChannelOnIOThread() { |
| 45 CHECK_EQ(base::MessageLoop::current(), io_thread()->message_loop()); | 45 CHECK_EQ(base::MessageLoop::current(), io_thread()->message_loop()); |
| 46 channel_ = new Channel(&platform_support_); | 46 channel_ = new Channel(&platform_support_); |
| 47 } | 47 } |
| 48 | 48 |
| (...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 297 mp->Close(0); | 297 mp->Close(0); |
| 298 | 298 |
| 299 EXPECT_TRUE(channel()->HasOneRef()); | 299 EXPECT_TRUE(channel()->HasOneRef()); |
| 300 } | 300 } |
| 301 | 301 |
| 302 // TODO(vtl): More. ------------------------------------------------------------ | 302 // TODO(vtl): More. ------------------------------------------------------------ |
| 303 | 303 |
| 304 } // namespace | 304 } // namespace |
| 305 } // namespace system | 305 } // namespace system |
| 306 } // namespace mojo | 306 } // namespace mojo |
| OLD | NEW |