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

Side by Side Diff: tools/coverage.dart

Issue 22872012: Remove Encoding-enum from dart:io and add interface in dart:convert. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix typo. Created 7 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 | Annotate | Revision Log
« no previous file with comments | « tests/standalone/vmservice/test_helper.dart ('k') | tools/ddbg.dart » ('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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 // This test forks a second vm process that runs a dart script as 5 // This test forks a second vm process that runs a dart script as
6 // a debug target, single stepping through the entire program, and 6 // a debug target, single stepping through the entire program, and
7 // recording each breakpoint. At the end, a coverage map of the source 7 // recording each breakpoint. At the end, a coverage map of the source
8 // is printed. 8 // is printed.
9 // 9 //
10 // Usage: dart coverage.dart [--wire] [--verbose] target_script.dart 10 // Usage: dart coverage.dart [--wire] [--verbose] target_script.dart
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 bool shutdownEventSeen = false; 207 bool shutdownEventSeen = false;
208 int isolateId = 0; 208 int isolateId = 0;
209 int libraryId = null; 209 int libraryId = null;
210 210
211 int nextMessageId = 0; 211 int nextMessageId = 0;
212 bool isPaused = false; 212 bool isPaused = false;
213 bool pendingAck = false; 213 bool pendingAck = false;
214 214
215 Debugger(this.targetProcess) { 215 Debugger(this.targetProcess) {
216 var stdoutStringStream = targetProcess.stdout 216 var stdoutStringStream = targetProcess.stdout
217 .transform(new StringDecoder()) 217 .transform(UTF8.decoder)
218 .transform(new LineSplitter()); 218 .transform(new LineSplitter());
219 stdoutStringStream.listen((line) { 219 stdoutStringStream.listen((line) {
220 if (showDebuggeeOutput) { 220 if (showDebuggeeOutput) {
221 print("TARG: $line"); 221 print("TARG: $line");
222 } 222 }
223 if (line.startsWith("Debugger listening")) { 223 if (line.startsWith("Debugger listening")) {
224 RegExp portExpr = new RegExp(r"\d+"); 224 RegExp portExpr = new RegExp(r"\d+");
225 var port = portExpr.stringMatch(line); 225 var port = portExpr.stringMatch(line);
226 var pid = targetProcess.pid; 226 var pid = targetProcess.pid;
227 print("Coverage target process (pid $pid) found " 227 print("Coverage target process (pid $pid) found "
228 "listening on port $port."); 228 "listening on port $port.");
229 openConnection(int.parse(port)); 229 openConnection(int.parse(port));
230 } 230 }
231 }); 231 });
232 232
233 var stderrStringStream = targetProcess.stderr 233 var stderrStringStream = targetProcess.stderr
234 .transform(new StringDecoder()) 234 .transform(UTF8.decoder)
235 .transform(new LineSplitter()); 235 .transform(new LineSplitter());
236 stderrStringStream.listen((line) { 236 stderrStringStream.listen((line) {
237 if (showDebuggeeOutput) { 237 if (showDebuggeeOutput) {
238 print("TARG: $line"); 238 print("TARG: $line");
239 } 239 }
240 }); 240 });
241 } 241 }
242 242
243 // Handle debugger events, updating the debugger state. 243 // Handle debugger events, updating the debugger state.
244 void handleEvent(Map<String,dynamic> msg) { 244 void handleEvent(Map<String,dynamic> msg) {
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
365 365
366 // Record error message. 366 // Record error message.
367 void error(String s) { 367 void error(String s) {
368 errors.add(s); 368 errors.add(s);
369 } 369 }
370 370
371 void openConnection(int portNumber) { 371 void openConnection(int portNumber) {
372 Socket.connect("127.0.0.1", portNumber).then((s) { 372 Socket.connect("127.0.0.1", portNumber).then((s) {
373 socket = s; 373 socket = s;
374 socket.setOption(SocketOption.TCP_NODELAY, true); 374 socket.setOption(SocketOption.TCP_NODELAY, true);
375 var stringStream = socket.transform(new StringDecoder()); 375 var stringStream = socket.transform(UTF8.decoder);
376 stringStream.listen( 376 stringStream.listen(
377 (str) { 377 (str) {
378 try { 378 try {
379 responses.append(str); 379 responses.append(str);
380 handleMessages(); 380 handleMessages();
381 } catch(e, trace) { 381 } catch(e, trace) {
382 print("Unexpected exception:\n$e\n$trace"); 382 print("Unexpected exception:\n$e\n$trace");
383 cleanup(); 383 cleanup();
384 } 384 }
385 }, 385 },
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
540 targetOpts.add(str); 540 targetOpts.add(str);
541 break; 541 break;
542 } 542 }
543 } 543 }
544 544
545 Process.start(options.executable, targetOpts).then((Process process) { 545 Process.start(options.executable, targetOpts).then((Process process) {
546 process.stdin.close(); 546 process.stdin.close();
547 debugger = new Debugger(process); 547 debugger = new Debugger(process);
548 }); 548 });
549 } 549 }
OLDNEW
« no previous file with comments | « tests/standalone/vmservice/test_helper.dart ('k') | tools/ddbg.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698