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

Unified Diff: runtime/vm/trace_buffer_test.cc

Issue 227423005: Add TraceBuffer log to all Functions (plus small tweaks to function-view) (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 8 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/trace_buffer.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/trace_buffer_test.cc
diff --git a/runtime/vm/trace_buffer_test.cc b/runtime/vm/trace_buffer_test.cc
index 128487685fc2cd2dfee39f5c0311584dddae345d..fd2e6479042cb6d7a94f6cd149931273ce70b42d 100644
--- a/runtime/vm/trace_buffer_test.cc
+++ b/runtime/vm/trace_buffer_test.cc
@@ -12,60 +12,62 @@ namespace dart {
UNIT_TEST_CASE(TraceBufferEmpty) {
- TraceBuffer* trace_buffer = new TraceBuffer(3);
+ TraceBuffer* trace_buffer = new TraceBuffer(3, 3);
{
JSONStream js;
trace_buffer->PrintToJSONStream(&js);
- EXPECT_STREQ("{\"type\":\"TraceBuffer\",\"members\":[]}", js.ToCString());
+ EXPECT_STREQ("{\"type\":\"TraceBuffer\",\"id\":\"\",\"members\":[]}",
+ js.ToCString());
}
delete trace_buffer;
}
UNIT_TEST_CASE(TraceBufferClear) {
- TraceBuffer* trace_buffer = new TraceBuffer(3);
+ TraceBuffer* trace_buffer = new TraceBuffer(3, 3);
trace_buffer->Trace(kMicrosecondsPerSecond * 1, "abc");
trace_buffer->Clear();
{
JSONStream js;
trace_buffer->PrintToJSONStream(&js);
- EXPECT_STREQ("{\"type\":\"TraceBuffer\",\"members\":[]}", js.ToCString());
+ EXPECT_STREQ("{\"type\":\"TraceBuffer\",\"id\":\"\",\"members\":[]}",
+ js.ToCString());
}
delete trace_buffer;
}
UNIT_TEST_CASE(TraceBufferTrace) {
- TraceBuffer* trace_buffer = new TraceBuffer(3);
+ TraceBuffer* trace_buffer = new TraceBuffer(3, 3);
trace_buffer->Trace(kMicrosecondsPerSecond * 1, "abc");
{
JSONStream js;
trace_buffer->PrintToJSONStream(&js);
- EXPECT_STREQ("{\"type\":\"TraceBuffer\",\"members\":["
- "{\"type\":\"TraceBufferEntry\",\"time\":1.000000,"
+ EXPECT_STREQ("{\"type\":\"TraceBuffer\",\"id\":\"\",\"members\":["
+ "{\"type\":\"TraceBufferEntry\",\"id\":\"\",\"time\":1000,"
"\"message\":\"abc\"}]}", js.ToCString());
}
trace_buffer->Trace(kMicrosecondsPerSecond * 2, "def");
{
JSONStream js;
trace_buffer->PrintToJSONStream(&js);
- EXPECT_STREQ("{\"type\":\"TraceBuffer\",\"members\":["
- "{\"type\":\"TraceBufferEntry\",\"time\":1.000000,"
+ EXPECT_STREQ("{\"type\":\"TraceBuffer\",\"id\":\"\",\"members\":["
+ "{\"type\":\"TraceBufferEntry\",\"id\":\"\",\"time\":1000,"
"\"message\":\"abc\"},"
- "{\"type\":\"TraceBufferEntry\",\"time\":2.000000,"
+ "{\"type\":\"TraceBufferEntry\",\"id\":\"\",\"time\":2000,"
"\"message\":\"def\"}]}", js.ToCString());
}
trace_buffer->Trace(kMicrosecondsPerSecond * 3, "ghi");
{
JSONStream js;
trace_buffer->PrintToJSONStream(&js);
- EXPECT_STREQ("{\"type\":\"TraceBuffer\",\"members\":["
- "{\"type\":\"TraceBufferEntry\",\"time\":1.000000,"
+ EXPECT_STREQ("{\"type\":\"TraceBuffer\",\"id\":\"\",\"members\":["
+ "{\"type\":\"TraceBufferEntry\",\"id\":\"\",\"time\":1000,"
"\"message\":\"abc\"},"
- "{\"type\":\"TraceBufferEntry\",\"time\":2.000000,"
+ "{\"type\":\"TraceBufferEntry\",\"id\":\"\",\"time\":2000,"
"\"message\":\"def\"},"
- "{\"type\":\"TraceBufferEntry\",\"time\":3.000000,"
+ "{\"type\":\"TraceBufferEntry\",\"id\":\"\",\"time\":3000,"
"\"message\":\"ghi\"}]}", js.ToCString());
}
// This will overwrite the first Trace.
@@ -73,12 +75,12 @@ UNIT_TEST_CASE(TraceBufferTrace) {
{
JSONStream js;
trace_buffer->PrintToJSONStream(&js);
- EXPECT_STREQ("{\"type\":\"TraceBuffer\",\"members\":["
- "{\"type\":\"TraceBufferEntry\",\"time\":2.000000,"
+ EXPECT_STREQ("{\"type\":\"TraceBuffer\",\"id\":\"\",\"members\":["
+ "{\"type\":\"TraceBufferEntry\",\"id\":\"\",\"time\":2000,"
"\"message\":\"def\"},"
- "{\"type\":\"TraceBufferEntry\",\"time\":3.000000,"
+ "{\"type\":\"TraceBufferEntry\",\"id\":\"\",\"time\":3000,"
"\"message\":\"ghi\"},"
- "{\"type\":\"TraceBufferEntry\",\"time\":4.000000,"
+ "{\"type\":\"TraceBufferEntry\",\"id\":\"\",\"time\":4000,"
"\"message\":\"jkl\"}]}", js.ToCString());
}
delete trace_buffer;
@@ -86,7 +88,7 @@ UNIT_TEST_CASE(TraceBufferTrace) {
UNIT_TEST_CASE(TraceBufferTraceF) {
- TraceBuffer* trace_buffer = new TraceBuffer(3);
+ TraceBuffer* trace_buffer = new TraceBuffer(3, 3);
trace_buffer->TraceF("foo %d %s", 99, "bar");
{
JSONStream js;
@@ -97,4 +99,12 @@ UNIT_TEST_CASE(TraceBufferTraceF) {
}
+UNIT_TEST_CASE(TraceBufferGrow) {
+ TraceBuffer* trace_buffer = new TraceBuffer(1);
+ EXPECT_EQ(1, trace_buffer->capacity());
+ trace_buffer->Trace(kMicrosecondsPerSecond * 1, "abc");
+ EXPECT_EQ(2, trace_buffer->capacity());
+}
+
+
} // namespace dart
« no previous file with comments | « runtime/vm/trace_buffer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698