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

Side by Side Diff: chromeos/dbus/flimflam_client_unittest_base.h

Issue 10024054: chromeos: Convert D-Bus client classes' callback arguments to const reference (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 8 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « chromeos/dbus/cryptohome_client.cc ('k') | chromeos/dbus/flimflam_client_unittest_base.cc » ('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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #ifndef CHROMEOS_DBUS_FLIMFLAM_CLIENT_UNITTEST_BASE_H_ 5 #ifndef CHROMEOS_DBUS_FLIMFLAM_CLIENT_UNITTEST_BASE_H_
6 #define CHROMEOS_DBUS_FLIMFLAM_CLIENT_UNITTEST_BASE_H_ 6 #define CHROMEOS_DBUS_FLIMFLAM_CLIENT_UNITTEST_BASE_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
(...skipping 29 matching lines...) Expand all
40 virtual void SetUp() OVERRIDE; 40 virtual void SetUp() OVERRIDE;
41 virtual void TearDown() OVERRIDE; 41 virtual void TearDown() OVERRIDE;
42 42
43 protected: 43 protected:
44 // A callback to intercept and check the method call arguments. 44 // A callback to intercept and check the method call arguments.
45 typedef base::Callback<void( 45 typedef base::Callback<void(
46 dbus::MessageReader* reader)> ArgumentCheckCallback; 46 dbus::MessageReader* reader)> ArgumentCheckCallback;
47 47
48 // Sets expectations for called method name and arguments, and sets response. 48 // Sets expectations for called method name and arguments, and sets response.
49 void PrepareForMethodCall(const std::string& method_name, 49 void PrepareForMethodCall(const std::string& method_name,
50 ArgumentCheckCallback argument_checker, 50 const ArgumentCheckCallback& argument_checker,
51 dbus::Response* response); 51 dbus::Response* response);
52 52
53 // Sends property changed signal to the tested client. 53 // Sends property changed signal to the tested client.
54 void SendPropertyChangedSignal(dbus::Signal* signal); 54 void SendPropertyChangedSignal(dbus::Signal* signal);
55 55
56 // Checks the name and the value which are sent by PropertyChanged signal. 56 // Checks the name and the value which are sent by PropertyChanged signal.
57 static void ExpectPropertyChanged(const std::string& expected_name, 57 static void ExpectPropertyChanged(const std::string& expected_name,
58 const base::Value* expected_value, 58 const base::Value* expected_value,
59 const std::string& name, 59 const std::string& name,
60 const base::Value& value); 60 const base::Value& value);
(...skipping 27 matching lines...) Expand all
88 MessageLoop message_loop_; 88 MessageLoop message_loop_;
89 // The mock bus. 89 // The mock bus.
90 scoped_refptr<dbus::MockBus> mock_bus_; 90 scoped_refptr<dbus::MockBus> mock_bus_;
91 91
92 private: 92 private:
93 // Checks the requested interface name and signal name. 93 // Checks the requested interface name and signal name.
94 // Used to implement the mock proxy. 94 // Used to implement the mock proxy.
95 void OnConnectToSignal( 95 void OnConnectToSignal(
96 const std::string& interface_name, 96 const std::string& interface_name,
97 const std::string& signal_name, 97 const std::string& signal_name,
98 dbus::ObjectProxy::SignalCallback signal_callback, 98 const dbus::ObjectProxy::SignalCallback& signal_callback,
99 dbus::ObjectProxy::OnConnectedCallback on_connected_callback); 99 const dbus::ObjectProxy::OnConnectedCallback& on_connected_callback);
100 100
101 // Checks the content of the method call and returns the response. 101 // Checks the content of the method call and returns the response.
102 // Used to implement the mock proxy. 102 // Used to implement the mock proxy.
103 void OnCallMethod(dbus::MethodCall* method_call, 103 void OnCallMethod(
104 int timeout_ms, 104 dbus::MethodCall* method_call,
105 dbus::ObjectProxy::ResponseCallback response_callback); 105 int timeout_ms,
106 const dbus::ObjectProxy::ResponseCallback& response_callback);
106 107
107 // The interface name. 108 // The interface name.
108 const std::string interface_name_; 109 const std::string interface_name_;
109 // The mock object proxy. 110 // The mock object proxy.
110 scoped_refptr<dbus::MockObjectProxy> mock_proxy_; 111 scoped_refptr<dbus::MockObjectProxy> mock_proxy_;
111 // The PropertyChanged signal handler given by the tested client. 112 // The PropertyChanged signal handler given by the tested client.
112 dbus::ObjectProxy::SignalCallback property_changed_handler_; 113 dbus::ObjectProxy::SignalCallback property_changed_handler_;
113 // The name of the method which is expected to be called. 114 // The name of the method which is expected to be called.
114 std::string expected_method_name_; 115 std::string expected_method_name_;
115 // The response which the mock object proxy returns. 116 // The response which the mock object proxy returns.
116 dbus::Response* response_; 117 dbus::Response* response_;
117 // A callback to intercept and check the method call arguments. 118 // A callback to intercept and check the method call arguments.
118 ArgumentCheckCallback argument_checker_; 119 ArgumentCheckCallback argument_checker_;
119 }; 120 };
120 121
121 } // namespace chromeos 122 } // namespace chromeos
122 123
123 #endif // CHROMEOS_DBUS_FLIMFLAM_CLIENT_UNITTEST_BASE_H_ 124 #endif // CHROMEOS_DBUS_FLIMFLAM_CLIENT_UNITTEST_BASE_H_
OLDNEW
« no previous file with comments | « chromeos/dbus/cryptohome_client.cc ('k') | chromeos/dbus/flimflam_client_unittest_base.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698