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

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

Issue 2080083002: Revert of Deletes mojo::Callback (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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
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"
10 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
11 #include "base/run_loop.h" 10 #include "base/run_loop.h"
12 #include "mojo/public/cpp/bindings/binding.h" 11 #include "mojo/public/cpp/bindings/binding.h"
13 #include "mojo/public/cpp/bindings/strong_binding.h" 12 #include "mojo/public/cpp/bindings/strong_binding.h"
14 #include "mojo/public/interfaces/bindings/tests/math_calculator.mojom.h" 13 #include "mojo/public/interfaces/bindings/tests/math_calculator.mojom.h"
15 #include "mojo/public/interfaces/bindings/tests/sample_interfaces.mojom.h" 14 #include "mojo/public/interfaces/bindings/tests/sample_interfaces.mojom.h"
16 #include "mojo/public/interfaces/bindings/tests/sample_service.mojom.h" 15 #include "mojo/public/interfaces/bindings/tests/sample_service.mojom.h"
17 #include "mojo/public/interfaces/bindings/tests/scoping.mojom.h" 16 #include "mojo/public/interfaces/bindings/tests/scoping.mojom.h"
18 #include "testing/gtest/include/gtest/gtest.h" 17 #include "testing/gtest/include/gtest/gtest.h"
19 18
20 namespace mojo { 19 namespace mojo {
21 namespace test { 20 namespace test {
22 namespace { 21 namespace {
23 22
24 typedef base::Callback<void(double)> CalcCallback; 23 typedef mojo::Callback<void(double)> CalcCallback;
25 24
26 class MathCalculatorImpl : public math::Calculator { 25 class MathCalculatorImpl : public math::Calculator {
27 public: 26 public:
28 explicit MathCalculatorImpl(InterfaceRequest<math::Calculator> request) 27 explicit MathCalculatorImpl(InterfaceRequest<math::Calculator> request)
29 : total_(0.0), binding_(this, std::move(request)) {} 28 : total_(0.0), binding_(this, std::move(request)) {}
30 ~MathCalculatorImpl() override {} 29 ~MathCalculatorImpl() override {}
31 30
32 void CloseMessagePipe() { binding_.Close(); } 31 void CloseMessagePipe() { binding_.Close(); }
33 32
34 void WaitForIncomingMethodCall() { binding_.WaitForIncomingMethodCall(); } 33 void WaitForIncomingMethodCall() { binding_.WaitForIncomingMethodCall(); }
(...skipping 698 matching lines...) Expand 10 before | Expand all | Expand 10 after
733 bool called = false; 732 bool called = false;
734 base::RunLoop loop; 733 base::RunLoop loop;
735 ptr->Ping(base::Bind(&SetFlagAndRunClosure, &called, loop.QuitClosure())); 734 ptr->Ping(base::Bind(&SetFlagAndRunClosure, &called, loop.QuitClosure()));
736 loop.Run(); 735 loop.Run();
737 EXPECT_TRUE(called); 736 EXPECT_TRUE(called);
738 } 737 }
739 738
740 } // namespace 739 } // namespace
741 } // namespace test 740 } // namespace test
742 } // namespace mojo 741 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/public/cpp/bindings/tests/handle_passing_unittest.cc ('k') | mojo/public/cpp/bindings/tests/request_response_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698