OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 library polymer.test.build.common; | 5 library polymer.test.build.common; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 | 8 |
9 import 'package:barback/barback.dart'; | 9 import 'package:barback/barback.dart'; |
10 import 'package:stack_trace/stack_trace.dart'; | 10 import 'package:stack_trace/stack_trace.dart'; |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 | 130 |
131 // Include mock versions of the polymer library that can be used to test | 131 // Include mock versions of the polymer library that can be used to test |
132 // resolver-based code generation. | 132 // resolver-based code generation. |
133 POLYMER_MOCKS.forEach((file, contents) { inputFiles[file] = contents; }); | 133 POLYMER_MOCKS.forEach((file, contents) { inputFiles[file] = contents; }); |
134 (solo ? solo_test : test)(testName, () { | 134 (solo ? solo_test : test)(testName, () { |
135 var helper = new TestHelper(phases, inputFiles, expectedMessages)..run(); | 135 var helper = new TestHelper(phases, inputFiles, expectedMessages)..run(); |
136 return helper.checkAll(expectedFiles).whenComplete(() => helper.tearDown()); | 136 return helper.checkAll(expectedFiles).whenComplete(() => helper.tearDown()); |
137 }); | 137 }); |
138 } | 138 } |
139 | 139 |
| 140 solo_testPhases(String testName, List<List<Transformer>> phases, |
| 141 Map<String, String> inputFiles, Map<String, String> expectedFiles, |
| 142 [List<String> expectedMessages]) => |
| 143 testPhases(testName, phases, inputFiles, expectedFiles, expectedMessages, |
| 144 true); |
| 145 |
| 146 /// Generate an expected ._data file, where all files are assumed to be in the |
| 147 /// same [package]. |
| 148 String expectedData(List<String> urls, {package: 'a', experimental: false}) { |
| 149 var ids = urls.map((e) => '["$package","$e"]').join(','); |
| 150 return '{"experimental_bootstrap":$experimental,"script_ids":[$ids]}'; |
| 151 } |
| 152 |
| 153 const EMPTY_DATA = '{"experimental_bootstrap":false,"script_ids":[]}'; |
| 154 |
140 const WEB_COMPONENTS_TAG = | 155 const WEB_COMPONENTS_TAG = |
141 '<script src="packages/web_components/platform.js"></script>\n' | 156 '<script src="packages/web_components/platform.js"></script>\n' |
142 '<script src="packages/web_components/dart_support.js"></script>\n'; | 157 '<script src="packages/web_components/dart_support.js"></script>\n'; |
143 | 158 |
| 159 const INTEROP_TAG = '<script src="packages/browser/interop.js"></script>\n'; |
144 const DART_JS_TAG = '<script src="packages/browser/dart.js"></script>'; | 160 const DART_JS_TAG = '<script src="packages/browser/dart.js"></script>'; |
145 | 161 |
146 const POLYMER_MOCKS = const { | 162 const POLYMER_MOCKS = const { |
147 'polymer|lib/polymer.html': '<!DOCTYPE html><html></html>', | 163 'polymer|lib/polymer.html': '<!DOCTYPE html><html>', |
| 164 'polymer|lib/polymer_experimental.html': '<!DOCTYPE html><html>', |
148 'polymer|lib/polymer.dart': | 165 'polymer|lib/polymer.dart': |
149 'library polymer;\n' | 166 'library polymer;\n' |
150 'import "dart:html";\n' | 167 'import "dart:html";\n' |
151 'export "package:observe/observe.dart";\n' // for @observable | 168 'export "package:observe/observe.dart";\n' // for @observable |
152 'part "src/loader.dart";\n' // for @CustomTag and @initMethod | 169 'part "src/loader.dart";\n' // for @CustomTag and @initMethod |
153 'part "src/instance.dart";\n', // for @published and @ObserveProperty | 170 'part "src/instance.dart";\n', // for @published and @ObserveProperty |
154 | 171 |
155 'polymer|lib/src/loader.dart': | 172 'polymer|lib/src/loader.dart': |
156 'part of polymer;\n' | 173 'part of polymer;\n' |
157 'class CustomTag {\n' | 174 'class CustomTag {\n' |
(...skipping 18 matching lines...) Expand all Loading... |
176 | 193 |
177 'observe|lib/observe.dart': | 194 'observe|lib/observe.dart': |
178 'library observe;\n' | 195 'library observe;\n' |
179 'export "src/metadata.dart";', | 196 'export "src/metadata.dart";', |
180 | 197 |
181 'observe|lib/src/metadata.dart': | 198 'observe|lib/src/metadata.dart': |
182 'library observe.src.metadata;\n' | 199 'library observe.src.metadata;\n' |
183 'class ObservableProperty { const ObservableProperty(); }\n' | 200 'class ObservableProperty { const ObservableProperty(); }\n' |
184 'const observable = const ObservableProperty();\n', | 201 'const observable = const ObservableProperty();\n', |
185 }; | 202 }; |
OLD | NEW |