| OLD | NEW |
| 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 16 matching lines...) Expand all Loading... |
| 27 | 27 |
| 28 class MessageReader; | 28 class MessageReader; |
| 29 | 29 |
| 30 } // namespace dbus | 30 } // namespace dbus |
| 31 | 31 |
| 32 namespace chromeos { | 32 namespace chromeos { |
| 33 | 33 |
| 34 // A class to provide functionalities needed for testing Flimflam D-Bus clients. | 34 // A class to provide functionalities needed for testing Flimflam D-Bus clients. |
| 35 class FlimflamClientUnittestBase : public testing::Test { | 35 class FlimflamClientUnittestBase : public testing::Test { |
| 36 public: | 36 public: |
| 37 explicit FlimflamClientUnittestBase(const std::string& interface_name); | 37 explicit FlimflamClientUnittestBase(const std::string& interface_name, |
| 38 const dbus::ObjectPath& object_path); |
| 38 virtual ~FlimflamClientUnittestBase(); | 39 virtual ~FlimflamClientUnittestBase(); |
| 39 | 40 |
| 40 virtual void SetUp() OVERRIDE; | 41 virtual void SetUp() OVERRIDE; |
| 41 virtual void TearDown() OVERRIDE; | 42 virtual void TearDown() OVERRIDE; |
| 42 | 43 |
| 43 protected: | 44 protected: |
| 44 // A callback to intercept and check the method call arguments. | 45 // A callback to intercept and check the method call arguments. |
| 45 typedef base::Callback<void( | 46 typedef base::Callback<void( |
| 46 dbus::MessageReader* reader)> ArgumentCheckCallback; | 47 dbus::MessageReader* reader)> ArgumentCheckCallback; |
| 47 | 48 |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 | 106 |
| 106 // Checks the content of the method call and returns the response. | 107 // Checks the content of the method call and returns the response. |
| 107 // Used to implement the mock proxy. | 108 // Used to implement the mock proxy. |
| 108 void OnCallMethod( | 109 void OnCallMethod( |
| 109 dbus::MethodCall* method_call, | 110 dbus::MethodCall* method_call, |
| 110 int timeout_ms, | 111 int timeout_ms, |
| 111 const dbus::ObjectProxy::ResponseCallback& response_callback); | 112 const dbus::ObjectProxy::ResponseCallback& response_callback); |
| 112 | 113 |
| 113 // The interface name. | 114 // The interface name. |
| 114 const std::string interface_name_; | 115 const std::string interface_name_; |
| 116 // The object path. |
| 117 const dbus::ObjectPath object_path_; |
| 115 // The mock object proxy. | 118 // The mock object proxy. |
| 116 scoped_refptr<dbus::MockObjectProxy> mock_proxy_; | 119 scoped_refptr<dbus::MockObjectProxy> mock_proxy_; |
| 117 // The PropertyChanged signal handler given by the tested client. | 120 // The PropertyChanged signal handler given by the tested client. |
| 118 dbus::ObjectProxy::SignalCallback property_changed_handler_; | 121 dbus::ObjectProxy::SignalCallback property_changed_handler_; |
| 119 // The name of the method which is expected to be called. | 122 // The name of the method which is expected to be called. |
| 120 std::string expected_method_name_; | 123 std::string expected_method_name_; |
| 121 // The response which the mock object proxy returns. | 124 // The response which the mock object proxy returns. |
| 122 dbus::Response* response_; | 125 dbus::Response* response_; |
| 123 // A callback to intercept and check the method call arguments. | 126 // A callback to intercept and check the method call arguments. |
| 124 ArgumentCheckCallback argument_checker_; | 127 ArgumentCheckCallback argument_checker_; |
| 125 }; | 128 }; |
| 126 | 129 |
| 127 } // namespace chromeos | 130 } // namespace chromeos |
| 128 | 131 |
| 129 #endif // CHROMEOS_DBUS_FLIMFLAM_CLIENT_UNITTEST_BASE_H_ | 132 #endif // CHROMEOS_DBUS_FLIMFLAM_CLIENT_UNITTEST_BASE_H_ |
| OLD | NEW |