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

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

Issue 2332353004: Mojo C++ bindings: support closing [Associated]InterfaceRequest with reason. (Closed)
Patch Set: Created 4 years, 3 months 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 | « mojo/public/cpp/bindings/tests/associated_interface_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 <stdint.h> 5 #include <stdint.h>
6 #include <utility> 6 #include <utility>
7 7
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
(...skipping 753 matching lines...) Expand 10 before | Expand all | Expand 10 after
764 EXPECT_EQ("hey", description); 764 EXPECT_EQ("hey", description);
765 quit_closure.Run(); 765 quit_closure.Run();
766 }, 766 },
767 run_loop.QuitClosure())); 767 run_loop.QuitClosure()));
768 768
769 calc_impl.binding()->CloseWithReason(42u, "hey"); 769 calc_impl.binding()->CloseWithReason(42u, "hey");
770 770
771 run_loop.Run(); 771 run_loop.Run();
772 } 772 }
773 773
774 TEST_F(InterfacePtrTest, InterfaceRequestResetWithReason) {
775 math::CalculatorPtr calc;
776 auto request = GetProxy(&calc);
777
778 base::RunLoop run_loop;
779 calc.set_connection_error_with_reason_handler(base::Bind(
780 [](const base::Closure& quit_closure, uint32_t custom_reason,
781 const std::string& description) {
782 EXPECT_EQ(88u, custom_reason);
783 EXPECT_EQ("greetings", description);
784 quit_closure.Run();
785 },
786 run_loop.QuitClosure()));
787
788 request.ResetWithReason(88u, "greetings");
789
790 run_loop.Run();
791 }
792
774 } // namespace 793 } // namespace
775 } // namespace test 794 } // namespace test
776 } // namespace mojo 795 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/public/cpp/bindings/tests/associated_interface_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698