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

Unified Diff: runtime/observatory/tests/service/get_cpu_profile_timeline_rpc_test.dart

Issue 1525913002: Observatory: Include profiler samples in the timeline view. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years 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/observatory/lib/src/elements/timeline_page.dart ('k') | runtime/observatory/web/timeline.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/observatory/tests/service/get_cpu_profile_timeline_rpc_test.dart
diff --git a/runtime/observatory/tests/service/get_cpu_profile_timeline_rpc_test.dart b/runtime/observatory/tests/service/get_cpu_profile_timeline_rpc_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..cf534c2d3edaa7f8dfda237c463d1c6483d2cc27
--- /dev/null
+++ b/runtime/observatory/tests/service/get_cpu_profile_timeline_rpc_test.dart
@@ -0,0 +1,56 @@
+// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+// VMOptions=--error_on_bad_type --error_on_bad_override
+
+import 'package:observatory/service_io.dart';
+import 'package:unittest/unittest.dart';
+
+import 'test_helper.dart';
+
+fib(n) {
+ if (n < 0) return 0;
+ if (n == 0) return 1;
+ return fib(n - 1) + fib(n - 2);
+}
+
+testeeDo() {
+ print("Testee doing something.");
+ fib(25);
+ print("Testee did something.");
+}
+
+var tests = [
+ (Isolate isolate) async {
+ var params = {
+ 'tags': 'VMUser'
+ };
+ var result = await isolate.invokeRpcNoUpgrade(
+ '_getCpuProfileTimeline', params);
+ print(result);
+ expect(result['type'], equals('_CpuProfileTimeline'));
+
+ var isString = new isInstanceOf<String>();
+
+ Map frames = result['stackFrames'];
+ for (Map frame in frames.values) {
+ expect(frame['category'], isString);
+ expect(frame['name'], isString);
+ if (frame['parent'] != null) {
+ expect(frames.containsKey(frame['parent']), isTrue);
+ }
+ }
+
+ List events = result['traceEvents'];
+ for (Map event in events) {
+ expect(event['ph'], equals('P'));
+ expect(event['pid'], isString);
+ expect(event['tid'], isString);
+ expect(event['ts'], isString);
+ expect(event['category'], equals("Dart"));
+ expect(frames.containsKey(event['sf']), isTrue);
+ }
+ },
+];
+
+main(args) async => runIsolateTests(args, tests, testeeBefore: testeeDo);
« no previous file with comments | « runtime/observatory/lib/src/elements/timeline_page.dart ('k') | runtime/observatory/web/timeline.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698