Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(353)

Side by Side Diff: mojo/public/cpp/bindings/tests/struct_traits_unittest.cc

Issue 2589663003: mojo:: Rename mojo::GetProxy() to mojo::MakeRequest() (Closed)
Patch Set: Rebase Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/binding_set.h"
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 BlinkRectServiceImpl blink_service_; 194 BlinkRectServiceImpl blink_service_;
195 BindingSet<blink::RectService> blink_bindings_; 195 BindingSet<blink::RectService> blink_bindings_;
196 196
197 BindingSet<TraitsTestService> traits_test_bindings_; 197 BindingSet<TraitsTestService> traits_test_bindings_;
198 }; 198 };
199 199
200 } // namespace 200 } // namespace
201 201
202 TEST_F(StructTraitsTest, ChromiumProxyToChromiumService) { 202 TEST_F(StructTraitsTest, ChromiumProxyToChromiumService) {
203 RectServicePtr chromium_proxy; 203 RectServicePtr chromium_proxy;
204 BindToChromiumService(GetProxy(&chromium_proxy)); 204 BindToChromiumService(MakeRequest(&chromium_proxy));
205 { 205 {
206 base::RunLoop loop; 206 base::RunLoop loop;
207 chromium_proxy->AddRect(RectChromium(1, 1, 4, 5)); 207 chromium_proxy->AddRect(RectChromium(1, 1, 4, 5));
208 chromium_proxy->AddRect(RectChromium(-1, -1, 2, 2)); 208 chromium_proxy->AddRect(RectChromium(-1, -1, 2, 2));
209 chromium_proxy->GetLargestRect( 209 chromium_proxy->GetLargestRect(
210 ExpectResult(RectChromium(1, 1, 4, 5), loop.QuitClosure())); 210 ExpectResult(RectChromium(1, 1, 4, 5), loop.QuitClosure()));
211 loop.Run(); 211 loop.Run();
212 } 212 }
213 { 213 {
214 base::RunLoop loop; 214 base::RunLoop loop;
215 chromium_proxy->PassSharedRect( 215 chromium_proxy->PassSharedRect(
216 {1, 2, 3, 4}, 216 {1, 2, 3, 4},
217 ExpectResult(SharedRect({1, 2, 3, 4}), loop.QuitClosure())); 217 ExpectResult(SharedRect({1, 2, 3, 4}), loop.QuitClosure()));
218 loop.Run(); 218 loop.Run();
219 } 219 }
220 } 220 }
221 221
222 TEST_F(StructTraitsTest, ChromiumToBlinkService) { 222 TEST_F(StructTraitsTest, ChromiumToBlinkService) {
223 RectServicePtr chromium_proxy; 223 RectServicePtr chromium_proxy;
224 BindToBlinkService(GetProxy(&chromium_proxy)); 224 BindToBlinkService(MakeRequest(&chromium_proxy));
225 { 225 {
226 base::RunLoop loop; 226 base::RunLoop loop;
227 chromium_proxy->AddRect(RectChromium(1, 1, 4, 5)); 227 chromium_proxy->AddRect(RectChromium(1, 1, 4, 5));
228 chromium_proxy->AddRect(RectChromium(2, 2, 5, 5)); 228 chromium_proxy->AddRect(RectChromium(2, 2, 5, 5));
229 chromium_proxy->GetLargestRect( 229 chromium_proxy->GetLargestRect(
230 ExpectResult(RectChromium(2, 2, 5, 5), loop.QuitClosure())); 230 ExpectResult(RectChromium(2, 2, 5, 5), loop.QuitClosure()));
231 loop.Run(); 231 loop.Run();
232 } 232 }
233 { 233 {
234 base::RunLoop loop; 234 base::RunLoop loop;
235 chromium_proxy->PassSharedRect( 235 chromium_proxy->PassSharedRect(
236 {1, 2, 3, 4}, 236 {1, 2, 3, 4},
237 ExpectResult(SharedRect({1, 2, 3, 4}), loop.QuitClosure())); 237 ExpectResult(SharedRect({1, 2, 3, 4}), loop.QuitClosure()));
238 loop.Run(); 238 loop.Run();
239 } 239 }
240 // The Blink service should drop our connection because RectBlink's 240 // The Blink service should drop our connection because RectBlink's
241 // deserializer rejects negative origins. 241 // deserializer rejects negative origins.
242 { 242 {
243 base::RunLoop loop; 243 base::RunLoop loop;
244 ExpectError(&chromium_proxy, loop.QuitClosure()); 244 ExpectError(&chromium_proxy, loop.QuitClosure());
245 chromium_proxy->AddRect(RectChromium(-1, -1, 2, 2)); 245 chromium_proxy->AddRect(RectChromium(-1, -1, 2, 2));
246 chromium_proxy->GetLargestRect( 246 chromium_proxy->GetLargestRect(
247 Fail<RectChromium>("The pipe should have been closed.")); 247 Fail<RectChromium>("The pipe should have been closed."));
248 loop.Run(); 248 loop.Run();
249 } 249 }
250 } 250 }
251 251
252 TEST_F(StructTraitsTest, BlinkProxyToBlinkService) { 252 TEST_F(StructTraitsTest, BlinkProxyToBlinkService) {
253 blink::RectServicePtr blink_proxy; 253 blink::RectServicePtr blink_proxy;
254 BindToBlinkService(GetProxy(&blink_proxy)); 254 BindToBlinkService(MakeRequest(&blink_proxy));
255 { 255 {
256 base::RunLoop loop; 256 base::RunLoop loop;
257 blink_proxy->AddRect(RectBlink(1, 1, 4, 5)); 257 blink_proxy->AddRect(RectBlink(1, 1, 4, 5));
258 blink_proxy->AddRect(RectBlink(10, 10, 20, 20)); 258 blink_proxy->AddRect(RectBlink(10, 10, 20, 20));
259 blink_proxy->GetLargestRect( 259 blink_proxy->GetLargestRect(
260 ExpectResult(RectBlink(10, 10, 20, 20), loop.QuitClosure())); 260 ExpectResult(RectBlink(10, 10, 20, 20), loop.QuitClosure()));
261 loop.Run(); 261 loop.Run();
262 } 262 }
263 { 263 {
264 base::RunLoop loop; 264 base::RunLoop loop;
265 blink_proxy->PassSharedRect( 265 blink_proxy->PassSharedRect(
266 {4, 3, 2, 1}, 266 {4, 3, 2, 1},
267 ExpectResult(SharedRect({4, 3, 2, 1}), loop.QuitClosure())); 267 ExpectResult(SharedRect({4, 3, 2, 1}), loop.QuitClosure()));
268 loop.Run(); 268 loop.Run();
269 } 269 }
270 } 270 }
271 271
272 TEST_F(StructTraitsTest, BlinkProxyToChromiumService) { 272 TEST_F(StructTraitsTest, BlinkProxyToChromiumService) {
273 blink::RectServicePtr blink_proxy; 273 blink::RectServicePtr blink_proxy;
274 BindToChromiumService(GetProxy(&blink_proxy)); 274 BindToChromiumService(MakeRequest(&blink_proxy));
275 { 275 {
276 base::RunLoop loop; 276 base::RunLoop loop;
277 blink_proxy->AddRect(RectBlink(1, 1, 4, 5)); 277 blink_proxy->AddRect(RectBlink(1, 1, 4, 5));
278 blink_proxy->AddRect(RectBlink(10, 10, 2, 2)); 278 blink_proxy->AddRect(RectBlink(10, 10, 2, 2));
279 blink_proxy->GetLargestRect( 279 blink_proxy->GetLargestRect(
280 ExpectResult(RectBlink(1, 1, 4, 5), loop.QuitClosure())); 280 ExpectResult(RectBlink(1, 1, 4, 5), loop.QuitClosure()));
281 loop.Run(); 281 loop.Run();
282 } 282 }
283 { 283 {
284 base::RunLoop loop; 284 base::RunLoop loop;
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after
543 quit_closure.Run(); 543 quit_closure.Run();
544 544
545 }, 545 },
546 loop.QuitClosure())); 546 loop.QuitClosure()));
547 loop.Run(); 547 loop.Run();
548 } 548 }
549 } 549 }
550 550
551 } // namespace test 551 } // namespace test
552 } // namespace mojo 552 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/public/cpp/bindings/tests/request_response_unittest.cc ('k') | mojo/public/cpp/bindings/tests/sync_method_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698