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

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

Issue 10914049: Added support for layout render tests. These use expected values for the text render output from Du… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 3 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/testrunner/options.dart ('k') | utils/testrunner/utils.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 //#!/usr/bin/env dart 1 //#!/usr/bin/env dart
2 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 2 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
3 // for details. All rights reserved. Use of this source code is governed by a 3 // for details. All rights reserved. Use of this source code is governed by a
4 // BSD-style license that can be found in the LICENSE file. 4 // BSD-style license that can be found in the LICENSE file.
5 5
6 /** 6 /**
7 * testrunner is a program to run Dart unit tests. Unlike $DART/tools/test.dart, 7 * testrunner is a program to run Dart unit tests. Unlike $DART/tools/test.dart,
8 * this program is intended for 3rd parties to be able to run unit tests in 8 * this program is intended for 3rd parties to be able to run unit tests in
9 * a batched fashion. As such, it adds some features and removes others. Some 9 * a batched fashion. As such, it adds some features and removes others. Some
10 * of the removed features are: 10 * of the removed features are:
(...skipping 30 matching lines...) Expand all
41 * The three runtimes are: 41 * The three runtimes are:
42 * 42 *
43 * vm - run native Dart in the VM; i.e. using $DARTSDK/dart-sdk/bin/dart. 43 * vm - run native Dart in the VM; i.e. using $DARTSDK/dart-sdk/bin/dart.
44 * drt-dart - run native Dart in DumpRenderTree, the headless version of 44 * drt-dart - run native Dart in DumpRenderTree, the headless version of
45 * Dartium, which is located in $DARTSDK/chromium/DumpRenderTree, if 45 * Dartium, which is located in $DARTSDK/chromium/DumpRenderTree, if
46 * you intsalled the SDK that is bundled with the editor, or available 46 * you intsalled the SDK that is bundled with the editor, or available
47 * from http://gsdview.appspot.com/dartium-archive/continuous/ 47 * from http://gsdview.appspot.com/dartium-archive/continuous/
48 * otherwise. 48 * otherwise.
49 * 49 *
50 * drt-js - run Dart compiled to Javascript in DumpRenderTree. 50 * drt-js - run Dart compiled to Javascript in DumpRenderTree.
51 *
52 * testrunner supports simple DOM render tests. These use expected values
53 * for the text render output from DumpRenderTree. When running a test in DRT
54 * testrunner will see if there is a file with a .render extension in the
55 * same directory as the test file and with the same base file name. If so
56 * it will do additional checks of the rendered layout.
57 *
58 * Here is a simple example test:
59 *
60 * #library('sample');
61 * #import('dart:html');
62 * #import('pkg:unittest/unittest.dart');
63 *
64 * main() {
65 * group('foo', () {
66 * test('test 1', () {
67 * document.body.nodes.add(new Element.html("<p>Test 1</p>"));
68 * });
69 * test('test 2', () {
70 * document.body.nodes.add(new Element.html("<p>Test 2</p>"));
71 * });
72 * });
73 * }
74 *
75 * And a sample matching .render file:
76 *
77 * [foo test 1]
78 * RenderBlock {P} at (0,0) size 284x20
79 * RenderText {#text} at (0,0) size 38x19
80 * text run at (0,0) width 38: "Test 1"
81 * [foo test 2]
82 * RenderBlock {P} at (0,0) size 284x20
83 * RenderText {#text} at (0,0) size 38x19
84 * text run at (0,0) width 38: "Test 2"
85 *
86 * Note that the render content is only the content inside the <body> element,
87 * not including the body element itself.
88 *
89 * Running testrunner with a `--generate-renders` flag will make it create
90 * .render files for you.
51 */ 91 */
52 92
53 /* TODO(gram) - Layout tests. The plan here will be to look for a file 93 // TODO - layout tests that use PNGs rather than DRT text render dumps.
54 * with a .layout extension that corresponds to the .dart file, that contains
55 * multiple layouts, one for each test. Each test will be run in its own
56 * instance of DRT and and the result compared with the expected layout.
57 */
58 #library('testrunner'); 94 #library('testrunner');
59 #import('dart:io'); 95 #import('dart:io');
60 #import('dart:isolate'); 96 #import('dart:isolate');
61 #import('dart:math'); 97 #import('dart:math');
62 #import('../../pkg/args/args.dart'); 98 #import('../../pkg/args/args.dart');
63 99
64 #source('configuration.dart'); 100 #source('configuration.dart');
65 #source('dart_task.dart'); 101 #source('dart_task.dart');
66 #source('dart_wrap_task.dart'); 102 #source('dart_wrap_task.dart');
67 #source('dart2js_task.dart'); 103 #source('dart2js_task.dart');
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 // Add step for wrapping in HTML, if we are running in DRT. 189 // Add step for wrapping in HTML, if we are running in DRT.
154 if (runtime != 'vm') { 190 if (runtime != 'vm') {
155 // The user can have pre-existing HTML and CSS files for the test in the 191 // The user can have pre-existing HTML and CSS files for the test in the
156 // same directory and using the same name. The paths to these are matched 192 // same directory and using the same name. The paths to these are matched
157 // by these two templates. 193 // by these two templates.
158 var HTMLFile = 194 var HTMLFile =
159 '${Macros.directory}$pathSep${Macros.filenameNoExtension}.html'; 195 '${Macros.directory}$pathSep${Macros.filenameNoExtension}.html';
160 var CSSFile = 196 var CSSFile =
161 '${Macros.directory}$pathSep${Macros.filenameNoExtension}.css'; 197 '${Macros.directory}$pathSep${Macros.filenameNoExtension}.css';
162 pipeline.add(new HtmlWrapTask(Macros.fullFilePath, 198 pipeline.add(new HtmlWrapTask(Macros.fullFilePath,
163 HTMLFile, tempHTMLFile, CSSFile, tempCSSFile)); 199 HTMLFile, tempHTMLFile, CSSFile, tempCSSFile));
164 } 200 }
165 201
166 // Add the execution step. 202 // Add the execution step.
167 if (runtime == 'vm') { 203 if (runtime == 'vm') {
168 if (checkedMode) { 204 if (checkedMode) {
169 pipeline.add(new DartTask.checked(tempDartFile)); 205 pipeline.add(new DartTask.checked(tempDartFile));
170 } else { 206 } else {
171 pipeline.add(new DartTask(tempDartFile)); 207 pipeline.add(new DartTask(tempDartFile));
172 } 208 }
173 } else { 209 } else {
174 pipeline.add(new DrtTask(tempHTMLFile)); 210 pipeline.add(new DrtTask(Macros.fullFilePath, tempHTMLFile));
175 } 211 }
176 return pipeline; 212 return pipeline;
177 } 213 }
178 214
179 /** 215 /**
180 * Given a [List] of [testFiles], either print the list or create 216 * Given a [List] of [testFiles], either print the list or create
181 * and execute pipelines for the files. 217 * and execute pipelines for the files.
182 */ 218 */
183 void processTests(List pipelineTemplate, List testFiles) { 219 void processTests(List pipelineTemplate, List testFiles) {
184 _outStream = getStream(config.outputStream); 220 _outStream = getStream(config.outputStream);
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 } 317 }
282 buildFileList(dirs, 318 buildFileList(dirs,
283 new RegExp(options['test-file-pattern']), options['recurse'], 319 new RegExp(options['test-file-pattern']), options['recurse'],
284 (f) => processTests(pipelineTemplate, f)); 320 (f) => processTests(pipelineTemplate, f));
285 } 321 }
286 } 322 }
287 } 323 }
288 } 324 }
289 325
290 326
OLDNEW
« no previous file with comments | « utils/testrunner/options.dart ('k') | utils/testrunner/utils.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698