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

Side by Side Diff: mojo/public/cpp/bindings/tests/associated_interface_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 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 <stddef.h> 5 #include <stddef.h>
6 #include <stdint.h> 6 #include <stdint.h>
7 #include <algorithm> 7 #include <algorithm>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
11 #include "base/callback.h"
12 #include "base/message_loop/message_loop.h" 11 #include "base/message_loop/message_loop.h"
13 #include "base/run_loop.h" 12 #include "base/run_loop.h"
14 #include "base/threading/thread.h" 13 #include "base/threading/thread.h"
15 #include "base/threading/thread_task_runner_handle.h" 14 #include "base/threading/thread_task_runner_handle.h"
16 #include "mojo/public/cpp/bindings/associated_binding.h" 15 #include "mojo/public/cpp/bindings/associated_binding.h"
17 #include "mojo/public/cpp/bindings/associated_group.h" 16 #include "mojo/public/cpp/bindings/associated_group.h"
18 #include "mojo/public/cpp/bindings/associated_interface_ptr.h" 17 #include "mojo/public/cpp/bindings/associated_interface_ptr.h"
19 #include "mojo/public/cpp/bindings/associated_interface_ptr_info.h" 18 #include "mojo/public/cpp/bindings/associated_interface_ptr_info.h"
20 #include "mojo/public/cpp/bindings/associated_interface_request.h" 19 #include "mojo/public/cpp/bindings/associated_interface_request.h"
21 #include "mojo/public/cpp/bindings/binding.h" 20 #include "mojo/public/cpp/bindings/binding.h"
(...skipping 19 matching lines...) Expand all
41 notify_send_method_called_ = callback; 40 notify_send_method_called_ = callback;
42 } 41 }
43 42
44 void Echo(int32_t value, const EchoCallback& callback) override { 43 void Echo(int32_t value, const EchoCallback& callback) override {
45 callback.Run(value); 44 callback.Run(value);
46 } 45 }
47 void Send(int32_t value) override { notify_send_method_called_.Run(value); } 46 void Send(int32_t value) override { notify_send_method_called_.Run(value); }
48 47
49 AssociatedBinding<IntegerSender>* binding() { return &binding_; } 48 AssociatedBinding<IntegerSender>* binding() { return &binding_; }
50 49
51 void set_connection_error_handler(const base::Closure& handler) { 50 void set_connection_error_handler(const Closure& handler) {
52 binding_.set_connection_error_handler(handler); 51 binding_.set_connection_error_handler(handler);
53 } 52 }
54 53
55 private: 54 private:
56 AssociatedBinding<IntegerSender> binding_; 55 AssociatedBinding<IntegerSender> binding_;
57 base::Callback<void(int32_t)> notify_send_method_called_; 56 base::Callback<void(int32_t)> notify_send_method_called_;
58 }; 57 };
59 58
60 class IntegerSenderConnectionImpl : public IntegerSenderConnection { 59 class IntegerSenderConnectionImpl : public IntegerSenderConnection {
61 public: 60 public:
(...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after
584 583
585 // The previous wait has dispatched the GetSender request message, therefore 584 // The previous wait has dispatched the GetSender request message, therefore
586 // an associated interface has been set up on the pipe. It is not allowed to 585 // an associated interface has been set up on the pipe. It is not allowed to
587 // wait or pause. 586 // wait or pause.
588 EXPECT_TRUE(connection.binding()->HasAssociatedInterfaces()); 587 EXPECT_TRUE(connection.binding()->HasAssociatedInterfaces());
589 } 588 }
590 589
591 } // namespace 590 } // namespace
592 } // namespace test 591 } // namespace test
593 } // namespace mojo 592 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/public/cpp/bindings/tests/BUILD.gn ('k') | mojo/public/cpp/bindings/tests/bind_task_runner_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698