OLD | NEW |
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 test_helper; | 5 library 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 'package:observatory/service_io.dart'; | 10 import 'package:observatory/service_io.dart'; |
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
248 print("Checking we are at line $line"); | 248 print("Checking we are at line $line"); |
249 | 249 |
250 ServiceMap stack = await isolate.getStack(); | 250 ServiceMap stack = await isolate.getStack(); |
251 expect(stack.type, equals('Stack')); | 251 expect(stack.type, equals('Stack')); |
252 | 252 |
253 List<Frame> frames = stack['frames']; | 253 List<Frame> frames = stack['frames']; |
254 expect(frames.length, greaterThanOrEqualTo(1)); | 254 expect(frames.length, greaterThanOrEqualTo(1)); |
255 | 255 |
256 Frame top = frames[0]; | 256 Frame top = frames[0]; |
257 Script script = await top.location.script.load(); | 257 Script script = await top.location.script.load(); |
258 if (script.tokenToLine(top.location.tokenPos) != line) { | 258 int actualLine = script.tokenToLine(top.location.tokenPos); |
| 259 if (actualLine != line) { |
259 var sb = new StringBuffer(); | 260 var sb = new StringBuffer(); |
260 sb.write("Expected to be at line $line, but got stack trace:\n"); | 261 sb.write("Expected to be at line $line but actually at line $actualLine"); |
| 262 sb.write("\nFull stack trace:\n"); |
261 for (Frame f in stack['frames']) { | 263 for (Frame f in stack['frames']) { |
262 sb.write(" $f\n"); | 264 sb.write(" $f\n"); |
263 } | 265 } |
264 throw sb.toString(); | 266 throw sb.toString(); |
265 } | 267 } |
266 }; | 268 }; |
267 } | 269 } |
268 | 270 |
269 | 271 |
270 Future<Isolate> resumeIsolate(Isolate isolate) { | 272 Future<Isolate> resumeIsolate(Isolate isolate) { |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
380 }, onError: (e, st) { | 382 }, onError: (e, st) { |
381 process.requestExit(); | 383 process.requestExit(); |
382 if (!_isWebSocketDisconnect(e)) { | 384 if (!_isWebSocketDisconnect(e)) { |
383 print('Unexpected exception in service tests: $e $st'); | 385 print('Unexpected exception in service tests: $e $st'); |
384 throw e; | 386 throw e; |
385 } | 387 } |
386 }); | 388 }); |
387 }); | 389 }); |
388 } | 390 } |
389 } | 391 } |
OLD | NEW |