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 "base/bind.h" | 5 #include "base/bind.h" |
6 #include "base/callback.h" | 6 #include "base/callback.h" |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
| 10 #include "mojo/public/cpp/bindings/binding_set.h" |
10 #include "mojo/public/cpp/bindings/interface_request.h" | 11 #include "mojo/public/cpp/bindings/interface_request.h" |
11 #include "mojo/public/cpp/bindings/tests/rect_blink.h" | 12 #include "mojo/public/cpp/bindings/tests/rect_blink.h" |
12 #include "mojo/public/cpp/bindings/tests/rect_chromium.h" | 13 #include "mojo/public/cpp/bindings/tests/rect_chromium.h" |
13 #include "mojo/public/cpp/bindings/tests/struct_with_traits_impl.h" | 14 #include "mojo/public/cpp/bindings/tests/struct_with_traits_impl.h" |
14 #include "mojo/public/cpp/bindings/weak_binding_set.h" | |
15 #include "mojo/public/interfaces/bindings/tests/struct_with_traits.mojom.h" | 15 #include "mojo/public/interfaces/bindings/tests/struct_with_traits.mojom.h" |
16 #include "mojo/public/interfaces/bindings/tests/test_native_types.mojom-blink.h" | 16 #include "mojo/public/interfaces/bindings/tests/test_native_types.mojom-blink.h" |
17 #include "mojo/public/interfaces/bindings/tests/test_native_types.mojom-chromium
.h" | 17 #include "mojo/public/interfaces/bindings/tests/test_native_types.mojom-chromium
.h" |
18 #include "mojo/public/interfaces/bindings/tests/test_native_types.mojom.h" | 18 #include "mojo/public/interfaces/bindings/tests/test_native_types.mojom.h" |
19 #include "testing/gtest/include/gtest/gtest.h" | 19 #include "testing/gtest/include/gtest/gtest.h" |
20 | 20 |
21 namespace mojo { | 21 namespace mojo { |
22 namespace test { | 22 namespace test { |
23 namespace { | 23 namespace { |
24 | 24 |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 // TraitsTestService: | 119 // TraitsTestService: |
120 void PassStructWithTraits( | 120 void PassStructWithTraits( |
121 const StructWithTraitsImpl& s, | 121 const StructWithTraitsImpl& s, |
122 const PassStructWithTraitsCallback& callback) override { | 122 const PassStructWithTraitsCallback& callback) override { |
123 callback.Run(s); | 123 callback.Run(s); |
124 } | 124 } |
125 | 125 |
126 base::MessageLoop loop_; | 126 base::MessageLoop loop_; |
127 | 127 |
128 ChromiumRectServiceImpl chromium_service_; | 128 ChromiumRectServiceImpl chromium_service_; |
129 mojo::WeakBindingSet<chromium::RectService> chromium_bindings_; | 129 mojo::BindingSet<chromium::RectService> chromium_bindings_; |
130 | 130 |
131 BlinkRectServiceImpl blink_service_; | 131 BlinkRectServiceImpl blink_service_; |
132 mojo::WeakBindingSet<blink::RectService> blink_bindings_; | 132 mojo::BindingSet<blink::RectService> blink_bindings_; |
133 | 133 |
134 mojo::WeakBindingSet<TraitsTestService> traits_test_bindings_; | 134 mojo::BindingSet<TraitsTestService> traits_test_bindings_; |
135 }; | 135 }; |
136 | 136 |
137 } // namespace | 137 } // namespace |
138 | 138 |
139 TEST_F(StructTraitsTest, ChromiumProxyToChromiumService) { | 139 TEST_F(StructTraitsTest, ChromiumProxyToChromiumService) { |
140 chromium::RectServicePtr chromium_proxy; | 140 chromium::RectServicePtr chromium_proxy; |
141 BindToChromiumService(GetProxy(&chromium_proxy)); | 141 BindToChromiumService(GetProxy(&chromium_proxy)); |
142 { | 142 { |
143 base::RunLoop loop; | 143 base::RunLoop loop; |
144 chromium_proxy->AddRect(RectChromium(1, 1, 4, 5)); | 144 chromium_proxy->AddRect(RectChromium(1, 1, 4, 5)); |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 EXPECT_EQ(input.get_uint32(), passed.get_uint32()); | 214 EXPECT_EQ(input.get_uint32(), passed.get_uint32()); |
215 EXPECT_EQ(input.get_uint64(), passed.get_uint64()); | 215 EXPECT_EQ(input.get_uint64(), passed.get_uint64()); |
216 EXPECT_EQ(input.get_string(), passed.get_string()); | 216 EXPECT_EQ(input.get_string(), passed.get_string()); |
217 loop.Quit(); | 217 loop.Quit(); |
218 }); | 218 }); |
219 loop.Run(); | 219 loop.Run(); |
220 } | 220 } |
221 | 221 |
222 } // namespace test | 222 } // namespace test |
223 } // namespace mojo | 223 } // namespace mojo |
OLD | NEW |