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

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: 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..c04b8afa72ed4eba0d92a493b46eb1914f516794 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);
awong 2014/08/26 00:33:19 This should be a method in TestPendingTask.
mithro-old 2014/08/26 01:34:54 gtest requires this method to be in the name space
awong 2014/08/27 20:51:21 Ah hah...I just went and read the gtest documentat
+
} // 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