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

Unified Diff: pkg/unittest/lib/interactive_html_config.dart

Issue 19540015: Roll forward "Use package:stack_trace in unittest." (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/unittest/lib/html_enhanced_config.dart ('k') | pkg/unittest/lib/src/config.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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'));
« no previous file with comments | « pkg/unittest/lib/html_enhanced_config.dart ('k') | pkg/unittest/lib/src/config.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698