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 <string> | 5 #include <string> |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
11 #include "base/run_loop.h" | 11 #include "base/run_loop.h" |
| 12 #include "mojo/public/cpp/bindings/binding_set.h" |
12 #include "mojo/public/cpp/bindings/interface_request.h" | 13 #include "mojo/public/cpp/bindings/interface_request.h" |
13 #include "mojo/public/cpp/bindings/tests/pickled_struct_blink.h" | 14 #include "mojo/public/cpp/bindings/tests/pickled_struct_blink.h" |
14 #include "mojo/public/cpp/bindings/tests/pickled_struct_chromium.h" | 15 #include "mojo/public/cpp/bindings/tests/pickled_struct_chromium.h" |
15 #include "mojo/public/cpp/bindings/weak_binding_set.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 |
25 template <typename T> | 25 template <typename T> |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 template <typename ProxyType = blink::PicklePasser> | 127 template <typename ProxyType = blink::PicklePasser> |
128 mojo::InterfacePtr<ProxyType> ConnectToBlinkService() { | 128 mojo::InterfacePtr<ProxyType> ConnectToBlinkService() { |
129 mojo::InterfacePtr<ProxyType> proxy; | 129 mojo::InterfacePtr<ProxyType> proxy; |
130 blink_bindings_.AddBinding(&blink_service_, GetProxy(&proxy)); | 130 blink_bindings_.AddBinding(&blink_service_, GetProxy(&proxy)); |
131 return proxy; | 131 return proxy; |
132 } | 132 } |
133 | 133 |
134 private: | 134 private: |
135 base::MessageLoop loop_; | 135 base::MessageLoop loop_; |
136 ChromiumPicklePasserImpl chromium_service_; | 136 ChromiumPicklePasserImpl chromium_service_; |
137 mojo::WeakBindingSet<chromium::PicklePasser> chromium_bindings_; | 137 mojo::BindingSet<chromium::PicklePasser> chromium_bindings_; |
138 BlinkPicklePasserImpl blink_service_; | 138 BlinkPicklePasserImpl blink_service_; |
139 mojo::WeakBindingSet<blink::PicklePasser> blink_bindings_; | 139 mojo::BindingSet<blink::PicklePasser> blink_bindings_; |
140 }; | 140 }; |
141 | 141 |
142 } // namespace | 142 } // namespace |
143 | 143 |
144 TEST_F(PickleTest, ChromiumProxyToChromiumService) { | 144 TEST_F(PickleTest, ChromiumProxyToChromiumService) { |
145 auto chromium_proxy = ConnectToChromiumService(); | 145 auto chromium_proxy = ConnectToChromiumService(); |
146 { | 146 { |
147 base::RunLoop loop; | 147 base::RunLoop loop; |
148 chromium_proxy->PassPickle( | 148 chromium_proxy->PassPickle( |
149 PickledStructChromium(1, 2), | 149 PickledStructChromium(1, 2), |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
304 EXPECT_EQ(43, passed->pickle.bar()); | 304 EXPECT_EQ(43, passed->pickle.bar()); |
305 EXPECT_EQ(0, passed->pickle.baz()); | 305 EXPECT_EQ(0, passed->pickle.baz()); |
306 run_loop.Quit(); | 306 run_loop.Quit(); |
307 }); | 307 }); |
308 run_loop.Run(); | 308 run_loop.Run(); |
309 } | 309 } |
310 } | 310 } |
311 | 311 |
312 } // namespace test | 312 } // namespace test |
313 } // namespace mojo | 313 } // namespace mojo |
OLD | NEW |