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" | 10 #include "mojo/public/cpp/environment/environment.h" |
(...skipping 26 matching lines...) Expand all Loading... |
37 : was_deleted_(was_deleted) {} | 37 : was_deleted_(was_deleted) {} |
38 ~ServiceImpl() override { | 38 ~ServiceImpl() override { |
39 if (was_deleted_) | 39 if (was_deleted_) |
40 *was_deleted_ = true; | 40 *was_deleted_ = true; |
41 } | 41 } |
42 | 42 |
43 private: | 43 private: |
44 // sample::Service implementation | 44 // sample::Service implementation |
45 void Frobinate(sample::FooPtr foo, | 45 void Frobinate(sample::FooPtr foo, |
46 BazOptions options, | 46 BazOptions options, |
47 sample::PortPtr port, | 47 mojo::InterfaceHandle<sample::Port> port, |
48 const FrobinateCallback& callback) override { | 48 const FrobinateCallback& callback) override { |
49 callback.Run(1); | 49 callback.Run(1); |
50 } | 50 } |
51 void GetPort(InterfaceRequest<sample::Port> port) override {} | 51 void GetPort(InterfaceRequest<sample::Port> port) override {} |
52 | 52 |
53 bool* const was_deleted_; | 53 bool* const was_deleted_; |
54 | 54 |
55 MOJO_DISALLOW_COPY_AND_ASSIGN(ServiceImpl); | 55 MOJO_DISALLOW_COPY_AND_ASSIGN(ServiceImpl); |
56 }; | 56 }; |
57 | 57 |
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
329 | 329 |
330 // Tests that StrongBinding::Unbind() compiles. | 330 // Tests that StrongBinding::Unbind() compiles. |
331 TEST_F(BindingTest, StrongBindingUnbindCompile) { | 331 TEST_F(BindingTest, StrongBindingUnbindCompile) { |
332 ServiceImpl impl; | 332 ServiceImpl impl; |
333 sample::ServicePtr ptr; | 333 sample::ServicePtr ptr; |
334 StrongBinding<sample::Service> binding(&impl, GetProxy(&ptr)); | 334 StrongBinding<sample::Service> binding(&impl, GetProxy(&ptr)); |
335 binding.Unbind(); | 335 binding.Unbind(); |
336 } | 336 } |
337 | 337 |
338 } // namespace | 338 } // namespace |
339 } // mojo | 339 } // namespace mojo |
OLD | NEW |