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

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

Issue 11641005: Add cross-origin test with credentials. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 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
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 686 matching lines...) Expand 10 before | Expand all | Expand 10 after
697 } 697 }
698 } 698 }
699 699
700 List<Command> makeCommands(TestInformation info, var vmOptions, var args) { 700 List<Command> makeCommands(TestInformation info, var vmOptions, var args) {
701 switch (configuration['compiler']) { 701 switch (configuration['compiler']) {
702 case 'dart2js': 702 case 'dart2js':
703 args = new List.from(args); 703 args = new List.from(args);
704 String tempDir = createOutputDirectory(info.filePath, ''); 704 String tempDir = createOutputDirectory(info.filePath, '');
705 args.add('--out=$tempDir/out.js'); 705 args.add('--out=$tempDir/out.js');
706 706
707 List<Command> commands = 707 List<Command> commands =
708 <Command>[new CompilationCommand("$tempDir/out.js", 708 <Command>[new CompilationCommand("$tempDir/out.js",
709 !useDart2JsFromSdk, 709 !useDart2JsFromSdk,
710 dart2JsBootstrapDependencies, 710 dart2JsBootstrapDependencies,
711 compilerPath, 711 compilerPath,
712 args)]; 712 args)];
713 if (info.hasCompileError) { 713 if (info.hasCompileError) {
714 // Do not attempt to run the compiled result. A compilation 714 // Do not attempt to run the compiled result. A compilation
715 // error should be reported by the compilation command. 715 // error should be reported by the compilation command.
716 } else if (configuration['runtime'] == 'd8') { 716 } else if (configuration['runtime'] == 'd8') {
717 commands.add(new Command(d8FileName, ['$tempDir/out.js'])); 717 commands.add(new Command(d8FileName, ['$tempDir/out.js']));
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
855 String htmlFilename = getHtmlName(filename); 855 String htmlFilename = getHtmlName(filename);
856 while ('$tempDir/../$htmlFilename'.length >= 260) { 856 while ('$tempDir/../$htmlFilename'.length >= 260) {
857 htmlFilename = htmlFilename.substring(htmlFilename.length~/2); 857 htmlFilename = htmlFilename.substring(htmlFilename.length~/2);
858 } 858 }
859 htmlPath = '$tempDir/../$htmlFilename'; 859 htmlPath = '$tempDir/../$htmlFilename';
860 } 860 }
861 final String scriptPath = (compiler == 'none') ? 861 final String scriptPath = (compiler == 'none') ?
862 dartWrapperFilename : compiledDartWrapperFilename; 862 dartWrapperFilename : compiledDartWrapperFilename;
863 // Create the HTML file for the test. 863 // Create the HTML file for the test.
864 RandomAccessFile htmlTest = new File(htmlPath).openSync(FileMode.WRITE); 864 RandomAccessFile htmlTest = new File(htmlPath).openSync(FileMode.WRITE);
865 String filePrefix = ''; 865 String filePrefix = '';
Mads Ager (google) 2013/01/02 10:09:50 Looks like filePrefix can be completely removed?
Emily Fortuna 2013/01/04 00:51:03 Done.
866 if (Platform.operatingSystem == 'windows') {
867 // Firefox on Windows does not like absolute file path names that start
868 // with 'C:' adding 'file:///' solves the problem.
869 filePrefix = 'file:///';
870 }
871 String content = null; 866 String content = null;
872 Path dir = filePath.directoryPath; 867 Path dir = filePath.directoryPath;
873 String nameNoExt = filePath.filenameWithoutExtension; 868 String nameNoExt = filePath.filenameWithoutExtension;
874 Path pngPath = dir.append('$nameNoExt.png'); 869 Path pngPath = dir.append('$nameNoExt.png');
875 Path txtPath = dir.append('$nameNoExt.txt'); 870 Path txtPath = dir.append('$nameNoExt.txt');
876 Path expectedOutput = null; 871 Path expectedOutput = null;
877 if (new File.fromPath(pngPath).existsSync()) { 872 if (new File.fromPath(pngPath).existsSync()) {
878 expectedOutput = pngPath; 873 expectedOutput = pngPath;
879 content = getHtmlLayoutContents(scriptType, '$filePrefix$scriptPath'); 874 content = getHtmlLayoutContents(scriptType, '$filePrefix$scriptPath');
880 } else if (new File.fromPath(txtPath).existsSync()) { 875 } else if (new File.fromPath(txtPath).existsSync()) {
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
915 } 910 }
916 911
917 // Variables for browser multi-tests. 912 // Variables for browser multi-tests.
918 List<String> subtestNames = info.optionsFromFile['subtestNames']; 913 List<String> subtestNames = info.optionsFromFile['subtestNames'];
919 TestCase multitestParentTest; 914 TestCase multitestParentTest;
920 int subtestIndex = 0; 915 int subtestIndex = 0;
921 // Construct the command that executes the browser test 916 // Construct the command that executes the browser test
922 do { 917 do {
923 List<Command> commandSet = new List<Command>.from(commands); 918 List<Command> commandSet = new List<Command>.from(commands);
924 if (subtestIndex != 0) { 919 if (subtestIndex != 0) {
925 // NOTE: The first time we enter this loop, all the compilation 920 // NOTE: The first time we enter this loop, all the compilation
926 // commands will be executed. On subsequent loop iterations, we 921 // commands will be executed. On subsequent loop iterations, we
927 // don't need to do any compilations. Thus we set "commandSet = []". 922 // don't need to do any compilations. Thus we set "commandSet = []".
928 commandSet = []; 923 commandSet = [];
929 } 924 }
930 925
931 List<String> args = <String>[]; 926 List<String> args = <String>[];
927 var basePath = TestUtils.dartDir().toString();
928 htmlPath = htmlPath.startsWith(basePath) ?
929 htmlPath.substring(basePath.length) : htmlPath;
932 String fullHtmlPath = htmlPath.startsWith('http:') ? htmlPath : 930 String fullHtmlPath = htmlPath.startsWith('http:') ? htmlPath :
933 (htmlPath.startsWith('/') ? 931 (htmlPath.startsWith('/') ?
934 'file://$htmlPath' : 932 'http://127.0.0.1:${SERVER_PORT_ONE}$htmlPath' :
Mads Ager (google) 2013/01/02 10:09:50 Do we now load all browser tests from the test ser
Emily Fortuna 2013/01/04 00:51:03 Done.
935 'file:///$htmlPath'); 933 'http://127.0.0.1:${SERVER_PORT_ONE}/$htmlPath');
936 if (info.optionsFromFile['isMultiHtmlTest'] 934 if (info.optionsFromFile['isMultiHtmlTest']
937 && subtestNames.length > 0) { 935 && subtestNames.length > 0) {
938 fullHtmlPath = '${fullHtmlPath}#${subtestNames[subtestIndex]}'; 936 fullHtmlPath = '${fullHtmlPath}#${subtestNames[subtestIndex]}';
939 } 937 }
940 938
941 if (TestUtils.usesWebDriver(runtime)) { 939 if (TestUtils.usesWebDriver(runtime)) {
942 args = [ 940 args = [
943 dartDir.append('tools/testing/run_selenium.py').toNativePath(), 941 dartDir.append('tools/testing/run_selenium.py').toNativePath(),
944 '--browser=$runtime', 942 '--browser=$runtime',
945 '--timeout=${configuration["timeout"] - 2}', 943 '--timeout=${configuration["timeout"] - 2}',
(...skipping 18 matching lines...) Expand all
964 dartFlags.add('--ignore-unrecognized-flags'); 962 dartFlags.add('--ignore-unrecognized-flags');
965 if (configuration["checked"]) { 963 if (configuration["checked"]) {
966 dartFlags.add('--enable_asserts'); 964 dartFlags.add('--enable_asserts');
967 dartFlags.add("--enable_type_checks"); 965 dartFlags.add("--enable_type_checks");
968 } 966 }
969 dartFlags.addAll(vmOptions); 967 dartFlags.addAll(vmOptions);
970 } 968 }
971 if (compiler == 'none') { 969 if (compiler == 'none') {
972 var packageRootPath = packageRoot(optionsFromFile['packageRoot']); 970 var packageRootPath = packageRoot(optionsFromFile['packageRoot']);
973 if (packageRootPath != null) { 971 if (packageRootPath != null) {
974 var absolutePath = 972 var absolutePath =
975 TestUtils.absolutePath(new Path(packageRootPath)); 973 TestUtils.absolutePath(new Path(packageRootPath));
976 packageRootUri = new Uri.fromComponents( 974 packageRootUri = new Uri.fromComponents(
977 scheme: 'file', 975 scheme: 'file',
978 path: absolutePath.toString()); 976 path: absolutePath.toString());
979 } 977 }
980 } 978 }
981 979
982 if (expectedOutput != null) { 980 if (expectedOutput != null) {
983 if (expectedOutput.toNativePath().endsWith('.png')) { 981 if (expectedOutput.toNativePath().endsWith('.png')) {
984 // pixel tests are specified by running DRT "foo.html'-p" 982 // pixel tests are specified by running DRT "foo.html'-p"
(...skipping 808 matching lines...) Expand 10 before | Expand all | Expand 10 after
1793 * $pass tests are expected to pass 1791 * $pass tests are expected to pass
1794 * $failOk tests are expected to fail that we won't fix 1792 * $failOk tests are expected to fail that we won't fix
1795 * $fail tests are expected to fail that we should fix 1793 * $fail tests are expected to fail that we should fix
1796 * $crash tests are expected to crash that we should fix 1794 * $crash tests are expected to crash that we should fix
1797 * $timeout tests are allowed to timeout 1795 * $timeout tests are allowed to timeout
1798 * $compileErrorSkip tests are skipped on browsers due to compile-time error 1796 * $compileErrorSkip tests are skipped on browsers due to compile-time error
1799 """; 1797 """;
1800 print(report); 1798 print(report);
1801 } 1799 }
1802 } 1800 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698