OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "base/bind.h" | 5 #include "base/bind.h" |
6 #include "base/callback.h" | 6 #include "base/callback.h" |
7 #include "base/message_loop/message_loop.h" | 7 #include "base/message_loop/message_loop.h" |
8 #include "base/single_thread_task_runner.h" | 8 #include "base/single_thread_task_runner.h" |
9 #include "base/synchronization/lock.h" | 9 #include "base/synchronization/lock.h" |
10 #include "base/synchronization/waitable_event.h" | 10 #include "base/synchronization/waitable_event.h" |
11 #include "base/threading/platform_thread.h" | 11 #include "base/threading/platform_thread.h" |
12 #include "mojo/public/cpp/bindings/associated_binding.h" | 12 #include "mojo/public/cpp/bindings/associated_binding.h" |
13 #include "mojo/public/cpp/bindings/associated_group.h" | |
14 #include "mojo/public/cpp/bindings/associated_interface_ptr.h" | 13 #include "mojo/public/cpp/bindings/associated_interface_ptr.h" |
15 #include "mojo/public/cpp/bindings/associated_interface_ptr_info.h" | 14 #include "mojo/public/cpp/bindings/associated_interface_ptr_info.h" |
16 #include "mojo/public/cpp/bindings/associated_interface_request.h" | 15 #include "mojo/public/cpp/bindings/associated_interface_request.h" |
17 #include "mojo/public/cpp/bindings/binding.h" | 16 #include "mojo/public/cpp/bindings/binding.h" |
18 #include "mojo/public/interfaces/bindings/tests/test_associated_interfaces.mojom
.h" | 17 #include "mojo/public/interfaces/bindings/tests/test_associated_interfaces.mojom
.h" |
19 #include "testing/gtest/include/gtest/gtest.h" | 18 #include "testing/gtest/include/gtest/gtest.h" |
20 | 19 |
21 namespace mojo { | 20 namespace mojo { |
22 namespace test { | 21 namespace test { |
23 namespace { | 22 namespace { |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 auto connection_request = | 214 auto connection_request = |
216 MakeRequest(&connection_ptr_, connection_ptr_task_runner_); | 215 MakeRequest(&connection_ptr_, connection_ptr_task_runner_); |
217 connection_impl_.reset(new IntegerSenderConnectionImpl( | 216 connection_impl_.reset(new IntegerSenderConnectionImpl( |
218 std::move(connection_request), connection_binding_task_runner_, | 217 std::move(connection_request), connection_binding_task_runner_, |
219 sender_binding_task_runner_)); | 218 sender_binding_task_runner_)); |
220 | 219 |
221 connection_impl_->set_get_sender_notification( | 220 connection_impl_->set_get_sender_notification( |
222 base::Bind(&AssociatedBindTaskRunnerTest::QuitTaskRunner, | 221 base::Bind(&AssociatedBindTaskRunnerTest::QuitTaskRunner, |
223 base::Unretained(this))); | 222 base::Unretained(this))); |
224 | 223 |
225 connection_ptr_->GetSender(MakeRequest(&sender_ptr_, | 224 connection_ptr_->GetSender( |
226 connection_ptr_.associated_group(), | 225 MakeRequest(&sender_ptr_, nullptr, sender_ptr_task_runner_)); |
227 sender_ptr_task_runner_)); | |
228 connection_binding_task_runner_->Run(); | 226 connection_binding_task_runner_->Run(); |
229 } | 227 } |
230 | 228 |
231 void QuitTaskRunner() { | 229 void QuitTaskRunner() { |
232 connection_binding_task_runner_->Quit(); | 230 connection_binding_task_runner_->Quit(); |
233 } | 231 } |
234 | 232 |
235 base::MessageLoop loop_; | 233 base::MessageLoop loop_; |
236 scoped_refptr<TestTaskRunner> connection_binding_task_runner_; | 234 scoped_refptr<TestTaskRunner> connection_binding_task_runner_; |
237 scoped_refptr<TestTaskRunner> connection_ptr_task_runner_; | 235 scoped_refptr<TestTaskRunner> connection_ptr_task_runner_; |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
386 EXPECT_TRUE(sender_impl_error); | 384 EXPECT_TRUE(sender_impl_error); |
387 connection_ptr_task_runner_->Run(); | 385 connection_ptr_task_runner_->Run(); |
388 EXPECT_TRUE(connection_ptr_error); | 386 EXPECT_TRUE(connection_ptr_error); |
389 sender_ptr_task_runner_->Run(); | 387 sender_ptr_task_runner_->Run(); |
390 EXPECT_TRUE(sender_ptr_error); | 388 EXPECT_TRUE(sender_ptr_error); |
391 } | 389 } |
392 | 390 |
393 } // namespace | 391 } // namespace |
394 } // namespace test | 392 } // namespace test |
395 } // namespace mojo | 393 } // namespace mojo |
OLD | NEW |