| 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/public/cpp/bindings/lib/multiplex_router.h" | 5 #include "mojo/public/cpp/bindings/lib/multiplex_router.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 namespace { | 24 namespace { |
| 25 | 25 |
| 26 using mojo::internal::MultiplexRouter; | 26 using mojo::internal::MultiplexRouter; |
| 27 | 27 |
| 28 class MultiplexRouterTest : public testing::Test { | 28 class MultiplexRouterTest : public testing::Test { |
| 29 public: | 29 public: |
| 30 MultiplexRouterTest() {} | 30 MultiplexRouterTest() {} |
| 31 | 31 |
| 32 void SetUp() override { | 32 void SetUp() override { |
| 33 MessagePipe pipe; | 33 MessagePipe pipe; |
| 34 router0_ = new MultiplexRouter(true, std::move(pipe.handle0), | 34 router0_ = new MultiplexRouter(std::move(pipe.handle0), |
| 35 MultiplexRouter::MULTI_INTERFACE, false, |
| 35 base::ThreadTaskRunnerHandle::Get()); | 36 base::ThreadTaskRunnerHandle::Get()); |
| 36 router1_ = new MultiplexRouter(true, std::move(pipe.handle1), | 37 router1_ = new MultiplexRouter(std::move(pipe.handle1), |
| 38 MultiplexRouter::MULTI_INTERFACE, true, |
| 37 base::ThreadTaskRunnerHandle::Get()); | 39 base::ThreadTaskRunnerHandle::Get()); |
| 38 router0_->CreateEndpointHandlePair(&endpoint0_, &endpoint1_); | 40 router0_->CreateEndpointHandlePair(&endpoint0_, &endpoint1_); |
| 39 endpoint1_ = | 41 endpoint1_ = |
| 40 EmulatePassingEndpointHandle(std::move(endpoint1_), router1_.get()); | 42 EmulatePassingEndpointHandle(std::move(endpoint1_), router1_.get()); |
| 41 } | 43 } |
| 42 | 44 |
| 43 void TearDown() override {} | 45 void TearDown() override {} |
| 44 | 46 |
| 45 void PumpMessages() { base::RunLoop().RunUntilIdle(); } | 47 void PumpMessages() { base::RunLoop().RunUntilIdle(); } |
| 46 | 48 |
| (...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 308 | 310 |
| 309 EXPECT_FALSE(generator.responder_is_valid()); | 311 EXPECT_FALSE(generator.responder_is_valid()); |
| 310 generator.CompleteWithResponse(); // This should end up doing nothing. | 312 generator.CompleteWithResponse(); // This should end up doing nothing. |
| 311 } | 313 } |
| 312 | 314 |
| 313 // TODO(yzshen): add more tests. | 315 // TODO(yzshen): add more tests. |
| 314 | 316 |
| 315 } // namespace | 317 } // namespace |
| 316 } // namespace test | 318 } // namespace test |
| 317 } // namespace mojo | 319 } // namespace mojo |
| OLD | NEW |