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

Side by Side Diff: utils/testrunner/layout_test_controller.dart

Issue 11770004: Rename Date to DateTime. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments and keep Backwards-compatibility class Date. Created 7 years, 11 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 | « utils/template/uitest.dart ('k') | utils/testrunner/standard_test_runner.dart » ('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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 // The following set of variables should be set by the caller that 5 // The following set of variables should be set by the caller that
6 // #sources this file. 6 // #sources this file.
7 /** Whether to include elapsed time. */ 7 /** Whether to include elapsed time. */
8 8
9 part of test_controller; 9 part of test_controller;
10 10
(...skipping 24 matching lines...) Expand all
35 String baseUrl; 35 String baseUrl;
36 36
37 /** The print function to use. */ 37 /** The print function to use. */
38 Function tprint; 38 Function tprint;
39 39
40 /** A callback function to notify the caller we are done. */ 40 /** A callback function to notify the caller we are done. */
41 Function notifyDone; 41 Function notifyDone;
42 42
43 // Variable below here are local to this file. 43 // Variable below here are local to this file.
44 var passCount = 0, failCount = 0, errorCount = 0; 44 var passCount = 0, failCount = 0, errorCount = 0;
45 Date start; 45 DateTime start;
46 46
47 class Macros { 47 class Macros {
48 static const String testTime = '<TIME>'; 48 static const String testTime = '<TIME>';
49 static const String testfile = '<FILENAME>'; 49 static const String testfile = '<FILENAME>';
50 static const String testGroup = '<GROUPNAME>'; 50 static const String testGroup = '<GROUPNAME>';
51 static const String testDescription = '<TESTNAME>'; 51 static const String testDescription = '<TESTNAME>';
52 static const String testMessage = '<MESSAGE>'; 52 static const String testMessage = '<MESSAGE>';
53 static const String testStacktrace = '<STACK>'; 53 static const String testStacktrace = '<STACK>';
54 } 54 }
55 55
(...skipping 16 matching lines...) Expand all
72 var idx = label.lastIndexOf('###'); 72 var idx = label.lastIndexOf('###');
73 var group = '', test = ''; 73 var group = '', test = '';
74 if (idx >= 0) { 74 if (idx >= 0) {
75 group = '${label.substring(0, idx).replaceAll("###", " ")} '; 75 group = '${label.substring(0, idx).replaceAll("###", " ")} ';
76 test = '${label.substring(idx+3)} '; 76 test = '${label.substring(idx+3)} ';
77 } else { 77 } else {
78 test = '$label '; 78 test = '$label ';
79 } 79 }
80 var elapsed = ''; 80 var elapsed = '';
81 if (includeTime) { 81 if (includeTime) {
82 var end = new Date.now(); 82 var end = new DateTime.now();
83 double duration = (end.difference(start)).inMilliseconds.toDouble(); 83 double duration = (end.difference(start)).inMilliseconds.toDouble();
84 duration /= 1000; 84 duration /= 1000;
85 elapsed = '${duration.toStringAsFixed(3)}s '; 85 elapsed = '${duration.toStringAsFixed(3)}s ';
86 } 86 }
87 tprint(formatMessage('$testfile ', group, test, elapsed, result, message)); 87 tprint(formatMessage('$testfile ', group, test, elapsed, result, message));
88 } 88 }
89 89
90 pass(start, label) { 90 pass(start, label) {
91 ++passCount; 91 ++passCount;
92 outputResult(start, label, 'pass'); 92 outputResult(start, label, 'pass');
(...skipping 27 matching lines...) Expand all
120 complete() { 120 complete() {
121 if (summarize) { 121 if (summarize) {
122 printSummary(testfile, passCount, failCount, errorCount); 122 printSummary(testfile, passCount, failCount, errorCount);
123 } 123 }
124 notifyDone(failCount > 0 ? -1 : 0); 124 notifyDone(failCount > 0 ? -1 : 0);
125 } 125 }
126 126
127 runTextLayoutTest(testNum) { 127 runTextLayoutTest(testNum) {
128 var url = '$baseUrl?test=$testNum'; 128 var url = '$baseUrl?test=$testNum';
129 var stdout = new List(); 129 var stdout = new List();
130 start = new Date.now(); 130 start = new DateTime.now();
131 Process.start(drt, [url]).then((process) { 131 Process.start(drt, [url]).then((process) {
132 // Drain stderr to not leak resources. 132 // Drain stderr to not leak resources.
133 process.stderr.onData = process.stderr.read; 133 process.stderr.onData = process.stderr.read;
134 StringInputStream stdoutStringStream = 134 StringInputStream stdoutStringStream =
135 new StringInputStream(process.stdout); 135 new StringInputStream(process.stdout);
136 stdoutStringStream.onLine = () { 136 stdoutStringStream.onLine = () {
137 if (stdoutStringStream.closed) return; 137 if (stdoutStringStream.closed) return;
138 var line = stdoutStringStream.readLine(); 138 var line = stdoutStringStream.readLine();
139 while (null != line) { 139 while (null != line) {
140 stdout.add(line); 140 stdout.add(line);
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 if (!done) error(start, label, 'Failed to parse output'); 206 if (!done) error(start, label, 'Failed to parse output');
207 runTextLayoutTest(testNum + 1); 207 runTextLayoutTest(testNum + 1);
208 } 208 }
209 }; 209 };
210 }); 210 });
211 } 211 }
212 212
213 runPixelLayoutTest(int testNum) { 213 runPixelLayoutTest(int testNum) {
214 var url = '$baseUrl?test=$testNum'; 214 var url = '$baseUrl?test=$testNum';
215 var stdout = new List(); 215 var stdout = new List();
216 start = new Date.now(); 216 start = new DateTime.now();
217 Process.start(drt, ["$url'-p"]).then((process) { 217 Process.start(drt, ["$url'-p"]).then((process) {
218 // Drain stderr to not leak resources. 218 // Drain stderr to not leak resources.
219 process.stderr.onData = process.stderr.read; 219 process.stderr.onData = process.stderr.read;
220 ListInputStream stdoutStream = process.stdout; 220 ListInputStream stdoutStream = process.stdout;
221 stdoutStream.onData = () { 221 stdoutStream.onData = () {
222 if (!stdoutStream.closed) { 222 if (!stdoutStream.closed) {
223 var data = stdoutStream.read(); 223 var data = stdoutStream.read();
224 stdout.addAll(data); 224 stdout.addAll(data);
225 } 225 }
226 }; 226 };
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
313 313
314 void runPixelLayoutTests() { 314 void runPixelLayoutTests() {
315 init(); 315 init();
316 runPixelLayoutTest(0); 316 runPixelLayoutTest(0);
317 } 317 }
318 318
319 void runTextLayoutTests() { 319 void runTextLayoutTests() {
320 init(); 320 init();
321 runTextLayoutTest(0); 321 runTextLayoutTest(0);
322 } 322 }
OLDNEW
« no previous file with comments | « utils/template/uitest.dart ('k') | utils/testrunner/standard_test_runner.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698