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

Side by Side Diff: tools/testing/dart/browser_test.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) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 part of test_suite; 5 part of test_suite;
6 6
7 String getHtmlContents(String title, 7 String getHtmlContents(String title,
8 Path controllerScript, 8 Path controllerScript,
9 Path dartJsScript, 9 Path dartJsScript,
10 String scriptType, 10 String scriptType,
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 </body> 47 </body>
48 </html> 48 </html>
49 """; 49 """;
50 50
51 String wrapDartTestInLibrary(Path test) => 51 String wrapDartTestInLibrary(Path test) =>
52 """ 52 """
53 library libraryWrapper; 53 library libraryWrapper;
54 part '$test'; 54 part '$test';
55 """; 55 """;
56 56
57 String dartTestWrapper(Path dartHome, Path library) { 57 String dartTestWrapper(Path dartHome, String testPath, Path library) {
58 var testPathDir = pathLib.dirname(testPath);
Mads Ager (google) 2013/01/07 07:15:52 Can you pass in a Path here, please? I don't like
Emily Fortuna 2013/01/07 18:01:32 Unfortunately the relativeTo method in the main Pa
59 var dartHomePath = dartHome.toString();
60 var unitTest = pathLib.relative(pathLib.join(dartHomePath,
61 'pkg/unittest/lib'), from: testPathDir);
62
63 var libString = library.toString();
64 if (!pathLib.isAbsolute(libString)) {
65 libString = pathLib.join(dartHome.toString(), libString);
66 }
58 // Tests inside "pkg" import unittest using "package:". All others use a 67 // Tests inside "pkg" import unittest using "package:". All others use a
59 // relative path. The imports need to agree, so use a matching form here. 68 // relative path. The imports need to agree, so use a matching form here.
60 var unitTest = dartHome.append("pkg/unittest/lib").toString(); 69 if (pathLib.relative(libString, from: dartHome.toString()).contains("pkg")) {
61
62 // TODO(rnystrom): Looking in the entire path here is wrong. It should only
63 // consider the relative path within dartHome. Unfortunately,
64 // Path.relativeTo() does not handle cases where library is already a relative
65 // path, and Path.isAbsolute does not work on Windows.
66 if (library.segments().contains("pkg")) {
67 unitTest = 'package:unittest'; 70 unitTest = 'package:unittest';
68 } 71 }
69
70 return """ 72 return """
71 library test; 73 library test;
72 74
73 import '$unitTest/unittest.dart' as unittest; 75 import '$unitTest/unittest.dart' as unittest;
74 import '$unitTest/html_config.dart' as config; 76 import '$unitTest/html_config.dart' as config;
75 import '${library}' as Test; 77 import '${pathLib.relative(libString, from: testPathDir)}' as Test;
76 78
77 main() { 79 main() {
78 config.useHtmlConfiguration(); 80 config.useHtmlConfiguration();
79 unittest.group('', Test.main); 81 unittest.group('', Test.main);
80 } 82 }
81 """; 83 """;
82 } 84 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698