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

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

Issue 1726773002: Refactor service tests in preparation of running on sky_shell (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 10 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) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, 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 import 'test_helper.dart'; 8 import 'test_helper.dart';
9 import 'service_test_common.dart';
9 import 'dart:developer'; 10 import 'dart:developer';
10 11
11 int globalVar = 100; 12 int globalVar = 100;
12 13
13 class MyClass { 14 class MyClass {
14 static void myFunction(int value) { 15 static void myFunction(int value) {
15 if (value < 0) { 16 if (value < 0) {
16 print("negative"); 17 print("negative");
17 } else { 18 } else {
18 print("positive"); 19 print("positive");
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 expect(stack['frames'].length, greaterThanOrEqualTo(2)); 56 expect(stack['frames'].length, greaterThanOrEqualTo(2));
56 expect(stack['frames'][0].function.name, equals('myFunction')); 57 expect(stack['frames'][0].function.name, equals('myFunction'));
57 expect(stack['frames'][0].function.dartOwner.name, equals('MyClass')); 58 expect(stack['frames'][0].function.dartOwner.name, equals('MyClass'));
58 59
59 var func = stack['frames'][0].function; 60 var func = stack['frames'][0].function;
60 expect(func.name, equals('myFunction')); 61 expect(func.name, equals('myFunction'));
61 await func.load(); 62 await func.load();
62 63
63 var expectedRange = { 64 var expectedRange = {
64 'scriptIndex': 0, 65 'scriptIndex': 0,
65 'startPos': 33, 66 'startPos': 38,
66 'endPos': 82, 67 'endPos': 87,
67 'compiled': true, 68 'compiled': true,
68 'coverage': {'hits': [48, 66, 76], 'misses': [54]} 69 'coverage': {'hits': [53, 71, 81], 'misses': [59]}
69 }; 70 };
70 71
71 // Full script 72 // Full script
72 var params = { 'reports' : ['Coverage'], 73 var params = { 'reports' : ['Coverage'],
73 'scriptId' : func.location.script.id }; 74 'scriptId' : func.location.script.id };
74 var coverage = await isolate.invokeRpcNoUpgrade('_getSourceReport', params); 75 var coverage = await isolate.invokeRpcNoUpgrade('_getSourceReport', params);
75 expect(coverage['type'], equals('SourceReport')); 76 expect(coverage['type'], equals('SourceReport'));
76 expect(coverage['ranges'].length, 6); 77 expect(coverage['ranges'].length, 6);
77 expect(coverage['ranges'][0], equals(expectedRange)); 78 expect(coverage['ranges'][0], equals(expectedRange));
78 expect(coverage['scripts'].length, 1); 79 expect(coverage['scripts'].length, 1);
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 expect(e.message, 150 expect(e.message,
150 "_getSourceReport: the 'endTokenPos' parameter requires the " 151 "_getSourceReport: the 'endTokenPos' parameter requires the "
151 "\'scriptId\' parameter"); 152 "\'scriptId\' parameter");
152 } 153 }
153 expect(caughtException, isTrue); 154 expect(caughtException, isTrue);
154 }, 155 },
155 156
156 ]; 157 ];
157 158
158 main(args) => runIsolateTests(args, tests, testeeConcurrent: testFunction); 159 main(args) => runIsolateTests(args, tests, testeeConcurrent: testFunction);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698