| Index: pkg/unittest/lib/interactive_html_config.dart
|
| diff --git a/pkg/unittest/lib/interactive_html_config.dart b/pkg/unittest/lib/interactive_html_config.dart
|
| index 9d43d0988a36c07efc9fc8bac385485334f29568..b962e1e41b5c2b6eaee093c8d43ee5b469cf56b1 100644
|
| --- a/pkg/unittest/lib/interactive_html_config.dart
|
| +++ b/pkg/unittest/lib/interactive_html_config.dart
|
| @@ -20,6 +20,9 @@ library unittest_interactive_html_config;
|
| import 'dart:html';
|
| import 'dart:async';
|
| import 'dart:math';
|
| +
|
| +import 'package:stack_trace/stack_trace.dart';
|
| +
|
| import 'unittest.dart';
|
|
|
| /** The messages exchanged between parent and child. */
|
| @@ -152,17 +155,25 @@ class ChildInteractiveHtmlConfiguration extends HtmlConfiguration {
|
| }
|
|
|
| /**
|
| - * Get the elapsed time for the test, anbd post the test result
|
| - * back to the parent window. If the test failed due to an exception
|
| - * the stack is posted back too (before the test result).
|
| + * Get the elapsed time for the test, and post the test result back to the
|
| + * parent window. If the test failed due to an exception the stack is posted
|
| + * back too (before the test result).
|
| */
|
| void onTestResult(TestCase testCase) {
|
| super.onTestResult(testCase);
|
| DateTime end = new DateTime.now();
|
| int elapsed = end.difference(_testStarts[testCase.id]).inMilliseconds;
|
| if (testCase.stackTrace != null) {
|
| + var message = json.stringify(testCase.stackTrace.frames.map((frame) {
|
| + return <String>{
|
| + "uri": frame.uri.toString(),
|
| + "line": frame.line,
|
| + "column": frame.column,
|
| + "member": frame.member
|
| + };
|
| + }).toList());
|
| _parentWindow.postMessage(
|
| - _Message.text(_Message.STACK, elapsed, testCase.stackTrace), '*');
|
| + _Message.text(_Message.STACK, elapsed, message), '*');
|
| }
|
| _parentWindow.postMessage(
|
| _Message.text(testCase.result, elapsed, testCase.message), '*');
|
| @@ -185,7 +196,7 @@ class ParentInteractiveHtmlConfiguration extends HtmlConfiguration {
|
|
|
|
|
| /** The stack that was posted back from the child, if any. */
|
| - String _stack;
|
| + Trace _stack;
|
|
|
| int _testTime;
|
| /**
|
| @@ -233,7 +244,13 @@ class ParentInteractiveHtmlConfiguration extends HtmlConfiguration {
|
| if (msg.messageType == _Message.LOG) {
|
| logMessage(e.data);
|
| } else if (msg.messageType == _Message.STACK) {
|
| - _stack = msg.body;
|
| + _stack = new Trace(json.parse(msg.body).map((frame) {
|
| + return new Frame(
|
| + Uri.parse(frame['uri']),
|
| + frame['line'],
|
| + frame['column'],
|
| + frame['member']);
|
| + }));
|
| } else {
|
| _testTime = msg.elapsed;
|
| logMessage(_Message.text(_Message.LOG, _testTime, 'Complete'));
|
|
|