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

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

Issue 11586012: Call DumpRenderTree directly from test.dart instead of using the drt-trampoline.py indirection (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years 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 enumerating and preparing tests. 6 * Classes and methods for enumerating and preparing tests.
7 * 7 *
8 * This library includes: 8 * This library includes:
9 * 9 *
10 * - Creating tests by listing all the Dart files in certain directories, 10 * - Creating tests by listing all the Dart files in certain directories,
(...skipping 771 matching lines...) Expand 10 before | Expand all | Expand 10 after
782 * executed: a compilation step and an execution step, both with the 782 * executed: a compilation step and an execution step, both with the
783 * appropriate executable and arguments. The [expectations] object can be 783 * appropriate executable and arguments. The [expectations] object can be
784 * either a Set<String> if the test is a regular test, or a Map<String 784 * either a Set<String> if the test is a regular test, or a Map<String
785 * subTestName, Set<String>> if we are running a browser multi-test (one 785 * subTestName, Set<String>> if we are running a browser multi-test (one
786 * compilation and many browser runs). 786 * compilation and many browser runs).
787 */ 787 */
788 void enqueueBrowserTest(TestInformation info, 788 void enqueueBrowserTest(TestInformation info,
789 String testName, 789 String testName,
790 Object expectations, 790 Object expectations,
791 bool isWrappingRequired) { 791 bool isWrappingRequired) {
792 // TODO(kustermann/ricow): This method should be refactored.
792 Map optionsFromFile = info.optionsFromFile; 793 Map optionsFromFile = info.optionsFromFile;
793 Path filePath = info.filePath; 794 Path filePath = info.filePath;
794 String filename = filePath.toString(); 795 String filename = filePath.toString();
795 bool isWebTest = optionsFromFile['containsDomImport']; 796 bool isWebTest = optionsFromFile['containsDomImport'];
796 bool isLibraryDefinition = optionsFromFile['isLibraryDefinition']; 797 bool isLibraryDefinition = optionsFromFile['isLibraryDefinition'];
797 if (isWrappingRequired 798 if (isWrappingRequired
798 && !isLibraryDefinition && optionsFromFile['containsSourceOrImport']) { 799 && !isLibraryDefinition && optionsFromFile['containsSourceOrImport']) {
799 print('Warning for $filename: Browser tests require #library ' 800 print('Warning for $filename: Browser tests require #library '
800 'in any file that uses #import, #source, or #resource'); 801 'in any file that uses #import, #source, or #resource');
801 } 802 }
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
907 compiler, tempDir, vmOptions, optionsFromFile)); 908 compiler, tempDir, vmOptions, optionsFromFile));
908 } 909 }
909 } 910 }
910 911
911 // Variables for browser multi-tests. 912 // Variables for browser multi-tests.
912 List<String> subtestNames = info.optionsFromFile['subtestNames']; 913 List<String> subtestNames = info.optionsFromFile['subtestNames'];
913 TestCase multitestParentTest; 914 TestCase multitestParentTest;
914 int subtestIndex = 0; 915 int subtestIndex = 0;
915 // Construct the command that executes the browser test 916 // Construct the command that executes the browser test
916 do { 917 do {
918 List<Command> commandSet = new List<Command>.from(commands);
919 if (subtestIndex != 0) {
920 // NOTE: The first time we enter this loop, all the compilation
921 // commands will be executed. On subsequent loop iterations, we
922 // don't need to do any compilations. Thus we set "commandSet = []".
923 commandSet = [];
924 }
925
917 List<String> args = <String>[]; 926 List<String> args = <String>[];
918 String fullHtmlPath = htmlPath.startsWith('http:') ? htmlPath : 927 String fullHtmlPath = htmlPath.startsWith('http:') ? htmlPath :
919 (htmlPath.startsWith('/') ? 928 (htmlPath.startsWith('/') ?
920 'file://$htmlPath' : 929 'file://$htmlPath' :
921 'file:///$htmlPath'); 930 'file:///$htmlPath');
922 if (info.optionsFromFile['isMultiHtmlTest'] 931 if (info.optionsFromFile['isMultiHtmlTest']
923 && subtestNames.length > 0) { 932 && subtestNames.length > 0) {
924 fullHtmlPath = '${fullHtmlPath}#${subtestNames[subtestIndex]}'; 933 fullHtmlPath = '${fullHtmlPath}#${subtestNames[subtestIndex]}';
925 } 934 }
935
926 if (TestUtils.usesWebDriver(runtime)) { 936 if (TestUtils.usesWebDriver(runtime)) {
927 args = [ 937 args = [
928 dartDir.append('tools/testing/run_selenium.py').toNativePath(), 938 dartDir.append('tools/testing/run_selenium.py').toNativePath(),
929 '--browser=$runtime', 939 '--browser=$runtime',
930 '--timeout=${configuration["timeout"] - 2}', 940 '--timeout=${configuration["timeout"] - 2}',
931 '--out="$fullHtmlPath"']; 941 '--out="$fullHtmlPath"'];
932 if (runtime == 'dartium') { 942 if (runtime == 'dartium') {
933 args.add('--executable=$dartiumFilename'); 943 args.add('--executable=$dartiumFilename');
934 } 944 }
945 if (subtestIndex != 0) {
946 args.add('--force-refresh');
947 }
948 commandSet.add(new Command('python', args));
935 } else { 949 } else {
936 args = [ 950 Expect.isTrue(runtime == "drt");
937 dartDir.append('tools/testing/drt-trampoline.py').toNativePath(), 951
938 dumpRenderTreeFilename, 952 var dartFlags = [];
939 '--no-timeout' 953 var dumpRenderTreeOptions = [];
940 ]; 954 var packageRootUri;
941 if (compiler == 'none') { 955
942 String packageRoot = 956 dumpRenderTreeOptions.add('--no-timeout');
943 packageRootArgument(optionsFromFile['packageRoot']); 957
944 if (packageRoot != null) { 958 if (compiler == 'none' || compiler == 'dart2dart') {
945 args.add(packageRoot); 959 dartFlags.add('--ignore-unrecognized-flags');
946 }
947 }
948 if (runtime == 'drt' &&
949 (compiler == 'none' || compiler == 'dart2dart')) {
950 var dartFlags = ['--ignore-unrecognized-flags'];
951 if (configuration["checked"]) { 960 if (configuration["checked"]) {
952 dartFlags.add('--enable_asserts'); 961 dartFlags.add('--enable_asserts');
953 dartFlags.add("--enable_type_checks"); 962 dartFlags.add("--enable_type_checks");
954 } 963 }
955 dartFlags.addAll(vmOptions); 964 dartFlags.addAll(vmOptions);
956 args.add('--dart-flags=${Strings.join(dartFlags, " ")}');
957 } 965 }
958 args.add(fullHtmlPath); 966 if (compiler == 'none') {
967 var packageRoot = packageRootArgument(
968 optionsFromFile['packageRoot']);
969 if (packageRoot != null) {
970 var absolutePath = TestUtils.absolutePath(new Path(packageRoot));
971 packageRootUri = new Uri.fromComponents(
972 scheme: 'file',
973 path: absolutePath.toString());
974 }
975 }
976
959 if (expectedOutput != null) { 977 if (expectedOutput != null) {
960 args.add('--out-expectation=${expectedOutput.toNativePath()}'); 978 if (expectedOutput.toNativePath().endsWith('.png')) {
979 // pixel tests are specified by running DRT "foo.html'-p"
980 dumpRenderTreeOptions.add('--notree');
981 fullHtmlPath = "${fullHtmlPath}'-p";
982 }
961 } 983 }
984 commandSet.add(new DumpRenderTreeCommand(dumpRenderTreeFilename,
985 fullHtmlPath,
986 dumpRenderTreeOptions,
987 dartFlags,
988 packageRootUri,
989 expectedOutput));
962 } 990 }
963 List<Command> commandSet = new List<Command>.from(commands);
964 if (subtestIndex != 0) {
965 commandSet = [];
966 if(TestUtils.usesWebDriver(runtime)) args.add('--force-refresh');
967 }
968 commandSet.add(new Command('python', args));
969 991
970 // Create BrowserTestCase and queue it. 992 // Create BrowserTestCase and queue it.
971 String testDisplayName = '$suiteName/$testName'; 993 String testDisplayName = '$suiteName/$testName';
972 var testCase; 994 var testCase;
973 if (info.optionsFromFile['isMultiHtmlTest']) { 995 if (info.optionsFromFile['isMultiHtmlTest']) {
974 testDisplayName = '$testDisplayName/${subtestNames[subtestIndex]}'; 996 testDisplayName = '$testDisplayName/${subtestNames[subtestIndex]}';
975 testCase = new BrowserTestCase(testDisplayName, 997 testCase = new BrowserTestCase(testDisplayName,
976 commandSet, configuration, completeHandler, 998 commandSet, configuration, completeHandler,
977 expectations['$testName/${subtestNames[subtestIndex]}'], 999 expectations['$testName/${subtestNames[subtestIndex]}'],
978 info, info.hasCompileError || info.hasRuntimeError, 1000 info, info.hasCompileError || info.hasRuntimeError,
(...skipping 777 matching lines...) Expand 10 before | Expand all | Expand 10 after
1756 * $pass tests are expected to pass 1778 * $pass tests are expected to pass
1757 * $failOk tests are expected to fail that we won't fix 1779 * $failOk tests are expected to fail that we won't fix
1758 * $fail tests are expected to fail that we should fix 1780 * $fail tests are expected to fail that we should fix
1759 * $crash tests are expected to crash that we should fix 1781 * $crash tests are expected to crash that we should fix
1760 * $timeout tests are allowed to timeout 1782 * $timeout tests are allowed to timeout
1761 * $compileErrorSkip tests are skipped on browsers due to compile-time error 1783 * $compileErrorSkip tests are skipped on browsers due to compile-time error
1762 """; 1784 """;
1763 print(report); 1785 print(report);
1764 } 1786 }
1765 } 1787 }
OLDNEW
« tools/testing/dart/test_runner.dart ('K') | « tools/testing/dart/test_runner.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698