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

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

Issue 1562993003: Add the forceCompile param to _getSourceReport. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 11 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 | « no previous file | runtime/vm/service.cc » ('j') | runtime/vm/service.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 'dart:developer'; 9 import 'dart:developer';
10 10
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 // Full script 62 // Full script
63 var params = { 'reports' : ['Coverage'], 63 var params = { 'reports' : ['Coverage'],
64 'scriptId' : func.location.script.id }; 64 'scriptId' : func.location.script.id };
65 var coverage = await isolate.invokeRpcNoUpgrade('_getSourceReport', params); 65 var coverage = await isolate.invokeRpcNoUpgrade('_getSourceReport', params);
66 expect(coverage['type'], equals('SourceReport')); 66 expect(coverage['type'], equals('SourceReport'));
67 expect(coverage['ranges'].length, 5); 67 expect(coverage['ranges'].length, 5);
68 expect(coverage['ranges'][0], equals(expectedRange)); 68 expect(coverage['ranges'][0], equals(expectedRange));
69 expect(coverage['scripts'].length, 1); 69 expect(coverage['scripts'].length, 1);
70 expect(coverage['scripts'][0]['uri'], 70 expect(coverage['scripts'][0]['uri'],
71 endsWith('get_source_report_test.dart')); 71 endsWith('get_source_report_test.dart'));
72 bool all_ranges_compiled = true;
73 for (int i = 0; i < coverage['ranges'].length; i++) {
74 if (!coverage['ranges'][i]['compiled']) {
Cutch 2016/01/06 21:43:45 This could be a helper function
turnidge 2016/01/07 19:25:17 Done.
75 all_ranges_compiled = false;
76 }
77 }
78 expect(all_ranges_compiled, isFalse);
79
80 // Force compilation.
81 params = { 'reports' : ['Coverage'],
82 'scriptId' : func.location.script.id,
83 'forceCompile' : true };
84 coverage = await isolate.invokeRpcNoUpgrade('_getSourceReport', params);
85 expect(coverage['type'], equals('SourceReport'));
86 expect(coverage['ranges'].length, 5);
87 all_ranges_compiled = true;
88 for (int i = 0; i < coverage['ranges'].length; i++) {
89 if (!coverage['ranges'][i]['compiled']) {
90 all_ranges_compiled = false;
91 }
92 }
93 expect(all_ranges_compiled, isTrue);
72 94
73 // One function 95 // One function
74 params = { 'reports' : ['Coverage'], 96 params = { 'reports' : ['Coverage'],
75 'scriptId' : func.location.script.id, 97 'scriptId' : func.location.script.id,
76 'tokenPos' : func.location.tokenPos, 98 'tokenPos' : func.location.tokenPos,
77 'endTokenPos' : func.location.endTokenPos }; 99 'endTokenPos' : func.location.endTokenPos };
78 coverage = await isolate.invokeRpcNoUpgrade('_getSourceReport', params); 100 coverage = await isolate.invokeRpcNoUpgrade('_getSourceReport', params);
79 expect(coverage['type'], equals('SourceReport')); 101 expect(coverage['type'], equals('SourceReport'));
80 expect(coverage['ranges'].length, 1); 102 expect(coverage['ranges'].length, 1);
81 expect(coverage['ranges'][0], equals(expectedRange)); 103 expect(coverage['ranges'][0], equals(expectedRange));
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 expect(e.message, 151 expect(e.message,
130 "_getSourceReport: the 'endTokenPos' parameter requires the " 152 "_getSourceReport: the 'endTokenPos' parameter requires the "
131 "\'scriptId\' parameter"); 153 "\'scriptId\' parameter");
132 } 154 }
133 expect(caughtException, isTrue); 155 expect(caughtException, isTrue);
134 }, 156 },
135 157
136 ]; 158 ];
137 159
138 main(args) => runIsolateTests(args, tests, testeeConcurrent: testFunction); 160 main(args) => runIsolateTests(args, tests, testeeConcurrent: testFunction);
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/service.cc » ('j') | runtime/vm/service.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698