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

Unified Diff: runtime/vm/dart_api_impl_test.cc

Issue 1170503004: Initial Timeline Events (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 6 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') | runtime/vm/deopt_instructions.h » ('j') | 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 b79780c49615e108420b18a5d5bffb69e9df69e4..9f61190264a9a63245c1fff6ccb9729a75bd67df 100644
--- a/runtime/vm/dart_api_impl_test.cc
+++ b/runtime/vm/dart_api_impl_test.cc
@@ -9056,6 +9056,7 @@ TEST_CASE(ExternalStringIndexOf) {
EXPECT_EQ(6, value);
}
+
TEST_CASE(StringFromExternalTypedData) {
const char* kScriptChars =
"test(external) {\n"
@@ -9152,4 +9153,76 @@ TEST_CASE(StringFromExternalTypedData) {
}
}
+
+TEST_CASE(Timeline_Dart_TimelineDuration) {
+ Isolate* isolate = Isolate::Current();
+ // Grab embedder stream.
+ TimelineStream* stream = isolate->GetEmbedderStream();
+ // Make sure it is enabled.
+ stream->set_enabled(true);
+ // Add a duration event.
+ Dart_TimelineDuration("testDurationEvent", 0, 1);
+ // Check that it is in the output.
+ TimelineEventBuffer* buffer = isolate->timeline_event_buffer();
+ JSONStream js;
+ buffer->PrintJSON(&js);
+ EXPECT_SUBSTRING("testDurationEvent", js.ToCString());
+}
+
+
+TEST_CASE(Timeline_Dart_TimelineInstant) {
+ Isolate* isolate = Isolate::Current();
+ // Grab embedder stream.
+ TimelineStream* stream = isolate->GetEmbedderStream();
+ // Make sure it is enabled.
+ stream->set_enabled(true);
+ Dart_TimelineInstant("testInstantEvent");
+ // Check that it is in the output.
+ TimelineEventBuffer* buffer = isolate->timeline_event_buffer();
+ JSONStream js;
+ buffer->PrintJSON(&js);
+ EXPECT_SUBSTRING("testInstantEvent", js.ToCString());
+}
+
+
+TEST_CASE(Timeline_Dart_TimelineAsyncDisabled) {
+ Isolate* isolate = Isolate::Current();
+ // Grab embedder stream.
+ TimelineStream* stream = isolate->GetEmbedderStream();
+ // Make sure it is disabled.
+ stream->set_enabled(false);
+ int64_t async_id = -1;
+ Dart_TimelineAsyncBegin("testAsyncEvent", &async_id);
+ // Expect that the |async_id| is negative because the stream is disabled.
+ EXPECT(async_id < 0);
+ // Call Dart_TimelineAsyncEnd with a negative async_id.
+ Dart_TimelineAsyncEnd("testAsyncEvent", async_id);
+ // Check that testAsync is not in the output.
+ TimelineEventBuffer* buffer = isolate->timeline_event_buffer();
+ JSONStream js;
+ buffer->PrintJSON(&js);
+ EXPECT_NOTSUBSTRING("testAsyncEvent", js.ToCString());
+}
+
+
+TEST_CASE(Timeline_Dart_TimelineAsync) {
+ Isolate* isolate = Isolate::Current();
+ // Grab embedder stream.
+ TimelineStream* stream = isolate->GetEmbedderStream();
+ // Make sure it is enabled.
+ stream->set_enabled(true);
+ int64_t async_id = -1;
+ Dart_TimelineAsyncBegin("testAsyncEvent", &async_id);
+ // Expect that the |async_id| is >= 0.
+ EXPECT(async_id >= 0);
+
+ Dart_TimelineAsyncEnd("testAsyncEvent", async_id);
+
+ // Check that it is in the output.
+ TimelineEventBuffer* buffer = isolate->timeline_event_buffer();
+ JSONStream js;
+ buffer->PrintJSON(&js);
+ EXPECT_SUBSTRING("testAsyncEvent", js.ToCString());
+}
+
} // namespace dart
« no previous file with comments | « runtime/vm/dart_api_impl.cc ('k') | runtime/vm/deopt_instructions.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698