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

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

Issue 2855303003: Mojo C++ bindings: add a MakeRequest overload that binds InterfacePtrInfo. (Closed)
Patch Set: Created 3 years, 7 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/interface_request.h ('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/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
(...skipping 686 matching lines...) Expand 10 before | Expand all | Expand 10 after
697 697
698 private: 698 private:
699 // sample::PingTest: 699 // sample::PingTest:
700 void Ping(const PingCallback& callback) override { callback.Run(); } 700 void Ping(const PingCallback& callback) override { callback.Run(); }
701 701
702 Binding<sample::PingTest> binding_; 702 Binding<sample::PingTest> binding_;
703 }; 703 };
704 704
705 // Tests that FuseProxy does what it's supposed to do. 705 // Tests that FuseProxy does what it's supposed to do.
706 TEST_F(InterfacePtrTest, Fusion) { 706 TEST_F(InterfacePtrTest, Fusion) {
707 sample::PingTestPtr proxy; 707 sample::PingTestPtrInfo proxy_info;
708 PingTestImpl impl(MakeRequest(&proxy)); 708 PingTestImpl impl(MakeRequest(&proxy_info));
709 709
710 // Create another PingTest pipe. 710 // Create another PingTest pipe.
711 sample::PingTestPtr ptr; 711 sample::PingTestPtr ptr;
712 sample::PingTestRequest request(&ptr); 712 sample::PingTestRequest request(&ptr);
713 713
714 // Fuse the new pipe to the one hanging off |impl|. 714 // Fuse the new pipe to the one hanging off |impl|.
715 EXPECT_TRUE(FuseInterface(std::move(request), proxy.PassInterface())); 715 EXPECT_TRUE(FuseInterface(std::move(request), std::move(proxy_info)));
716 716
717 // Ping! 717 // Ping!
718 bool called = false; 718 bool called = false;
719 base::RunLoop loop; 719 base::RunLoop loop;
720 ptr->Ping(base::Bind(&SetFlagAndRunClosure, &called, loop.QuitClosure())); 720 ptr->Ping(base::Bind(&SetFlagAndRunClosure, &called, loop.QuitClosure()));
721 loop.Run(); 721 loop.Run();
722 EXPECT_TRUE(called); 722 EXPECT_TRUE(called);
723 } 723 }
724 724
725 void Fail() { 725 void Fail() {
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
928 other_thread_task_runner->DeleteSoon(FROM_HERE, math_calc_impl); 928 other_thread_task_runner->DeleteSoon(FROM_HERE, math_calc_impl);
929 929
930 // Reset the pointer now so the InterfacePtr associated resources can be 930 // Reset the pointer now so the InterfacePtr associated resources can be
931 // deleted before the background thread's message loop is invalidated. 931 // deleted before the background thread's message loop is invalidated.
932 thread_safe_ptr = nullptr; 932 thread_safe_ptr = nullptr;
933 } 933 }
934 934
935 } // namespace 935 } // namespace
936 } // namespace test 936 } // namespace test
937 } // namespace mojo 937 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/public/cpp/bindings/interface_request.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698