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

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

Issue 1486713002: Mojo C++ bindings: Add an alias, BarAssociatedPtr, for AssociatedInterfacePtr<Bar>. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
« no previous file with comments | « no previous file | mojo/public/tools/bindings/generators/cpp_templates/module.h.tmpl » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <algorithm> 5 #include <algorithm>
6 6
7 #include "base/bind.h" 7 #include "base/bind.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 "base/threading/thread.h" 10 #include "base/threading/thread.h"
(...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after
470 for (size_t i = 0; i < 2; ++i) { 470 for (size_t i = 0; i < 2; ++i) {
471 for (size_t j = 1; j < receivers[i].values().size(); ++j) 471 for (size_t j = 1; j < receivers[i].values().size(); ++j)
472 EXPECT_LT(receivers[i].values()[j - 1], receivers[i].values()[j]); 472 EXPECT_LT(receivers[i].values()[j - 1], receivers[i].values()[j]);
473 } 473 }
474 } 474 }
475 475
476 TEST_F(AssociatedInterfaceTest, PassAssociatedInterfaces) { 476 TEST_F(AssociatedInterfaceTest, PassAssociatedInterfaces) {
477 IntegerSenderConnectionPtr connection_ptr; 477 IntegerSenderConnectionPtr connection_ptr;
478 IntegerSenderConnectionImpl connection(GetProxy(&connection_ptr)); 478 IntegerSenderConnectionImpl connection(GetProxy(&connection_ptr));
479 479
480 AssociatedInterfacePtr<IntegerSender> sender0; 480 IntegerSenderAssociatedPtr sender0;
481 connection_ptr->GetSender( 481 connection_ptr->GetSender(
482 GetProxy(&sender0, connection_ptr.associated_group())); 482 GetProxy(&sender0, connection_ptr.associated_group()));
483 483
484 int32_t echoed_value = 0; 484 int32_t echoed_value = 0;
485 sender0->Echo(123, [&echoed_value](int32_t value) { echoed_value = value; }); 485 sender0->Echo(123, [&echoed_value](int32_t value) { echoed_value = value; });
486 PumpMessages(); 486 PumpMessages();
487 EXPECT_EQ(123, echoed_value); 487 EXPECT_EQ(123, echoed_value);
488 488
489 AssociatedInterfacePtr<IntegerSender> sender1; 489 IntegerSenderAssociatedPtr sender1;
490 connection_ptr->AsyncGetSender( 490 connection_ptr->AsyncGetSender(
491 [&sender1](AssociatedInterfacePtrInfo<IntegerSender> ptr_info) { 491 [&sender1](AssociatedInterfacePtrInfo<IntegerSender> ptr_info) {
492 sender1.Bind(ptr_info.Pass()); 492 sender1.Bind(ptr_info.Pass());
493 }); 493 });
494 PumpMessages(); 494 PumpMessages();
495 EXPECT_TRUE(sender1); 495 EXPECT_TRUE(sender1);
496 496
497 sender1->Echo(456, [&echoed_value](int32_t value) { echoed_value = value; }); 497 sender1->Echo(456, [&echoed_value](int32_t value) { echoed_value = value; });
498 PumpMessages(); 498 PumpMessages();
499 EXPECT_EQ(456, echoed_value); 499 EXPECT_EQ(456, echoed_value);
500 } 500 }
501 501
502 } // namespace 502 } // namespace
503 } // namespace test 503 } // namespace test
504 } // namespace mojo 504 } // namespace mojo
OLDNEW
« no previous file with comments | « no previous file | mojo/public/tools/bindings/generators/cpp_templates/module.h.tmpl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698