| 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 #include "mojo/edk/system/endpoint_relayer.h" | 5 #include "mojo/edk/system/endpoint_relayer.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/synchronization/waitable_event.h" | 8 #include "base/synchronization/waitable_event.h" |
| 9 #include "base/test/test_timeouts.h" | 9 #include "base/test/test_timeouts.h" |
| 10 #include "mojo/edk/system/channel_endpoint_id.h" | 10 #include "mojo/edk/system/channel_endpoint_id.h" |
| 11 #include "mojo/edk/system/channel_test_base.h" | 11 #include "mojo/edk/system/channel_test_base.h" |
| 12 #include "mojo/edk/system/make_unique.h" |
| 12 #include "mojo/edk/system/message_in_transit_queue.h" | 13 #include "mojo/edk/system/message_in_transit_queue.h" |
| 13 #include "mojo/edk/system/message_in_transit_test_utils.h" | 14 #include "mojo/edk/system/message_in_transit_test_utils.h" |
| 14 #include "mojo/edk/system/test_channel_endpoint_client.h" | 15 #include "mojo/edk/system/test_channel_endpoint_client.h" |
| 15 #include "mojo/public/cpp/system/macros.h" | 16 #include "mojo/public/cpp/system/macros.h" |
| 16 | 17 |
| 17 namespace mojo { | 18 namespace mojo { |
| 18 namespace system { | 19 namespace system { |
| 19 namespace { | 20 namespace { |
| 20 | 21 |
| 21 class EndpointRelayerTest : public test::ChannelTestBase { | 22 class EndpointRelayerTest : public test::ChannelTestBase { |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 } | 178 } |
| 178 | 179 |
| 179 private: | 180 private: |
| 180 MessageInTransitQueue* const filtered_messages_; | 181 MessageInTransitQueue* const filtered_messages_; |
| 181 | 182 |
| 182 MOJO_DISALLOW_COPY_AND_ASSIGN(TestFilter); | 183 MOJO_DISALLOW_COPY_AND_ASSIGN(TestFilter); |
| 183 }; | 184 }; |
| 184 | 185 |
| 185 TEST_F(EndpointRelayerTest, Filter) { | 186 TEST_F(EndpointRelayerTest, Filter) { |
| 186 MessageInTransitQueue filtered_messages; | 187 MessageInTransitQueue filtered_messages; |
| 187 relayer()->SetFilter(make_scoped_ptr(new TestFilter(&filtered_messages))); | 188 relayer()->SetFilter(MakeUnique<TestFilter>(&filtered_messages)); |
| 188 | 189 |
| 189 EXPECT_TRUE(endpoint1a()->EnqueueMessage(test::MakeTestMessage(1))); | 190 EXPECT_TRUE(endpoint1a()->EnqueueMessage(test::MakeTestMessage(1))); |
| 190 EXPECT_TRUE(endpoint1a()->EnqueueMessage(test::MakeTestMessage(2))); | 191 EXPECT_TRUE(endpoint1a()->EnqueueMessage(test::MakeTestMessage(2))); |
| 191 EXPECT_TRUE(endpoint1a()->EnqueueMessage(test::MakeTestMessage(1001))); | 192 EXPECT_TRUE(endpoint1a()->EnqueueMessage(test::MakeTestMessage(1001))); |
| 192 EXPECT_TRUE(endpoint1a()->EnqueueMessage(test::MakeTestMessage(3))); | 193 EXPECT_TRUE(endpoint1a()->EnqueueMessage(test::MakeTestMessage(3))); |
| 193 EXPECT_TRUE(endpoint1a()->EnqueueMessage(test::MakeTestMessage(4))); | 194 EXPECT_TRUE(endpoint1a()->EnqueueMessage(test::MakeTestMessage(4))); |
| 194 EXPECT_TRUE(endpoint1a()->EnqueueMessage(test::MakeTestMessage(1002))); | 195 EXPECT_TRUE(endpoint1a()->EnqueueMessage(test::MakeTestMessage(1002))); |
| 195 EXPECT_TRUE(endpoint1a()->EnqueueMessage(test::MakeTestMessage(1003))); | 196 EXPECT_TRUE(endpoint1a()->EnqueueMessage(test::MakeTestMessage(1003))); |
| 196 EXPECT_TRUE(endpoint1a()->EnqueueMessage(test::MakeTestMessage(5))); | 197 EXPECT_TRUE(endpoint1a()->EnqueueMessage(test::MakeTestMessage(5))); |
| 197 | 198 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 222 ASSERT_TRUE(message); | 223 ASSERT_TRUE(message); |
| 223 test::VerifyTestMessage(message.get(), message_id); | 224 test::VerifyTestMessage(message.get(), message_id); |
| 224 } | 225 } |
| 225 } | 226 } |
| 226 | 227 |
| 227 // TODO(vtl): Add some "shutdown" tests. | 228 // TODO(vtl): Add some "shutdown" tests. |
| 228 | 229 |
| 229 } // namespace | 230 } // namespace |
| 230 } // namespace system | 231 } // namespace system |
| 231 } // namespace mojo | 232 } // namespace mojo |
| OLD | NEW |