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

Side by Side Diff: pkg/unittest/lib/interactive_html_config.dart

Issue 21310003: Fix a couple of issues in the interactive config that the analyzer found. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 4 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 | « no previous file | pkg/unittest/pubspec.yaml » ('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 /** 5 /**
6 * This configuration can be used to rerun selected tests, as well 6 * This configuration can be used to rerun selected tests, as well
7 * as see diagnostic output from tests. It runs each test in its own 7 * as see diagnostic output from tests. It runs each test in its own
8 * IFrame, so the configuration consists of two parts - a 'parent' 8 * IFrame, so the configuration consists of two parts - a 'parent'
9 * config that manages all the tests, and a 'child' config for the 9 * config that manages all the tests, and a 'child' config for the
10 * IFrame that runs the individual tests. 10 * IFrame that runs the individual tests.
11 * 11 *
12 * Note: this unit test configuration will not work with the debugger (the tests 12 * Note: this unit test configuration will not work with the debugger (the tests
13 * are executed in a separate IFrame). 13 * are executed in a separate IFrame).
14 */ 14 */
15 library unittest_interactive_html_config; 15 library unittest_interactive_html_config;
16 16
17 // TODO(gram) - add options for: remove IFrame on done/keep 17 // TODO(gram) - add options for: remove IFrame on done/keep
18 // IFrame for failed tests/keep IFrame for all tests. 18 // IFrame for failed tests/keep IFrame for all tests.
19 19
20 import 'dart:html'; 20 import 'dart:html';
21 import 'dart:async'; 21 import 'dart:async';
22 import 'dart:json' as json;
22 import 'dart:math'; 23 import 'dart:math';
23 24
24 import 'package:stack_trace/stack_trace.dart'; 25 import 'package:stack_trace/stack_trace.dart';
25 26
26 import 'unittest.dart'; 27 import 'unittest.dart';
27 28
28 /** The messages exchanged between parent and child. */ 29 /** The messages exchanged between parent and child. */
29 class _Message { 30 class _Message {
30 static const START = 'start'; 31 static const START = 'start';
31 static const LOG = 'log'; 32 static const LOG = 'log';
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 * Get the elapsed time for the test, and post the test result back to the 159 * Get the elapsed time for the test, and post the test result back to the
159 * parent window. If the test failed due to an exception the stack is posted 160 * parent window. If the test failed due to an exception the stack is posted
160 * back too (before the test result). 161 * back too (before the test result).
161 */ 162 */
162 void onTestResult(TestCase testCase) { 163 void onTestResult(TestCase testCase) {
163 super.onTestResult(testCase); 164 super.onTestResult(testCase);
164 DateTime end = new DateTime.now(); 165 DateTime end = new DateTime.now();
165 int elapsed = end.difference(_testStarts[testCase.id]).inMilliseconds; 166 int elapsed = end.difference(_testStarts[testCase.id]).inMilliseconds;
166 if (testCase.stackTrace != null) { 167 if (testCase.stackTrace != null) {
167 var message = json.stringify(testCase.stackTrace.frames.map((frame) { 168 var message = json.stringify(testCase.stackTrace.frames.map((frame) {
168 return <String>{ 169 return <String, dynamic>{
169 "uri": frame.uri.toString(), 170 "uri": frame.uri.toString(),
170 "line": frame.line, 171 "line": frame.line,
171 "column": frame.column, 172 "column": frame.column,
172 "member": frame.member 173 "member": frame.member
173 }; 174 };
174 }).toList()); 175 }).toList());
175 _parentWindow.postMessage( 176 _parentWindow.postMessage(
176 _Message.text(_Message.STACK, elapsed, message), '*'); 177 _Message.text(_Message.STACK, elapsed, message), '*');
177 } 178 }
178 _parentWindow.postMessage( 179 _parentWindow.postMessage(
(...skipping 521 matching lines...) Expand 10 before | Expand all | Expand 10 after
700 ul, menu, dir { 701 ul, menu, dir {
701 display: block; 702 display: block;
702 list-style-type: disc; 703 list-style-type: disc;
703 -webkit-margin-before: 1em; 704 -webkit-margin-before: 1em;
704 -webkit-margin-after: 1em; 705 -webkit-margin-after: 1em;
705 -webkit-margin-start: 0px; 706 -webkit-margin-start: 0px;
706 -webkit-margin-end: 0px; 707 -webkit-margin-end: 0px;
707 -webkit-padding-start: 40px; 708 -webkit-padding-start: 40px;
708 } 709 }
709 """; 710 """;
OLDNEW
« no previous file with comments | « no previous file | pkg/unittest/pubspec.yaml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698