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

Side by Side Diff: runtime/vm/dart_api_impl_test.cc

Issue 1848683002: Remove redundant timeline API (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 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 unified diff | Download patch
« no previous file with comments | « runtime/vm/dart_api_impl.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "bin/builtin.h" 5 #include "bin/builtin.h"
6 #include "include/dart_api.h" 6 #include "include/dart_api.h"
7 #include "include/dart_mirrors_api.h" 7 #include "include/dart_mirrors_api.h"
8 #include "include/dart_native_api.h" 8 #include "include/dart_native_api.h"
9 #include "include/dart_tools_api.h" 9 #include "include/dart_tools_api.h"
10 #include "platform/assert.h" 10 #include "platform/assert.h"
(...skipping 9177 matching lines...) Expand 10 before | Expand all | Expand 10 after
9188 #ifndef PRODUCT 9188 #ifndef PRODUCT
9189 9189
9190 9190
9191 TEST_CASE(Timeline_Dart_TimelineDuration) { 9191 TEST_CASE(Timeline_Dart_TimelineDuration) {
9192 Isolate* isolate = Isolate::Current(); 9192 Isolate* isolate = Isolate::Current();
9193 // Grab embedder stream. 9193 // Grab embedder stream.
9194 TimelineStream* stream = Timeline::GetEmbedderStream(); 9194 TimelineStream* stream = Timeline::GetEmbedderStream();
9195 // Make sure it is enabled. 9195 // Make sure it is enabled.
9196 stream->set_enabled(true); 9196 stream->set_enabled(true);
9197 // Add a duration event. 9197 // Add a duration event.
9198 Dart_TimelineDuration("testDurationEvent", 0, 1); 9198 Dart_TimelineEvent("testDurationEvent",
9199 0,
9200 1,
9201 Dart_Timeline_Event_Duration,
9202 0, NULL, NULL);
9199 // Check that it is in the output. 9203 // Check that it is in the output.
9200 TimelineEventRecorder* recorder = Timeline::recorder(); 9204 TimelineEventRecorder* recorder = Timeline::recorder();
9201 Timeline::ReclaimCachedBlocksFromThreads(); 9205 Timeline::ReclaimCachedBlocksFromThreads();
9202 JSONStream js; 9206 JSONStream js;
9203 IsolateTimelineEventFilter filter(isolate->main_port()); 9207 IsolateTimelineEventFilter filter(isolate->main_port());
9204 recorder->PrintJSON(&js, &filter); 9208 recorder->PrintJSON(&js, &filter);
9205 EXPECT_SUBSTRING("testDurationEvent", js.ToCString()); 9209 EXPECT_SUBSTRING("testDurationEvent", js.ToCString());
9206 } 9210 }
9207 9211
9208 9212
9209 TEST_CASE(Timeline_Dart_TimelineInstant) { 9213 TEST_CASE(Timeline_Dart_TimelineInstant) {
9210 Isolate* isolate = Isolate::Current(); 9214 Isolate* isolate = Isolate::Current();
9211 // Grab embedder stream. 9215 // Grab embedder stream.
9212 TimelineStream* stream = Timeline::GetEmbedderStream(); 9216 TimelineStream* stream = Timeline::GetEmbedderStream();
9213 // Make sure it is enabled. 9217 // Make sure it is enabled.
9214 stream->set_enabled(true); 9218 stream->set_enabled(true);
9215 Dart_TimelineInstant("testInstantEvent"); 9219 Dart_TimelineEvent("testInstantEvent",
9220 0,
9221 1,
9222 Dart_Timeline_Event_Instant,
9223 0, NULL, NULL);
9216 // Check that it is in the output. 9224 // Check that it is in the output.
9217 TimelineEventRecorder* recorder = Timeline::recorder(); 9225 TimelineEventRecorder* recorder = Timeline::recorder();
9218 Timeline::ReclaimCachedBlocksFromThreads(); 9226 Timeline::ReclaimCachedBlocksFromThreads();
9219 JSONStream js; 9227 JSONStream js;
9220 IsolateTimelineEventFilter filter(isolate->main_port()); 9228 IsolateTimelineEventFilter filter(isolate->main_port());
9221 recorder->PrintJSON(&js, &filter); 9229 recorder->PrintJSON(&js, &filter);
9222 EXPECT_SUBSTRING("testInstantEvent", js.ToCString()); 9230 EXPECT_SUBSTRING("testInstantEvent", js.ToCString());
9223 } 9231 }
9224 9232
9225 9233
9226 TEST_CASE(Timeline_Dart_TimelineAsyncDisabled) { 9234 TEST_CASE(Timeline_Dart_TimelineAsyncDisabled) {
9227 // Grab embedder stream. 9235 // Grab embedder stream.
9228 TimelineStream* stream = Timeline::GetEmbedderStream(); 9236 TimelineStream* stream = Timeline::GetEmbedderStream();
9229 // Make sure it is disabled. 9237 // Make sure it is disabled.
9230 stream->set_enabled(false); 9238 stream->set_enabled(false);
9231 int64_t async_id = -1; 9239 int64_t async_id = 99;
9232 Dart_TimelineAsyncBegin("testAsyncEvent", &async_id); 9240 Dart_TimelineEvent("testAsyncEvent",
9233 // Expect that the |async_id| is negative because the stream is disabled. 9241 0,
9234 EXPECT(async_id < 0); 9242 async_id,
9235 // Call Dart_TimelineAsyncEnd with a negative async_id. 9243 Dart_Timeline_Event_Async_Begin,
9236 Dart_TimelineAsyncEnd("testAsyncEvent", async_id); 9244 0, NULL, NULL);
9237 // Check that testAsync is not in the output. 9245 // Check that testAsync is not in the output.
9238 TimelineEventRecorder* recorder = Timeline::recorder(); 9246 TimelineEventRecorder* recorder = Timeline::recorder();
9239 Timeline::ReclaimCachedBlocksFromThreads(); 9247 Timeline::ReclaimCachedBlocksFromThreads();
9240 JSONStream js; 9248 JSONStream js;
9241 TimelineEventFilter filter; 9249 TimelineEventFilter filter;
9242 recorder->PrintJSON(&js, &filter); 9250 recorder->PrintJSON(&js, &filter);
9243 EXPECT_NOTSUBSTRING("testAsyncEvent", js.ToCString()); 9251 EXPECT_NOTSUBSTRING("testAsyncEvent", js.ToCString());
9244 } 9252 }
9245 9253
9246 9254
9247 TEST_CASE(Timeline_Dart_TimelineAsync) { 9255 TEST_CASE(Timeline_Dart_TimelineAsync) {
9248 Isolate* isolate = Isolate::Current(); 9256 Isolate* isolate = Isolate::Current();
9249 // Grab embedder stream. 9257 // Grab embedder stream.
9250 TimelineStream* stream = Timeline::GetEmbedderStream(); 9258 TimelineStream* stream = Timeline::GetEmbedderStream();
9251 // Make sure it is enabled. 9259 // Make sure it is enabled.
9252 stream->set_enabled(true); 9260 stream->set_enabled(true);
9253 int64_t async_id = -1; 9261 int64_t async_id = 99;
9254 Dart_TimelineAsyncBegin("testAsyncEvent", &async_id); 9262 Dart_TimelineEvent("testAsyncEvent",
9255 // Expect that the |async_id| is >= 0. 9263 0,
9256 EXPECT(async_id >= 0); 9264 async_id,
9257 9265 Dart_Timeline_Event_Async_Begin,
9258 Dart_TimelineAsyncEnd("testAsyncEvent", async_id); 9266 0, NULL, NULL);
9259 9267
9260 // Check that it is in the output. 9268 // Check that it is in the output.
9261 TimelineEventRecorder* recorder = Timeline::recorder(); 9269 TimelineEventRecorder* recorder = Timeline::recorder();
9262 Timeline::ReclaimCachedBlocksFromThreads(); 9270 Timeline::ReclaimCachedBlocksFromThreads();
9263 JSONStream js; 9271 JSONStream js;
9264 IsolateTimelineEventFilter filter(isolate->main_port()); 9272 IsolateTimelineEventFilter filter(isolate->main_port());
9265 recorder->PrintJSON(&js, &filter); 9273 recorder->PrintJSON(&js, &filter);
9266 EXPECT_SUBSTRING("testAsyncEvent", js.ToCString()); 9274 EXPECT_SUBSTRING("testAsyncEvent", js.ToCString());
9267 } 9275 }
9268 9276
(...skipping 572 matching lines...) Expand 10 before | Expand all | Expand 10 after
9841 EXPECT(!start_called); 9849 EXPECT(!start_called);
9842 EXPECT(!stop_called); 9850 EXPECT(!stop_called);
9843 Timeline::SetStreamEmbedderEnabled(false); 9851 Timeline::SetStreamEmbedderEnabled(false);
9844 EXPECT(!start_called); 9852 EXPECT(!start_called);
9845 EXPECT(stop_called); 9853 EXPECT(stop_called);
9846 } 9854 }
9847 9855
9848 #endif // !PRODUCT 9856 #endif // !PRODUCT
9849 9857
9850 } // namespace dart 9858 } // namespace dart
OLDNEW
« 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