| 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 // Note: This file tests both binding.h (mojo::Binding) and strong_binding.h | 5 // Note: This file tests both binding.h (mojo::Binding) and strong_binding.h |
| 6 // (mojo::StrongBinding). | 6 // (mojo::StrongBinding). |
| 7 | 7 |
| 8 #include "mojo/public/cpp/bindings/binding.h" | 8 #include "mojo/public/cpp/bindings/binding.h" |
| 9 #include "mojo/public/cpp/bindings/strong_binding.h" | 9 #include "mojo/public/cpp/bindings/strong_binding.h" |
| 10 #include "mojo/public/cpp/environment/environment.h" | |
| 11 #include "mojo/public/cpp/system/macros.h" | 10 #include "mojo/public/cpp/system/macros.h" |
| 12 #include "mojo/public/cpp/utility/run_loop.h" | 11 #include "mojo/public/cpp/utility/run_loop.h" |
| 13 #include "mojo/public/interfaces/bindings/tests/sample_interfaces.mojom.h" | 12 #include "mojo/public/interfaces/bindings/tests/sample_interfaces.mojom.h" |
| 14 #include "mojo/public/interfaces/bindings/tests/sample_service.mojom.h" | 13 #include "mojo/public/interfaces/bindings/tests/sample_service.mojom.h" |
| 15 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
| 16 | 15 |
| 17 namespace mojo { | 16 namespace mojo { |
| 18 namespace { | 17 namespace { |
| 19 | 18 |
| 20 class BindingTestBase : public testing::Test { | 19 class BindingTestBase : public testing::Test { |
| 21 public: | 20 public: |
| 22 BindingTestBase() {} | 21 BindingTestBase() {} |
| 23 ~BindingTestBase() override {} | 22 ~BindingTestBase() override {} |
| 24 | 23 |
| 25 RunLoop& loop() { return loop_; } | 24 RunLoop& loop() { return loop_; } |
| 26 | 25 |
| 27 private: | 26 private: |
| 28 Environment env_; | |
| 29 RunLoop loop_; | 27 RunLoop loop_; |
| 30 | 28 |
| 31 MOJO_DISALLOW_COPY_AND_ASSIGN(BindingTestBase); | 29 MOJO_DISALLOW_COPY_AND_ASSIGN(BindingTestBase); |
| 32 }; | 30 }; |
| 33 | 31 |
| 34 class ServiceImpl : public sample::Service { | 32 class ServiceImpl : public sample::Service { |
| 35 public: | 33 public: |
| 36 explicit ServiceImpl(bool* was_deleted = nullptr) | 34 explicit ServiceImpl(bool* was_deleted = nullptr) |
| 37 : was_deleted_(was_deleted) {} | 35 : was_deleted_(was_deleted) {} |
| 38 ~ServiceImpl() override { | 36 ~ServiceImpl() override { |
| (...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 330 // Tests that StrongBinding::Unbind() compiles. | 328 // Tests that StrongBinding::Unbind() compiles. |
| 331 TEST_F(BindingTest, StrongBindingUnbindCompile) { | 329 TEST_F(BindingTest, StrongBindingUnbindCompile) { |
| 332 ServiceImpl impl; | 330 ServiceImpl impl; |
| 333 sample::ServicePtr ptr; | 331 sample::ServicePtr ptr; |
| 334 StrongBinding<sample::Service> binding(&impl, GetProxy(&ptr)); | 332 StrongBinding<sample::Service> binding(&impl, GetProxy(&ptr)); |
| 335 binding.Unbind(); | 333 binding.Unbind(); |
| 336 } | 334 } |
| 337 | 335 |
| 338 } // namespace | 336 } // namespace |
| 339 } // namespace mojo | 337 } // namespace mojo |
| OLD | NEW |