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/raw_channel.h" | 5 #include "mojo/edk/system/raw_channel.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 mojo::test::BlockingWrite( | 66 mojo::test::BlockingWrite( |
67 handle, message->main_buffer(), message->main_buffer_size(), &write_size); | 67 handle, message->main_buffer(), message->main_buffer_size(), &write_size); |
68 return write_size == message->main_buffer_size(); | 68 return write_size == message->main_buffer_size(); |
69 } | 69 } |
70 | 70 |
71 // ----------------------------------------------------------------------------- | 71 // ----------------------------------------------------------------------------- |
72 | 72 |
73 class RawChannelTest : public testing::Test { | 73 class RawChannelTest : public testing::Test { |
74 public: | 74 public: |
75 RawChannelTest() : io_thread_(base::TestIOThread::kManualStart) {} | 75 RawChannelTest() : io_thread_(base::TestIOThread::kManualStart) {} |
76 virtual ~RawChannelTest() {} | 76 ~RawChannelTest() override {} |
77 | 77 |
78 virtual void SetUp() override { | 78 void SetUp() override { |
79 embedder::PlatformChannelPair channel_pair; | 79 embedder::PlatformChannelPair channel_pair; |
80 handles[0] = channel_pair.PassServerHandle(); | 80 handles[0] = channel_pair.PassServerHandle(); |
81 handles[1] = channel_pair.PassClientHandle(); | 81 handles[1] = channel_pair.PassClientHandle(); |
82 io_thread_.Start(); | 82 io_thread_.Start(); |
83 } | 83 } |
84 | 84 |
85 virtual void TearDown() override { | 85 void TearDown() override { |
86 io_thread_.Stop(); | 86 io_thread_.Stop(); |
87 handles[0].reset(); | 87 handles[0].reset(); |
88 handles[1].reset(); | 88 handles[1].reset(); |
89 } | 89 } |
90 | 90 |
91 protected: | 91 protected: |
92 base::TestIOThread* io_thread() { return &io_thread_; } | 92 base::TestIOThread* io_thread() { return &io_thread_; } |
93 | 93 |
94 embedder::ScopedPlatformHandle handles[2]; | 94 embedder::ScopedPlatformHandle handles[2]; |
95 | 95 |
(...skipping 583 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
679 | 679 |
680 EXPECT_FALSE(rc->WriteMessage(MakeTestMessage(1))); | 680 EXPECT_FALSE(rc->WriteMessage(MakeTestMessage(1))); |
681 | 681 |
682 // Wait for the delegate, which will shut the |RawChannel| down. | 682 // Wait for the delegate, which will shut the |RawChannel| down. |
683 delegate.Wait(); | 683 delegate.Wait(); |
684 } | 684 } |
685 | 685 |
686 } // namespace | 686 } // namespace |
687 } // namespace system | 687 } // namespace system |
688 } // namespace mojo | 688 } // namespace mojo |
OLD | NEW |