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

Unified Diff: runtime/vm/dart_api_impl_test.cc

Issue 1412193007: Fix Dart_GlobalTimelineGetTrace to null terminate the string (Closed) Base URL: https://chromium.googlesource.com/external/github.com/dart-lang/sdk.git@master
Patch Set: Created 5 years, 2 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/dart_api_impl.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/dart_api_impl_test.cc
diff --git a/runtime/vm/dart_api_impl_test.cc b/runtime/vm/dart_api_impl_test.cc
index 501091ce9309106c86b0412ee7e485659311fed9..b11ffb418aa2848a95ddd4cb5e1bf39eadcd42e7 100644
--- a/runtime/vm/dart_api_impl_test.cc
+++ b/runtime/vm/dart_api_impl_test.cc
@@ -9562,6 +9562,12 @@ TEST_CASE(Timeline_Dart_TimelineGetTrace) {
EXPECT(buffer_length > 0);
EXPECT(buffer != NULL);
+ // Response starts with a '{' character and not a '['.
+ EXPECT(buffer[0] == '{');
+ // Response ends with a '}' character and not a ']'.
+ EXPECT(buffer[buffer_length - 1] == '\0');
+ EXPECT(buffer[buffer_length - 2] == '}');
+
// Heartbeat test.
EXPECT_SUBSTRING("\"cat\":\"Compiler\"", buffer);
EXPECT_SUBSTRING("\"name\":\"CompileFunction\"", buffer);
@@ -9609,6 +9615,12 @@ TEST_CASE(Timeline_Dart_TimelineGetTraceOnlyDartEvents) {
EXPECT(buffer_length > 0);
EXPECT(buffer != NULL);
+ // Response starts with a '{' character and not a '['.
+ EXPECT(buffer[0] == '{');
+ // Response ends with a '}' character and not a ']'.
+ EXPECT(buffer[buffer_length - 1] == '\0');
+ EXPECT(buffer[buffer_length - 2] == '}');
+
// Heartbeat test.
EXPECT_SUBSTRING("\"cat\":\"Dart\"", buffer);
EXPECT_SUBSTRING("\"name\":\"DART_NAME\"", buffer);
@@ -9654,6 +9666,12 @@ TEST_CASE(Timeline_Dart_TimelineGetTraceWithDartEvents) {
EXPECT(buffer_length > 0);
EXPECT(buffer != NULL);
+ // Response starts with a '{' character and not a '['.
+ EXPECT(buffer[0] == '{');
+ // Response ends with a '}' character and not a ']'.
+ EXPECT(buffer[buffer_length - 1] == '\0');
+ EXPECT(buffer[buffer_length - 2] == '}');
+
// Heartbeat test.
EXPECT_SUBSTRING("\"cat\":\"Compiler\"", buffer);
EXPECT_SUBSTRING("\"name\":\"CompileFunction\"", buffer);
@@ -9697,6 +9715,12 @@ TEST_CASE(Timeline_Dart_TimelineGetTraceGlobalOverride) {
EXPECT(buffer_length > 0);
EXPECT(buffer != NULL);
+ // Response starts with a '{' character and not a '['.
+ EXPECT(buffer[0] == '{');
+ // Response ends with a '}' character and not a ']'.
+ EXPECT(buffer[buffer_length - 1] == '\0');
+ EXPECT(buffer[buffer_length - 2] == '}');
+
// Heartbeat test.
EXPECT_SUBSTRING("\"cat\":\"Compiler\"", buffer);
EXPECT_SUBSTRING("\"name\":\"CompileFunction\"", buffer);
@@ -9745,6 +9769,12 @@ TEST_CASE(Timeline_Dart_GlobalTimelineGetTrace) {
EXPECT(buffer_length > 0);
EXPECT(buffer != NULL);
+ // Response starts with a '{' character and not a '['.
+ EXPECT(buffer[0] == '{');
+ // Response ends with a '}' character and not a ']'.
+ EXPECT(buffer[buffer_length - 1] == '\0');
+ EXPECT(buffer[buffer_length - 2] == '}');
+
// Heartbeat test.
EXPECT_SUBSTRING("\"name\":\"TestVMDuration\"", buffer);
EXPECT_SUBSTRING("\"cat\":\"Compiler\"", buffer);
@@ -9779,6 +9809,11 @@ TEST_CASE(Timeline_Dart_GlobalTimelineGetTrace) {
buffer_length = data.buffer_length;
EXPECT(buffer_length > 0);
EXPECT(buffer != NULL);
+ // Response starts with a '{' character and not a '['.
+ EXPECT(buffer[0] == '{');
+ // Response ends with a '}' character and not a ']'.
+ EXPECT(buffer[buffer_length - 1] == '\0');
+ EXPECT(buffer[buffer_length - 2] == '}');
// Heartbeat test for old events.
EXPECT_SUBSTRING("\"name\":\"TestVMDuration\"", buffer);
« no previous file with comments | « runtime/vm/dart_api_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698