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

Unified Diff: base/debug/trace_event_unittest.cc

Issue 203063002: Adding support for Time and TimeTicks inside trace_event. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 9 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/debug/trace_event.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/debug/trace_event_unittest.cc
diff --git a/base/debug/trace_event_unittest.cc b/base/debug/trace_event_unittest.cc
index 22a3270c2a1a5438c09c109d6930a1332460eab5..e6a73aa8af77b0bda7feede1f41c5b8cedd12377 100644
--- a/base/debug/trace_event_unittest.cc
+++ b/base/debug/trace_event_unittest.cc
@@ -21,6 +21,7 @@
#include "base/synchronization/waitable_event.h"
#include "base/threading/platform_thread.h"
#include "base/threading/thread.h"
+#include "base/time/time.h"
#include "base/values.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -2011,6 +2012,14 @@ TEST_F(TraceEventTestFixture, PrimitiveArgs) {
TRACE_EVENT1("foo", "event9", "pointer_badf00d", p);
TRACE_EVENT1("foo", "event10", "bool_true", true);
TRACE_EVENT1("foo", "event11", "bool_false", false);
+ TRACE_EVENT1("foo", "event12", "time_null",
+ base::Time());
+ TRACE_EVENT1("foo", "event13", "time_one",
+ base::Time::FromInternalValue(1));
+ TRACE_EVENT1("foo", "event14", "timeticks_null",
+ base::TimeTicks());
+ TRACE_EVENT1("foo", "event15", "timeticks_one",
+ base::TimeTicks::FromInternalValue(1));
EndTraceAndFlush();
const DictionaryValue* args_dict = NULL;
@@ -2116,6 +2125,34 @@ TEST_F(TraceEventTestFixture, PrimitiveArgs) {
ASSERT_TRUE(args_dict);
EXPECT_TRUE(args_dict->GetBoolean("bool_false", &bool_value));
EXPECT_FALSE(bool_value);
+
+ dict = FindNamePhase("event12", "X");
+ ASSERT_TRUE(dict);
+ dict->GetDictionary("args", &args_dict);
+ ASSERT_TRUE(args_dict);
+ EXPECT_TRUE(args_dict->GetInteger("time_null", &int_value));
+ EXPECT_EQ(0, int_value);
+
+ dict = FindNamePhase("event13", "X");
+ ASSERT_TRUE(dict);
+ dict->GetDictionary("args", &args_dict);
+ ASSERT_TRUE(args_dict);
+ EXPECT_TRUE(args_dict->GetInteger("time_one", &int_value));
+ EXPECT_EQ(1, int_value);
+
+ dict = FindNamePhase("event14", "X");
+ ASSERT_TRUE(dict);
+ dict->GetDictionary("args", &args_dict);
+ ASSERT_TRUE(args_dict);
+ EXPECT_TRUE(args_dict->GetInteger("timeticks_null", &int_value));
+ EXPECT_EQ(0, int_value);
+
+ dict = FindNamePhase("event15", "X");
+ ASSERT_TRUE(dict);
+ dict->GetDictionary("args", &args_dict);
+ ASSERT_TRUE(args_dict);
+ EXPECT_TRUE(args_dict->GetInteger("timeticks_one", &int_value));
+ EXPECT_EQ(1, int_value);
}
class TraceEventCallbackTest : public TraceEventTestFixture {
« no previous file with comments | « base/debug/trace_event.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698