Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(457)

Side by Side Diff: mojo/public/cpp/bindings/tests/multiplex_router_unittest.cc

Issue 2664483002: Support sync mojo IPCs to and from bindings running on a sequence.
Patch Set: Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « mojo/public/cpp/bindings/sync_handle_watcher.h ('k') | mojo/public/cpp/bindings/tests/report_bad_message_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698