| 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 24 matching lines...) Expand all Loading... |
| 35 MultiplexRouter::MULTI_INTERFACE, false, | 35 MultiplexRouter::MULTI_INTERFACE, false, |
| 36 base::ThreadTaskRunnerHandle::Get()); | 36 base::ThreadTaskRunnerHandle::Get()); |
| 37 router1_ = new MultiplexRouter(std::move(pipe.handle1), | 37 router1_ = new MultiplexRouter(std::move(pipe.handle1), |
| 38 MultiplexRouter::MULTI_INTERFACE, true, | 38 MultiplexRouter::MULTI_INTERFACE, true, |
| 39 base::ThreadTaskRunnerHandle::Get()); | 39 base::ThreadTaskRunnerHandle::Get()); |
| 40 router0_->CreateEndpointHandlePair(&endpoint0_, &endpoint1_); | 40 router0_->CreateEndpointHandlePair(&endpoint0_, &endpoint1_); |
| 41 endpoint1_ = | 41 endpoint1_ = |
| 42 EmulatePassingEndpointHandle(std::move(endpoint1_), router1_.get()); | 42 EmulatePassingEndpointHandle(std::move(endpoint1_), router1_.get()); |
| 43 } | 43 } |
| 44 | 44 |
| 45 void TearDown() override {} | 45 void TearDown() override { |
| 46 endpoint1_.reset(); |
| 47 endpoint0_.reset(); |
| 48 router1_ = nullptr; |
| 49 router0_ = nullptr; |
| 50 } |
| 46 | 51 |
| 47 void PumpMessages() { base::RunLoop().RunUntilIdle(); } | 52 void PumpMessages() { base::RunLoop().RunUntilIdle(); } |
| 48 | 53 |
| 49 ScopedInterfaceEndpointHandle EmulatePassingEndpointHandle( | 54 ScopedInterfaceEndpointHandle EmulatePassingEndpointHandle( |
| 50 ScopedInterfaceEndpointHandle handle, | 55 ScopedInterfaceEndpointHandle handle, |
| 51 MultiplexRouter* target) { | 56 MultiplexRouter* target) { |
| 52 CHECK(!handle.is_local()); | 57 CHECK(!handle.is_local()); |
| 53 | 58 |
| 54 return target->CreateLocalEndpointHandle(handle.release()); | 59 return target->CreateLocalEndpointHandle(handle.release()); |
| 55 } | 60 } |
| (...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 310 | 315 |
| 311 EXPECT_FALSE(generator.responder_is_valid()); | 316 EXPECT_FALSE(generator.responder_is_valid()); |
| 312 generator.CompleteWithResponse(); // This should end up doing nothing. | 317 generator.CompleteWithResponse(); // This should end up doing nothing. |
| 313 } | 318 } |
| 314 | 319 |
| 315 // TODO(yzshen): add more tests. | 320 // TODO(yzshen): add more tests. |
| 316 | 321 |
| 317 } // namespace | 322 } // namespace |
| 318 } // namespace test | 323 } // namespace test |
| 319 } // namespace mojo | 324 } // namespace mojo |
| OLD | NEW |