diff options
author | pneubeck@chromium.org <pneubeck@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-04-12 14:16:32 +0000 |
---|---|---|
committer | pneubeck@chromium.org <pneubeck@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-04-12 14:16:32 +0000 |
commit | ae0cda2cb52d4431de44e2bb79c6fd014db3ed1f (patch) | |
tree | 9a6fa4aebfb1e1e2972d724e9bd0044a849a2c20 /dbus | |
parent | b59a6d6b52c8d0054b482701183c40e123437b0a (diff) | |
download | chromium_src-ae0cda2cb52d4431de44e2bb79c6fd014db3ed1f.zip chromium_src-ae0cda2cb52d4431de44e2bb79c6fd014db3ed1f.tar.gz chromium_src-ae0cda2cb52d4431de44e2bb79c6fd014db3ed1f.tar.bz2 |
Adding PrintTo of ObjectPath.
PrintTo is used by gtest/gmock for pretty printing.
This change makes debugging tests easier.
BUG=NONE
Review URL: https://chromiumcodereview.appspot.com/13942004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@193920 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'dbus')
-rw-r--r-- | dbus/object_path.cc | 6 | ||||
-rw-r--r-- | dbus/object_path.h | 4 |
2 files changed, 10 insertions, 0 deletions
diff --git a/dbus/object_path.cc b/dbus/object_path.cc index 1200a9b..8606b6b 100644 --- a/dbus/object_path.cc +++ b/dbus/object_path.cc @@ -4,6 +4,8 @@ #include "dbus/object_path.h" +#include <ostream> + #include "dbus/string_util.h" namespace dbus { @@ -24,4 +26,8 @@ bool ObjectPath::operator!=(const ObjectPath& that) const { return value_ != that.value_; } +void PrintTo(const ObjectPath& path, std::ostream* out) { + *out << path.value(); +} + } // namespace dbus diff --git a/dbus/object_path.h b/dbus/object_path.h index 89c5287..072c23d 100644 --- a/dbus/object_path.h +++ b/dbus/object_path.h @@ -5,6 +5,7 @@ #ifndef DBUS_OBJECT_PATH_H_ #define DBUS_OBJECT_PATH_H_ +#include <iosfwd> #include <string> #include "dbus/dbus_export.h" @@ -46,6 +47,9 @@ class CHROME_DBUS_EXPORT ObjectPath { std::string value_; }; +// This is required by gtest to print a readable output on test failures. +CHROME_DBUS_EXPORT void PrintTo(const ObjectPath& path, std::ostream* out); + } // namespace dbus #endif // DBUS_OBJECT_PATH_H_ |