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

Unified Diff: base/test/test_pending_task.h

Issue 491743002: Adding tracing and gtest pretty printing support to TestPendingTask. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: s/::std/std Created 6 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/base.gyp ('k') | base/test/test_pending_task.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/test/test_pending_task.h
diff --git a/base/test/test_pending_task.h b/base/test/test_pending_task.h
index 024e281a8d299ab357e668f61a889c48de6f4ee0..fa06800553c7fa233a7ca9dc40313e73ffacea49 100644
--- a/base/test/test_pending_task.h
+++ b/base/test/test_pending_task.h
@@ -5,7 +5,10 @@
#ifndef BASE_TEST_TEST_PENDING_TASK_H_
#define BASE_TEST_TEST_PENDING_TASK_H_
+#include <string>
+
#include "base/callback.h"
+#include "base/debug/trace_event_argument.h"
#include "base/location.h"
#include "base/time/time.h"
@@ -51,8 +54,19 @@ struct TestPendingTask {
TimeTicks post_time;
TimeDelta delay;
TestNestability nestability;
+
+ // Functions for using test pending task with tracing, useful in unit
+ // testing.
+ void AsValueInto(base::debug::TracedValue* state) const;
+ scoped_refptr<base::debug::ConvertableToTraceFormat> AsValue() const;
+ std::string ToString() const;
};
+// gtest helpers which allow pretty printing of the tasks, very useful in unit
+// testing.
+std::ostream& operator<<(std::ostream& os, const TestPendingTask& task);
+void PrintTo(const TestPendingTask& task, std::ostream* os);
+
} // namespace base
-#endif // BASE_TEST_TEST_TASK_RUNNER_H_
+#endif // BASE_TEST_TEST_PENDING_TASK_H_
« no previous file with comments | « base/base.gyp ('k') | base/test/test_pending_task.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698