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

Side by Side Diff: runtime/observatory/tests/service/get_cpu_profile_timeline_rpc_test.dart

Issue 2759973004: Fix observatory tests broken by running dartfmt. Temporarily reverted formatting for evaluate_activ… (Closed)
Patch Set: Created 3 years, 9 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
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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 // VMOptions=--error_on_bad_type --error_on_bad_override 4 // VMOptions=--error_on_bad_type --error_on_bad_override
5 5
6 import 'package:observatory/service_io.dart'; 6 import 'package:observatory/service_io.dart';
7 import 'package:unittest/unittest.dart'; 7 import 'package:unittest/unittest.dart';
8 8
9 import 'test_helper.dart'; 9 import 'test_helper.dart';
10 10
11 fib(n) { 11 fib(n) {
12 if (n < 0) return 0; 12 if (n < 0) return 0;
13 if (n == 0) return 1; 13 if (n == 0) return 1;
14 return fib(n - 1) + fib(n - 2); 14 return fib(n - 1) + fib(n - 2);
15 } 15 }
16 16
17 testeeDo() { 17 testeeDo() {
18 print("Testee doing something."); 18 print("Testee doing something.");
19 fib(25); 19 fib(25);
20 print("Testee did something."); 20 print("Testee did something.");
21 } 21 }
22 22
23 var tests = [ 23 var tests = [
24 (Isolate isolate) async { 24 (Isolate isolate) async {
25 var params = { 25 var params = {'tags': 'VMUser'};
26 'tags': 'VMUser' 26 var result =
27 }; 27 await isolate.invokeRpcNoUpgrade('_getCpuProfileTimeline', params);
28 var result = await isolate.invokeRpcNoUpgrade(
29 '_getCpuProfileTimeline', params);
30 print(result); 28 print(result);
31 expect(result['type'], equals('_CpuProfileTimeline')); 29 expect(result['type'], equals('_CpuProfileTimeline'));
32 30
33 var isString = new isInstanceOf<String>(); 31 var isString = new isInstanceOf<String>();
34 var isInt = new isInstanceOf<int>(); 32 var isInt = new isInstanceOf<int>();
35 33
36 Map frames = result['stackFrames']; 34 Map frames = result['stackFrames'];
37 for (Map frame in frames.values) { 35 for (Map frame in frames.values) {
38 expect(frame['category'], isString); 36 expect(frame['category'], isString);
39 expect(frame['name'], isString); 37 expect(frame['name'], isString);
40 if (frame['parent'] != null) { 38 if (frame['parent'] != null) {
41 expect(frames.containsKey(frame['parent']), isTrue); 39 expect(frames.containsKey(frame['parent']), isTrue);
42 } 40 }
43 } 41 }
44 42
45 List events = result['traceEvents']; 43 List events = result['traceEvents'];
46 for (Map event in events) { 44 for (Map event in events) {
47 expect(event['ph'], equals('P')); 45 expect(event['ph'], equals('P'));
48 expect(event['pid'], isInt); 46 expect(event['pid'], isInt);
49 expect(event['tid'], isInt); 47 expect(event['tid'], isInt);
50 expect(event['ts'], isInt); 48 expect(event['ts'], isInt);
51 expect(event['cat'], equals("Dart")); 49 expect(event['cat'], equals("Dart"));
52 expect(frames.containsKey(event['sf']), isTrue); 50 expect(frames.containsKey(event['sf']), isTrue);
53 } 51 }
54 }, 52 },
55 ]; 53 ];
56 54
57 main(args) async => runIsolateTests(args, tests, testeeBefore: testeeDo); 55 main(args) async => runIsolateTests(args, tests, testeeBefore: testeeDo);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698