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

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

Issue 1362503002: Add global timeline stream overrides (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 3 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') | runtime/vm/isolate.h » ('j') | 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 9423 matching lines...) Expand 10 before | Expand all | Expand 10 after
9434 9434
9435 // Heartbeat test. 9435 // Heartbeat test.
9436 EXPECT_SUBSTRING("\"cat\":\"Compiler\"", buffer); 9436 EXPECT_SUBSTRING("\"cat\":\"Compiler\"", buffer);
9437 EXPECT_SUBSTRING("\"name\":\"CompileFunction\"", buffer); 9437 EXPECT_SUBSTRING("\"name\":\"CompileFunction\"", buffer);
9438 EXPECT_SUBSTRING("\"function\":\"::_main\"", buffer); 9438 EXPECT_SUBSTRING("\"function\":\"::_main\"", buffer);
9439 9439
9440 // Free buffer allocated by AppendStreamConsumer 9440 // Free buffer allocated by AppendStreamConsumer
9441 free(data.buffer); 9441 free(data.buffer);
9442 } 9442 }
9443 9443
9444
9445 TEST_CASE(Timeline_Dart_TimelineGetTraceGlobalOverride) {
9446 const char* kScriptChars =
9447 "foo() => 'a';\n"
9448 "main() => foo();\n";
9449
9450 Dart_Handle lib =
9451 TestCase::LoadTestScript(kScriptChars, NULL);
9452
9453 const char* buffer = NULL;
9454 intptr_t buffer_length = 0;
9455 bool success = false;
9456
9457 // Enable recording of all streams across the entire vm.
9458 Dart_GlobalTimelineSetRecordedStreams(DART_TIMELINE_STREAM_ALL);
9459
9460 // Invoke main, which will be compiled resulting in a compiler event in
9461 // the timeline.
9462 Dart_Handle result = Dart_Invoke(lib,
9463 NewString("main"),
9464 0,
9465 NULL);
9466 EXPECT_VALID(result);
9467
9468 // Grab the trace.
9469 AppendData data;
9470 success = Dart_TimelineGetTrace(AppendStreamConsumer, &data);
9471 EXPECT(success);
9472 buffer = reinterpret_cast<char*>(data.buffer);
9473 buffer_length = data.buffer_length;
9474 EXPECT(buffer_length > 0);
9475 EXPECT(buffer != NULL);
9476
9477 // Heartbeat test.
9478 EXPECT_SUBSTRING("\"cat\":\"Compiler\"", buffer);
9479 EXPECT_SUBSTRING("\"name\":\"CompileFunction\"", buffer);
9480 EXPECT_SUBSTRING("\"function\":\"::_main\"", buffer);
9481
9482 // Free buffer allocated by AppendStreamConsumer
9483 free(data.buffer);
9484 }
9485
9444 } // namespace dart 9486 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/dart_api_impl.cc ('k') | runtime/vm/isolate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698