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

Unified Diff: tools/testing/dart/test_progress.dart

Issue 2901923003: Replace the configuration map with a typed object. (Closed)
Patch Set: Revise. Created 3 years, 7 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 | « tools/testing/dart/test_configurations.dart ('k') | tools/testing/dart/test_runner.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/testing/dart/test_progress.dart
diff --git a/tools/testing/dart/test_progress.dart b/tools/testing/dart/test_progress.dart
index 74724d2e0cceaf025dd5aa697297e1e390917d89..133173ba8e17352ebd21f1ee70a38be663d858a0 100644
--- a/tools/testing/dart/test_progress.dart
+++ b/tools/testing/dart/test_progress.dart
@@ -2,18 +2,16 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-library test_progress;
+import 'dart:convert' show JSON;
+import 'dart:io';
-import "dart:convert" show JSON;
-import "dart:io";
-
-import "expectation.dart";
-import "http_server.dart";
-import "path.dart";
-import "summary_report.dart";
-import "test_runner.dart";
-import "test_suite.dart";
-import "utils.dart";
+import 'configuration.dart';
+import 'expectation.dart';
+import 'path.dart';
+import 'summary_report.dart';
+import 'test_runner.dart';
+import 'test_suite.dart';
+import 'utils.dart';
/// Controls how message strings are processed before being displayed.
class Formatter {
@@ -136,31 +134,26 @@ class TestOutcomeLogWriter extends EventListener {
* }
* },
*/
-
- static final INTERESTED_CONFIGURATION_PARAMETERS = [
- 'mode',
- 'arch',
- 'compiler',
- 'runtime',
- 'checked',
- 'strong',
- 'host_checked',
- 'minified',
- 'csp',
- 'system',
- 'vm_options',
- 'use_sdk',
- 'builder_tag'
- ];
-
IOSink _sink;
void done(TestCase test) {
var name = test.displayName;
- var configuration = {};
- for (var key in INTERESTED_CONFIGURATION_PARAMETERS) {
- configuration[key] = test.configuration[key];
- }
+ var configuration = {
+ 'mode': test.configuration.mode.name,
+ 'arch': test.configuration.architecture.name,
+ 'compiler': test.configuration.compiler.name,
+ 'runtime': test.configuration.runtime.name,
+ 'checked': test.configuration.isChecked,
+ 'strong': test.configuration.isStrong,
+ 'host_checked': test.configuration.isHostChecked,
+ 'minified': test.configuration.isMinified,
+ 'csp': test.configuration.isCsp,
+ 'system': test.configuration.system.name,
+ 'vm_options': test.configuration.vmOptions,
+ 'use_sdk': test.configuration.useSdk,
+ 'builder_tag': test.configuration.builderTag
+ };
+
var outcome = '${test.lastCommandOutput.result(test)}';
var expectations =
test.expectedOutcomes.map((expectation) => "$expectation").toList();
@@ -225,8 +218,8 @@ class UnexpectedCrashLogger extends EventListener {
var binFile = new File(binName);
var binBaseName = new Path(binName).filename;
if (!archivedBinaries.containsKey(binName) && binFile.existsSync()) {
- var mode = test.configuration['mode'] as String;
- var arch = test.configuration['arch'] as String;
+ var mode = test.configuration.mode.name;
+ var arch = test.configuration.architecture.name;
var archived = "binary.${mode}_${arch}_${binBaseName}";
TestUtils.copyFile(new Path(binName), new Path(archived));
archivedBinaries[binName] = archived;
@@ -441,22 +434,22 @@ class TestFailurePrinter extends EventListener {
class ProgressIndicator extends EventListener {
ProgressIndicator(this._startTime);
- static EventListener fromName(
- String name, DateTime startTime, Formatter formatter) {
- switch (name) {
- case 'compact':
+ static EventListener fromProgress(
+ Progress progress, DateTime startTime, Formatter formatter) {
+ switch (progress) {
+ case Progress.compact:
return new CompactProgressIndicator(startTime, formatter);
- case 'line':
+ case Progress.line:
return new LineProgressIndicator();
- case 'verbose':
+ case Progress.verbose:
return new VerboseProgressIndicator(startTime);
- case 'status':
+ case Progress.status:
return new ProgressIndicator(startTime);
- case 'buildbot':
+ case Progress.buildbot:
return new BuildbotProgressIndicator(startTime);
- default:
- throw new ArgumentError('Unknown progress indicator "$name".');
}
+
+ throw "unreachable";
}
void testAdded() {
@@ -612,7 +605,7 @@ List<String> _buildFailureOutput(TestCase test,
if (test.hasRuntimeError) {
output.add('Runtime error expected.');
}
- if ((test.configuration['checked'] as bool) && test.isNegativeIfChecked) {
+ if (test.configuration.isChecked && test.isNegativeIfChecked) {
output.add('Dynamic type error expected.');
}
}
@@ -645,8 +638,7 @@ List<String> _buildFailureOutput(TestCase test,
if (test is BrowserTestCase) {
// Additional command for rerunning the steps locally after the fact.
- var command = (test.configuration["_servers_"] as TestingServers)
- .httpServerCommandLine();
+ var command = test.configuration.servers.httpServerCommandLine();
output.add('');
output.add('To retest, run: $command');
}
@@ -664,8 +656,7 @@ List<String> _buildFailureOutput(TestCase test,
}
var arguments = ['python', 'tools/test.py'];
- arguments
- .addAll(test.configuration['_reproducing_arguments_'] as List<String>);
+ arguments.addAll(test.configuration.reproducingArguments);
arguments.add(test.displayName);
var testPyCommandline = arguments.map(escapeCommandLineArgument).join(' ');
« no previous file with comments | « tools/testing/dart/test_configurations.dart ('k') | tools/testing/dart/test_runner.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698