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

Unified Diff: runtime/vm/timeline_test.cc

Issue 2315353004: Record Timeline to Android Systrace (Closed)
Patch Set: rmacnak review Created 4 years, 3 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 | « runtime/vm/timeline.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/timeline_test.cc
diff --git a/runtime/vm/timeline_test.cc b/runtime/vm/timeline_test.cc
index db764ee39a264fb9da1c69474cde99ad721232da..e7f0e7aabae2cd2358c130db2cad080284581aaa 100644
--- a/runtime/vm/timeline_test.cc
+++ b/runtime/vm/timeline_test.cc
@@ -175,6 +175,50 @@ TEST_CASE(TimelineEventDurationPrintJSON) {
}
+TEST_CASE(TimelineEventPrintSystrace) {
+ const intptr_t kBufferLength = 1024;
+ char buffer[kBufferLength];
+
+ // Create a test stream.
+ TimelineStream stream;
+ stream.Init("testStream", true);
+
+ // Create a test event.
+ TimelineEvent event;
+ TimelineTestHelper::SetStream(&event, &stream);
+
+ // Test a Begin event.
+ event.Begin("apple", 1, 2);
+ event.PrintSystrace(&buffer[0], kBufferLength);
+ EXPECT_SUBSTRING("|apple", buffer);
+ EXPECT_SUBSTRING("B|", buffer);
+
+ // Test an End event.
+ event.End("apple", 2, 3);
+ event.PrintSystrace(&buffer[0], kBufferLength);
+ EXPECT_STREQ("E", buffer);
+
+ // Test a Counter event. We only report the first counter value (in this case
+ // "4").
+ event.Counter("CTR", 1);
+ // We have two counters.
+ event.SetNumArguments(2);
+ // Set the first counter value.
+ event.CopyArgument(0, "cats", "4");
+ // Set the second counter value.
+ event.CopyArgument(1, "dogs", "1");
+ event.PrintSystrace(&buffer[0], kBufferLength);
+ EXPECT_SUBSTRING("C|", buffer);
+ EXPECT_SUBSTRING("|CTR|4", buffer);
+
+ // Test a duration event. This event kind is not supported so we should
+ // serialize it to an empty string.
+ event.Duration("DUR", 0, 1, 2, 3);
+ event.PrintSystrace(&buffer[0], kBufferLength);
+ EXPECT_STREQ("", buffer);
+}
+
+
TEST_CASE(TimelineEventArguments) {
// Create a test stream.
TimelineStream stream;
« no previous file with comments | « runtime/vm/timeline.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698