Chromium Code Reviews| 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..05cc935ef09175d5741239c76963f9b98587a776 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,69 @@ 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 = Dart_TimelineAsyncBegin("testAsyncEvent"); |
| + // 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); |
|
siva
2015/06/12 19:50:35
Not sure what purpose this test achieves, it seems
Cutch
2015/06/12 23:18:56
Done.
|
| +} |
| + |
| + |
| +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 = Dart_TimelineAsyncBegin("testAsyncEvent"); |
| + // Expect that the |async_id| is >= 0. |
| + EXPECT(async_id >= 0); |
| + // Call Dart_TimelineAsyncEnd with a negative async_id. |
|
siva
2015/06/12 19:50:35
incorrect comment.
Cutch
2015/06/12 23:18:56
Done.
|
| + 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 |