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

Side by Side Diff: tests/standalone/vmservice/test_helper.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 ddbg. 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
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 vmservice_test_helper; 5 library vmservice_test_helper;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:convert'; 8 import 'dart:convert';
9 import 'dart:io'; 9 import 'dart:io';
10 import 'dart:json' as JSON; 10 import 'dart:json' as JSON;
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 String dartExecutable = Platform.executable; 90 String dartExecutable = Platform.executable;
91 print('** Launching $scriptPath'); 91 print('** Launching $scriptPath');
92 return Process.start(dartExecutable, 92 return Process.start(dartExecutable,
93 ['--enable-vm-service:0', scriptPath]).then((p) { 93 ['--enable-vm-service:0', scriptPath]).then((p) {
94 94
95 Completer completer = new Completer(); 95 Completer completer = new Completer();
96 process = p; 96 process = p;
97 var portNumber; 97 var portNumber;
98 var blank; 98 var blank;
99 var first = true; 99 var first = true;
100 process.stdout.transform(new StringDecoder()) 100 process.stdout.transform(UTF8.decoder)
101 .transform(new LineSplitter()).listen((line) { 101 .transform(new LineSplitter()).listen((line) {
102 if (line.startsWith('VmService listening on port ')) { 102 if (line.startsWith('VmService listening on port ')) {
103 RegExp portExp = new RegExp(r"\d+"); 103 RegExp portExp = new RegExp(r"\d+");
104 var port = portExp.stringMatch(line); 104 var port = portExp.stringMatch(line);
105 portNumber = int.parse(port); 105 portNumber = int.parse(port);
106 } 106 }
107 if (line == '') { 107 if (line == '') {
108 // Received blank line. 108 // Received blank line.
109 blank = true; 109 blank = true;
110 } 110 }
111 if (portNumber != null && blank == true && first == true) { 111 if (portNumber != null && blank == true && first == true) {
112 completer.complete(portNumber); 112 completer.complete(portNumber);
113 // Stop repeat completions. 113 // Stop repeat completions.
114 first = false; 114 first = false;
115 print('** Signaled to run test queries on $portNumber'); 115 print('** Signaled to run test queries on $portNumber');
116 } 116 }
117 print(line); 117 print(line);
118 }); 118 });
119 process.stderr.transform(new StringDecoder()) 119 process.stderr.transform(UTF8.decoder)
120 .transform(new LineSplitter()).listen((line) { 120 .transform(new LineSplitter()).listen((line) {
121 print(line); 121 print(line);
122 }); 122 });
123 process.exitCode.then((code) { 123 process.exitCode.then((code) {
124 Expect.equals(0, code, 'Launched dart executable exited with error.'); 124 Expect.equals(0, code, 'Launched dart executable exited with error.');
125 }); 125 });
126 return completer.future; 126 return completer.future;
127 }); 127 });
128 } 128 }
129 129
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 if (isolate['id'] == id) { 174 if (isolate['id'] == id) {
175 exists = true; 175 exists = true;
176 Expect.isTrue(isolate['name'].startsWith(name), 176 Expect.isTrue(isolate['name'].startsWith(name),
177 'Isolate $id does not have name prefix: $name' 177 'Isolate $id does not have name prefix: $name'
178 ' (was ${isolate['name']})'); 178 ' (was ${isolate['name']})');
179 } 179 }
180 }); 180 });
181 Expect.isTrue(exists, 'No isolate with id: $id'); 181 Expect.isTrue(exists, 'No isolate with id: $id');
182 } 182 }
183 } 183 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698