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

Side by Side Diff: tests/standalone/debugger/debug_lib.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/coverage_test.dart ('k') | tests/standalone/io/file_error_test.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 // Library used by debugger wire protocol tests (standalone VM debugging). 5 // Library used by debugger wire protocol tests (standalone VM debugging).
6 6
7 library DartDebugger; 7 library DartDebugger;
8 8
9 import "dart:async"; 9 import "dart:async";
10 import "dart:convert"; 10 import "dart:convert";
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after
386 386
387 // Data collected from debug target. 387 // Data collected from debug target.
388 Map currentMessage = null; // Currently handled message sent by target. 388 Map currentMessage = null; // Currently handled message sent by target.
389 String scriptUrl = null; 389 String scriptUrl = null;
390 bool shutdownEventSeen = false; 390 bool shutdownEventSeen = false;
391 int isolateId = 0; 391 int isolateId = 0;
392 bool isPaused = false; 392 bool isPaused = false;
393 393
394 Debugger(this.targetProcess, this.script) { 394 Debugger(this.targetProcess, this.script) {
395 var stdoutStringStream = targetProcess.stdout 395 var stdoutStringStream = targetProcess.stdout
396 .transform(new StringDecoder()) 396 .transform(UTF8.decoder)
397 .transform(new LineSplitter()); 397 .transform(new LineSplitter());
398 stdoutStringStream.listen((line) { 398 stdoutStringStream.listen((line) {
399 print("TARG: $line"); 399 print("TARG: $line");
400 if (line.startsWith("Debugger listening")) { 400 if (line.startsWith("Debugger listening")) {
401 RegExp portExpr = new RegExp(r"\d+"); 401 RegExp portExpr = new RegExp(r"\d+");
402 var port = portExpr.stringMatch(line); 402 var port = portExpr.stringMatch(line);
403 print("Debug target found listening at port '$port'"); 403 print("Debug target found listening at port '$port'");
404 openConnection(int.parse(port)); 404 openConnection(int.parse(port));
405 } 405 }
406 }); 406 });
407 407
408 var stderrStringStream = targetProcess.stderr 408 var stderrStringStream = targetProcess.stderr
409 .transform(new StringDecoder()) 409 .transform(UTF8.decoder)
410 .transform(new LineSplitter()); 410 .transform(new LineSplitter());
411 stderrStringStream.listen((line) { 411 stderrStringStream.listen((line) {
412 print("TARG: $line"); 412 print("TARG: $line");
413 }); 413 });
414 } 414 }
415 415
416 // Handle debugger events, updating the debugger state. 416 // Handle debugger events, updating the debugger state.
417 void handleEvent(Map<String,dynamic> msg) { 417 void handleEvent(Map<String,dynamic> msg) {
418 events.add(new Event(msg)); 418 events.add(new Event(msg));
419 419
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
535 535
536 // Record error message. 536 // Record error message.
537 void error(String s) { 537 void error(String s) {
538 errors.add(s); 538 errors.add(s);
539 } 539 }
540 540
541 void openConnection(int portNumber) { 541 void openConnection(int portNumber) {
542 Socket.connect("127.0.0.1", portNumber).then((s) { 542 Socket.connect("127.0.0.1", portNumber).then((s) {
543 s.setOption(SocketOption.TCP_NODELAY, true); 543 s.setOption(SocketOption.TCP_NODELAY, true);
544 this.socket = s; 544 this.socket = s;
545 var stringStream = socket.transform(new StringDecoder()); 545 var stringStream = socket.transform(UTF8.decoder);
546 stringStream.listen((str) { 546 stringStream.listen((str) {
547 try { 547 try {
548 responses.append(str); 548 responses.append(str);
549 handleMessages(); 549 handleMessages();
550 } catch(e, trace) { 550 } catch(e, trace) {
551 print("Unexpected exception:\n$e\n$trace"); 551 print("Unexpected exception:\n$e\n$trace");
552 cleanup(); 552 cleanup();
553 } 553 }
554 }, 554 },
555 onDone: () { 555 onDone: () {
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
616 targetOpts.add("--debuggee"); 616 targetOpts.add("--debuggee");
617 print('args: ${targetOpts.join(" ")}'); 617 print('args: ${targetOpts.join(" ")}');
618 618
619 Process.start(Platform.executable, targetOpts).then((Process process) { 619 Process.start(Platform.executable, targetOpts).then((Process process) {
620 print("Debug target process started, pid ${process.pid}."); 620 print("Debug target process started, pid ${process.pid}.");
621 process.stdin.close(); 621 process.stdin.close();
622 var debugger = new Debugger(process, new DebugScript(script)); 622 var debugger = new Debugger(process, new DebugScript(script));
623 }); 623 });
624 return true; 624 return true;
625 } 625 }
OLDNEW
« no previous file with comments | « tests/standalone/coverage_test.dart ('k') | tests/standalone/io/file_error_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698