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

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

Issue 12225109: Revert "Change the location of the output directory" plus one other fix. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 10 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
« no previous file with comments | « tools/test-runtime.dart ('k') | tools/testing/dart/http_server.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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,
9 Path dartJsScript,
8 String scriptType, 10 String scriptType,
9 Path sourceScript) => 11 Path sourceScript) =>
10 """ 12 """
11 <!DOCTYPE html> 13 <!DOCTYPE html>
12 <html> 14 <html>
13 <head> 15 <head>
14 <meta http-equiv="X-UA-Compatible" content="IE=edge"> 16 <meta http-equiv="X-UA-Compatible" content="IE=edge">
15 <title> Test $title </title> 17 <title> Test $title </title>
16 <style> 18 <style>
17 .unittest-table { font-family:monospace; border:1px; } 19 .unittest-table { font-family:monospace; border:1px; }
18 .unittest-pass { background: #6b3;} 20 .unittest-pass { background: #6b3;}
19 .unittest-fail { background: #d55;} 21 .unittest-fail { background: #d55;}
20 .unittest-error { background: #a11;} 22 .unittest-error { background: #a11;}
21 </style> 23 </style>
22 </head> 24 </head>
23 <body> 25 <body>
24 <h1> Running $title </h1> 26 <h1> Running $title </h1>
25 <script type="text/javascript" src="/pkg/unittest/lib/test_controller.js"> 27 <script type="text/javascript" src="$controllerScript"></script>
26 </script>
27 <script type="$scriptType" src="$sourceScript" onerror="externalError(null)"> 28 <script type="$scriptType" src="$sourceScript" onerror="externalError(null)">
28 </script> 29 </script>
29 <script type="text/javascript" src="/pkg/browser/lib/dart.js"></script> 30 <script type="text/javascript" src="$dartJsScript"></script>
30 </body> 31 </body>
31 </html> 32 </html>
32 """; 33 """;
33 34
34 String getHtmlLayoutContents(String scriptType, String sourceScript) => 35 String getHtmlLayoutContents(String scriptType, String sourceScript) =>
35 """ 36 """
36 <!DOCTYPE html> 37 <!DOCTYPE html>
37 <html> 38 <html>
38 <head> 39 <head>
39 <meta http-equiv="X-UA-Compatible" content="IE=edge"> 40 <meta http-equiv="X-UA-Compatible" content="IE=edge">
40 </head> 41 </head>
41 <body> 42 <body>
42 <script type="text/javascript"> 43 <script type="text/javascript">
43 if (navigator.webkitStartDart) navigator.webkitStartDart(); 44 if (navigator.webkitStartDart) navigator.webkitStartDart();
44 </script> 45 </script>
45 <script type="$scriptType" src="$sourceScript"></script> 46 <script type="$scriptType" src="$sourceScript"></script>
46 </body> 47 </body>
47 </html> 48 </html>
48 """; 49 """;
49 50
50 String wrapDartTestInLibrary(Path testRelativeToDart) => 51 String wrapDartTestInLibrary(Path test, String testPath) =>
51 """ 52 """
52 library libraryWrapper; 53 library libraryWrapper;
53 part '/$testRelativeToDart'; 54 part '${pathLib.relative(test.toNativePath(),
55 from: pathLib.dirname(testPath)).replaceAll('\\', '\\\\')}';
54 """; 56 """;
55 57
56 String dartTestWrapper(bool usePackageImport, String libraryPathComponent) { 58 String dartTestWrapper(Path dartHome, String testPath, Path library) {
59 var testPathDir = pathLib.dirname(testPath);
60 var dartHomePath = dartHome.toNativePath();
61 // TODO(efortuna): Unify path libraries used in test.dart.
62 var unitTest = pathLib.relative(pathLib.join(dartHomePath,
63 'pkg/unittest/lib'), from: testPathDir).replaceAll('\\', '\\\\');
64
65 var libString = library.toNativePath();
66 if (!pathLib.isAbsolute(libString)) {
67 libString = pathLib.join(dartHome.toNativePath(), libString);
68 }
57 // Tests inside "pkg" import unittest using "package:". All others use a 69 // Tests inside "pkg" import unittest using "package:". All others use a
58 // relative path. The imports need to agree, so use a matching form here. 70 // relative path. The imports need to agree, so use a matching form here.
59 var unitTest; 71 if (pathLib.split(pathLib.relative(libString,
60 if (usePackageImport) { 72 from: dartHome.toNativePath())).contains("pkg")) {
61 unitTest = 'package:unittest'; 73 unitTest = 'package:unittest';
62 } else {
63 unitTest = '/pkg/unittest/lib';
64 } 74 }
65 return """ 75 return """
66 library test; 76 library test;
67 77
68 import '$unitTest/unittest.dart' as unittest; 78 import '$unitTest/unittest.dart' as unittest;
69 import '$unitTest/html_config.dart' as config; 79 import '$unitTest/html_config.dart' as config;
70 import '$libraryPathComponent' as Test; 80 import '${pathLib.relative(libString, from: testPathDir).replaceAll(
81 '\\', '\\\\')}' as Test;
71 82
72 main() { 83 main() {
73 config.useHtmlConfiguration(); 84 config.useHtmlConfiguration();
74 unittest.group('', Test.main); 85 unittest.group('', Test.main);
75 } 86 }
76 """; 87 """;
77 } 88 }
OLDNEW
« no previous file with comments | « tools/test-runtime.dart ('k') | tools/testing/dart/http_server.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698