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

Side by Side Diff: tools/testing/dart/test_runner.dart

Issue 695893002: Working SimpleHTML test front end (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments. Created 6 years, 1 month 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
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 /** 5 /**
6 * Classes and methods for executing tests. 6 * Classes and methods for executing tests.
7 * 7 *
8 * This module includes: 8 * This module includes:
9 * - Managing parallel execution of tests, including timeout checks. 9 * - Managing parallel execution of tests, including timeout checks.
10 * - Evaluating the output of each test as pass/fail/crash/timeout. 10 * - Evaluating the output of each test as pass/fail/crash/timeout.
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 283
284 String get reproductionCommand { 284 String get reproductionCommand {
285 var parts = [TestUtils.dartTestExecutable.toString(), 285 var parts = [TestUtils.dartTestExecutable.toString(),
286 'tools/testing/dart/launch_browser.dart', 286 'tools/testing/dart/launch_browser.dart',
287 browser, 287 browser,
288 url]; 288 url];
289 return parts.map(escapeCommandLineArgument).join(' '); 289 return parts.map(escapeCommandLineArgument).join(' ');
290 } 290 }
291 } 291 }
292 292
293 class BrowserHtmlTestCommand extends BrowserTestCommand {
294 List<String> expectedMessages;
295 BrowserHtmlTestCommand._(String browser,
296 String url,
297 Map configuration,
298 this.expectedMessages)
299 : super._(browser, url, configuration);
300
301 void _buildHashCode(HashCodeBuilder builder) {
302 super._buildHashCode(builder);
303 builder.addJson(expectedMessages);
304 }
305
306 bool _equal(BrowserHtmlTestCommand other) =>
307 super._equal(other) &&
308 identical(expectedMessages, other.expectedMessages);
309 }
310
293 class AnalysisCommand extends ProcessCommand { 311 class AnalysisCommand extends ProcessCommand {
294 final String flavor; 312 final String flavor;
295 313
296 AnalysisCommand._(this.flavor, 314 AnalysisCommand._(this.flavor,
297 String displayName, 315 String displayName,
298 String executable, 316 String executable,
299 List<String> arguments, 317 List<String> arguments,
300 Map<String, String> environmentOverrides) 318 Map<String, String> environmentOverrides)
301 : super._(displayName, executable, arguments, environmentOverrides); 319 : super._(displayName, executable, arguments, environmentOverrides);
302 320
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
546 return _getUniqueCommand(command); 564 return _getUniqueCommand(command);
547 } 565 }
548 566
549 BrowserTestCommand getBrowserTestCommand(String browser, 567 BrowserTestCommand getBrowserTestCommand(String browser,
550 String url, 568 String url,
551 Map configuration) { 569 Map configuration) {
552 var command = new BrowserTestCommand._(browser, url, configuration); 570 var command = new BrowserTestCommand._(browser, url, configuration);
553 return _getUniqueCommand(command); 571 return _getUniqueCommand(command);
554 } 572 }
555 573
574 BrowserHtmlTestCommand getBrowserHtmlTestCommand(String browser,
575 String url,
576 Map configuration,
577 List<String> expectedMessages) {
578 var command = new BrowserHtmlTestCommand._(
579 browser, url, configuration, expectedMessages);
580 return _getUniqueCommand(command);
581 }
582
556 CompilationCommand getCompilationCommand(String displayName, 583 CompilationCommand getCompilationCommand(String displayName,
557 outputFile, 584 outputFile,
558 neverSkipCompilation, 585 neverSkipCompilation,
559 List<Uri> bootstrapDependencies, 586 List<Uri> bootstrapDependencies,
560 String executable, 587 String executable,
561 List<String> arguments, 588 List<String> arguments,
562 Map<String, String> environment) { 589 Map<String, String> environment) {
563 var command = 590 var command =
564 new CompilationCommand._( 591 new CompilationCommand._(
565 displayName, outputFile, neverSkipCompilation, 592 displayName, outputFile, neverSkipCompilation,
(...skipping 1773 matching lines...) Expand 10 before | Expand all | Expand 10 after
2339 _commandOutputStream.add(output); 2366 _commandOutputStream.add(output);
2340 if (output.canRunDependendCommands) { 2367 if (output.canRunDependendCommands) {
2341 graph.changeState(node, dgraph.NodeState.Successful); 2368 graph.changeState(node, dgraph.NodeState.Successful);
2342 } else { 2369 } else {
2343 graph.changeState(node, dgraph.NodeState.Failed); 2370 graph.changeState(node, dgraph.NodeState.Failed);
2344 } 2371 }
2345 2372
2346 _numProcesses--; 2373 _numProcesses--;
2347 if (isBrowserCommand) _numBrowserProcesses--; 2374 if (isBrowserCommand) _numBrowserProcesses--;
2348 2375
2349 // Don't loose a process 2376 // Don't lose a process
2350 Timer.run(() => _tryRunNextCommand()); 2377 Timer.run(() => _tryRunNextCommand());
2351 }); 2378 });
2352 } 2379 }
2353 } 2380 }
2354 2381
2355 void _checkDone() { 2382 void _checkDone() {
2356 if (!_finishing && 2383 if (!_finishing &&
2357 _runQueue.isEmpty && 2384 _runQueue.isEmpty &&
2358 _numProcesses == 0 && 2385 _numProcesses == 0 &&
2359 graph.isSealed && 2386 graph.isSealed &&
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
2492 } 2519 }
2493 2520
2494 Future<CommandOutput> _startBrowserControllerTest( 2521 Future<CommandOutput> _startBrowserControllerTest(
2495 BrowserTestCommand browserCommand, int timeout) { 2522 BrowserTestCommand browserCommand, int timeout) {
2496 var completer = new Completer<CommandOutput>(); 2523 var completer = new Completer<CommandOutput>();
2497 2524
2498 var callback = (BrowserTestOutput output) { 2525 var callback = (BrowserTestOutput output) {
2499 completer.complete( 2526 completer.complete(
2500 new BrowserControllerTestOutcome(browserCommand, output)); 2527 new BrowserControllerTestOutcome(browserCommand, output));
2501 }; 2528 };
2502 BrowserTest browserTest = new BrowserTest(browserCommand.url, 2529
2503 callback, 2530 BrowserTest browserTest;
2504 timeout); 2531 if (browserCommand is BrowserHtmlTestCommand) {
2532 browserTest = new HtmlTest(browserCommand.url, callback, timeout,
2533 browserCommand.expectedMessages);
2534 } else {
2535 browserTest = new BrowserTest(browserCommand.url, callback, timeout);
2536 }
2505 _getBrowserTestRunner(browserCommand.browser, browserCommand.configuration) 2537 _getBrowserTestRunner(browserCommand.browser, browserCommand.configuration)
2506 .then((testRunner) { 2538 .then((testRunner) {
2507 testRunner.queueTest(browserTest); 2539 testRunner.queueTest(browserTest);
2508 }); 2540 });
2509 2541
2510 return completer.future; 2542 return completer.future;
2511 } 2543 }
2512 2544
2513 Future<BrowserTestRunner> _getBrowserTestRunner(String browser, 2545 Future<BrowserTestRunner> _getBrowserTestRunner(String browser,
2514 Map configuration) { 2546 Map configuration) {
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after
2908 } 2940 }
2909 } 2941 }
2910 2942
2911 void eventAllTestsDone() { 2943 void eventAllTestsDone() {
2912 for (var listener in _eventListener) { 2944 for (var listener in _eventListener) {
2913 listener.allDone(); 2945 listener.allDone();
2914 } 2946 }
2915 _allDone(); 2947 _allDone();
2916 } 2948 }
2917 } 2949 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698