| 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_SHILL_CLIENT_UNITTEST_BASE_H_ | 5 #ifndef CHROMEOS_DBUS_SHILL_CLIENT_UNITTEST_BASE_H_ |
| 6 #define CHROMEOS_DBUS_SHILL_CLIENT_UNITTEST_BASE_H_ | 6 #define CHROMEOS_DBUS_SHILL_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 27 matching lines...) Expand all Loading... |
| 38 } // namespace dbus | 38 } // namespace dbus |
| 39 | 39 |
| 40 namespace chromeos { | 40 namespace chromeos { |
| 41 | 41 |
| 42 // A gmock matcher for base::Value types, so we can match them in expectations. | 42 // A gmock matcher for base::Value types, so we can match them in expectations. |
| 43 class ValueMatcher : public MatcherInterface<const base::Value&> { | 43 class ValueMatcher : public MatcherInterface<const base::Value&> { |
| 44 public: | 44 public: |
| 45 explicit ValueMatcher(const base::Value& value); | 45 explicit ValueMatcher(const base::Value& value); |
| 46 | 46 |
| 47 // MatcherInterface overrides. | 47 // MatcherInterface overrides. |
| 48 virtual bool MatchAndExplain(const base::Value& value, | 48 bool MatchAndExplain(const base::Value& value, |
| 49 MatchResultListener* listener) const override; | 49 MatchResultListener* listener) const override; |
| 50 virtual void DescribeTo(::std::ostream* os) const override; | 50 void DescribeTo(::std::ostream* os) const override; |
| 51 virtual void DescribeNegationTo(::std::ostream* os) const override; | 51 void DescribeNegationTo(::std::ostream* os) const override; |
| 52 | 52 |
| 53 private: | 53 private: |
| 54 scoped_ptr<base::Value> expected_value_; | 54 scoped_ptr<base::Value> expected_value_; |
| 55 }; | 55 }; |
| 56 | 56 |
| 57 inline Matcher<const base::Value&> ValueEq(const base::Value& expected_value) { | 57 inline Matcher<const base::Value&> ValueEq(const base::Value& expected_value) { |
| 58 return MakeMatcher(new ValueMatcher(expected_value)); | 58 return MakeMatcher(new ValueMatcher(expected_value)); |
| 59 } | 59 } |
| 60 | 60 |
| 61 // A class to provide functionalities needed for testing Shill D-Bus clients. | 61 // A class to provide functionalities needed for testing Shill D-Bus clients. |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 261 std::string expected_method_name_; | 261 std::string expected_method_name_; |
| 262 // The response which the mock object proxy returns. | 262 // The response which the mock object proxy returns. |
| 263 dbus::Response* response_; | 263 dbus::Response* response_; |
| 264 // A callback to intercept and check the method call arguments. | 264 // A callback to intercept and check the method call arguments. |
| 265 ArgumentCheckCallback argument_checker_; | 265 ArgumentCheckCallback argument_checker_; |
| 266 }; | 266 }; |
| 267 | 267 |
| 268 } // namespace chromeos | 268 } // namespace chromeos |
| 269 | 269 |
| 270 #endif // CHROMEOS_DBUS_SHILL_CLIENT_UNITTEST_BASE_H_ | 270 #endif // CHROMEOS_DBUS_SHILL_CLIENT_UNITTEST_BASE_H_ |
| OLD | NEW |