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

Unified 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, 12 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
Index: tools/testing/dart/test_suite.dart
diff --git a/tools/testing/dart/test_suite.dart b/tools/testing/dart/test_suite.dart
index 4d0447275815800715b575d2e178214739be9c54..2302b2c7ab1b01f4b70569101014371f29f9abdb 100644
--- a/tools/testing/dart/test_suite.dart
+++ b/tools/testing/dart/test_suite.dart
@@ -384,11 +384,17 @@ class StandardTestSuite extends TestSuite {
final Path dartDir;
Predicate<String> isTestFilePredicate;
final bool listRecursively;
+ /**
+ * The set of servers that have been started to run these tests (Could be
+ * none).
+ */
+ List serverList;
StandardTestSuite(Map configuration,
String suiteName,
Path suiteDirectory,
this.statusFilePaths,
+ this.serverList,
{this.isTestFilePredicate,
bool recursive: false})
: super(configuration, suiteName),
@@ -422,14 +428,18 @@ class StandardTestSuite extends TestSuite {
* instead of having to create a custom [StandardTestSuite] subclass. In
* particular, if you add 'path/to/mytestsuite' to [TEST_SUITE_DIRECTORIES]
* in test.dart, this will all be set up for you.
+ *
+ * The [StandardTestSuite] also optionally takes a list of servers that have
+ * been started up by the test harness, to be used by browser tests.
*/
factory StandardTestSuite.forDirectory(
- Map configuration, Path directory) {
+ Map configuration, Path directory, [List serverList=const []]) {
Mads Ager (google) 2013/01/04 09:39:20 Could you add spacing around '=': [List serverList
Emily Fortuna 2013/01/04 23:26:54 Done.
final name = directory.filename;
return new StandardTestSuite(configuration,
name, directory,
['$directory/$name.status', '$directory/${name}_dart2js.status'],
+ serverList,
isTestFilePredicate: (filename) => filename.endsWith('_test.dart'),
recursive: true);
}
@@ -704,7 +714,7 @@ class StandardTestSuite extends TestSuite {
String tempDir = createOutputDirectory(info.filePath, '');
args.add('--out=$tempDir/out.js');
- List<Command> commands =
+ List<Command> commands =
<Command>[new CompilationCommand("$tempDir/out.js",
!useDart2JsFromSdk,
dart2JsBootstrapDependencies,
@@ -862,12 +872,6 @@ class StandardTestSuite extends TestSuite {
dartWrapperFilename : compiledDartWrapperFilename;
// Create the HTML file for the test.
RandomAccessFile htmlTest = new File(htmlPath).openSync(FileMode.WRITE);
- String filePrefix = '';
- if (Platform.operatingSystem == 'windows') {
- // Firefox on Windows does not like absolute file path names that start
- // with 'C:' adding 'file:///' solves the problem.
- filePrefix = 'file:///';
- }
String content = null;
Path dir = filePath.directoryPath;
String nameNoExt = filePath.filenameWithoutExtension;
@@ -876,10 +880,10 @@ class StandardTestSuite extends TestSuite {
Path expectedOutput = null;
if (new File.fromPath(pngPath).existsSync()) {
expectedOutput = pngPath;
- content = getHtmlLayoutContents(scriptType, '$filePrefix$scriptPath');
+ content = getHtmlLayoutContents(scriptType, '$scriptPath');
} else if (new File.fromPath(txtPath).existsSync()) {
expectedOutput = txtPath;
- content = getHtmlLayoutContents(scriptType, '$filePrefix$scriptPath');
+ content = getHtmlLayoutContents(scriptType, '$scriptPath');
} else {
final htmlLocation = new Path.fromNative(htmlPath);
content = getHtmlContents(
@@ -922,17 +926,22 @@ class StandardTestSuite extends TestSuite {
do {
List<Command> commandSet = new List<Command>.from(commands);
if (subtestIndex != 0) {
- // NOTE: The first time we enter this loop, all the compilation
- // commands will be executed. On subsequent loop iterations, we
+ // NOTE: The first time we enter this loop, all the compilation
+ // commands will be executed. On subsequent loop iterations, we
// don't need to do any compilations. Thus we set "commandSet = []".
commandSet = [];
}
List<String> args = <String>[];
- String fullHtmlPath = htmlPath.startsWith('http:') ? htmlPath :
- (htmlPath.startsWith('/') ?
- 'file://$htmlPath' :
- 'file:///$htmlPath');
+ var basePath = TestUtils.dartDir().toString();
+ htmlPath = htmlPath.startsWith(basePath) ?
+ htmlPath.substring(basePath.length) : htmlPath;
+ String fullHtmlPath = htmlPath;
+ if (!htmlPath.startsWith('http')) {
+ if (htmlPath.startsWith('/')) htmlPath = '/$htmlPath';
Mads Ager (google) 2013/01/04 09:39:20 Shouldn't this be if (!htmlPath.startsWith('/'))
Emily Fortuna 2013/01/04 23:26:54 Oops, yes. Refactoring fail. Fixed.
+ fullHtmlPath = 'http://127.0.0.1:${serverList[0].port}$htmlPath?'
+ 'crossOriginPort=${serverList[1].port}';
+ }
if (info.optionsFromFile['isMultiHtmlTest']
&& subtestNames.length > 0) {
fullHtmlPath = '${fullHtmlPath}#${subtestNames[subtestIndex]}';
@@ -971,7 +980,7 @@ class StandardTestSuite extends TestSuite {
if (compiler == 'none') {
var packageRootPath = packageRoot(optionsFromFile['packageRoot']);
if (packageRootPath != null) {
- var absolutePath =
+ var absolutePath =
TestUtils.absolutePath(new Path(packageRootPath));
packageRootUri = new Uri.fromComponents(
scheme: 'file',

Powered by Google App Engine
This is Rietveld 408576698