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

Unified Diff: pkg/polymer/test/build/code_extractor.dart

Issue 293023008: Bring back initPolymer, allow boot.js only if using "polymer_experimental.html". (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 7 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
« no previous file with comments | « pkg/polymer/test/build/all_phases_test.dart ('k') | pkg/polymer/test/build/common.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/polymer/test/build/code_extractor.dart
diff --git a/pkg/polymer/test/build/code_extractor.dart b/pkg/polymer/test/build/code_extractor.dart
index 813d13d80a3858ac0b96b17b7b23d21e4ab1fd10..d9ffad278e075708a426d49b1a17dbc847e378db 100644
--- a/pkg/polymer/test/build/code_extractor.dart
+++ b/pkg/polymer/test/build/code_extractor.dart
@@ -20,22 +20,8 @@ void codeExtractorTests() {
}, {
'a|web/test.html':
'<!DOCTYPE html><html><head></head><body>'
- '<script type="application/dart" src="test.html.0.dart"></script>'
'</body></html>',
-
- 'a|web/test.html.0.dart':
- 'library a.web.test_html_0;\nmain() { }',
- });
-
- testPhases('component script, no library in script', phases, {
- 'a|web/test.html':
- '<!DOCTYPE html><html><head>'
- '<script type="application/dart;component=1">main() { }</script>',
- }, {
- 'a|web/test.html':
- '<!DOCTYPE html><html><head></head><body>'
- '</body></html>',
-
+ 'a|web/test.html._data': expectedData(['web/test.html.0.dart']),
'a|web/test.html.0.dart':
'library a.web.test_html_0;\nmain() { }',
});
@@ -47,9 +33,8 @@ void codeExtractorTests() {
}, {
'a|web/test.html':
'<!DOCTYPE html><html><head></head><body>'
- '<script type="application/dart" src="test.html.0.dart"></script>'
'</body></html>',
-
+ 'a|web/test.html._data': expectedData(['web/test.html.0.dart']),
'a|web/test.html.0.dart':
'library f;\nmain() { }',
});
@@ -57,18 +42,14 @@ void codeExtractorTests() {
testPhases('under lib/ directory not transformed', phases, {
'a|lib/test.html':
'<!DOCTYPE html><html><head>'
- '<script type="application/dart">library f;\nmain() { }</script>'
- '<script type="application/dart;component=1">'
- 'library g;\nmain() { }</script>',
+ '<script type="application/dart">library f;\nmain() { }</script>',
}, {
'a|lib/test.html':
'<!DOCTYPE html><html><head>'
'<script type="application/dart">library f;\nmain() { }</script>'
- '<script type="application/dart;component=1">'
- 'library g;\nmain() { }</script>',
});
- testPhases('multiple scripts allowed', phases, {
+ testPhases('multiple scripts - removed', phases, {
'a|web/test.html':
'<!DOCTYPE html><html><head>'
'<script type="application/dart">library a1;\nmain1() { }</script>'
@@ -76,64 +57,15 @@ void codeExtractorTests() {
}, {
'a|web/test.html':
'<!DOCTYPE html><html><head></head><body>'
- '<script type="application/dart" src="test.html.0.dart"></script>'
- '<script type="application/dart" src="test.html.1.dart"></script>'
'</body></html>',
-
+ 'a|web/test.html._data': expectedData(
+ ['web/test.html.0.dart', 'web/test.html.1.dart']),
'a|web/test.html.0.dart':
'library a1;\nmain1() { }',
'a|web/test.html.1.dart':
'library a2;\nmain2() { }',
});
- testPhases('component scripts removed', phases, {
- 'a|web/test.html':
- '<!DOCTYPE html><html><head>'
- '<script type="application/dart;component=1">'
- 'library a1;\nmain1() { }</script>'
- '<script type="application/dart;component=1">'
- 'library a2;\nmain2() { }</script>',
- }, {
- 'a|web/test.html':
- '<!DOCTYPE html><html><head></head><body>'
- '</body></html>',
- 'a|web/test.html.scriptUrls': JSON.encode([
- ["a", "web/test.html.0.dart"],
- ["a", "web/test.html.1.dart"]]),
- 'a|web/test.html.0.dart':
- 'library a1;\nmain1() { }',
- 'a|web/test.html.1.dart':
- 'library a2;\nmain2() { }',
- });
-
- testPhases('multiple deeper scripts', phases, {
- 'a|web/test.html':
- '<!DOCTYPE html><html><head>'
- '<script type="application/dart">main1() { }</script>'
- '</head><body><div>'
- '<script type="application/dart">main2() { }</script>'
- '</div><div><div>'
- '<script type="application/dart">main3() { }</script>'
- '</div></div>'
- }, {
- 'a|web/test.html':
- '<!DOCTYPE html><html><head>'
- '</head><body>'
- '<script type="application/dart" src="test.html.0.dart"></script>'
- '<div>'
- '<script type="application/dart" src="test.html.1.dart"></script>'
- '</div><div><div>'
- '<script type="application/dart" src="test.html.2.dart"></script>'
- '</div></div></body></html>',
-
- 'a|web/test.html.0.dart':
- 'library a.web.test_html_0;\nmain1() { }',
- 'a|web/test.html.1.dart':
- 'library a.web.test_html_1;\nmain2() { }',
- 'a|web/test.html.2.dart':
- 'library a.web.test_html_2;\nmain3() { }',
- });
-
testPhases('multiple imported scripts', phases, {
'a|web/test.html':
'<link rel="import" href="test2.html">'
@@ -141,28 +73,40 @@ void codeExtractorTests() {
'<link rel="import" href="packages/a/foo/test.html">'
'<link rel="import" href="packages/b/test.html">',
'a|web/test2.html':
- '<script type="application/dart;component=1">main1() { }',
+ '<script type="application/dart">main1() { }',
'a|web/bar/test.html':
- '<script type="application/dart;component=1">main2() { }',
+ '<script type="application/dart">main2() { }',
'a|lib/foo/test.html':
- '<script type="application/dart;component=1">main3() { }',
+ '<script type="application/dart">main3() { }',
'b|lib/test.html':
- '<script type="application/dart;component=1">main4() { }'
+ '<script type="application/dart">main4() { }'
}, {
'a|web/test.html':
'<html><head></head><body></body></html>',
- 'a|web/test.html.scriptUrls': JSON.encode([
- ["a", "web/test.html.0.dart"],
- ["a", "web/test.html.1.dart"],
- ["a", "web/test.html.2.dart"],
- ["a", "web/test.html.3.dart"],
- ]),
+ 'a|web/test.html._data': expectedData(["web/test.html.0.dart",
+ "web/test.html.1.dart", "web/test.html.2.dart",
+ "web/test.html.3.dart"]),
'a|web/test.html.0.dart': 'library a.web.test2_html_0;\nmain1() { }',
'a|web/test.html.1.dart': 'library a.web.bar.test_html_1;\nmain2() { }',
'a|web/test.html.2.dart': 'library a.foo.test_html_2;\nmain3() { }',
'a|web/test.html.3.dart': 'library b.test_html_3;\nmain4() { }'
});
+ testPhases('experimental bootstrap', phases, {
+ 'a|web/test.html':
+ '<link rel="import" '
+ 'href="packages/polymer/polymer_experimental.html">'
+ '<link rel="import" href="test2.html">',
+ 'a|web/test2.html':
+ '<script type="application/dart">main1() { }',
+ }, {
+ 'a|web/test.html':
+ '<html><head></head><body></body></html>',
+ 'a|web/test.html._data': expectedData(["web/test.html.0.dart"],
+ experimental: true),
+ 'a|web/test.html.0.dart': 'library a.web.test2_html_0;\nmain1() { }',
+ });
+
group('fixes import/export/part URIs', dartUriTests);
group('validates script-tag URIs', validateUriTests);
}
@@ -185,10 +129,8 @@ dartUriTests() {
'</body></html>',
}, {
'a|web/test.html':
- '<!DOCTYPE html><html><head></head><body>'
- '<script type="application/dart" src="test.html.0.dart"></script>'
- '</body></html>',
- 'a|web/test.html.scriptUrls': '[]',
+ '<!DOCTYPE html><html><head></head><body></body></html>',
+ 'a|web/test.html._data': expectedData(['web/test.html.0.dart']),
'a|web/test.html.0.dart':
"library a.web.test2.foo_html_0;\n"
"import 'package:qux/qux.dart';"
@@ -197,44 +139,8 @@ dartUriTests() {
"part 'test2/baz.dart';",
'a|web/test2/foo.html':
'<!DOCTYPE html><html><head></head><body>'
- '<script type="application/dart" src="foo.html.0.dart"></script>'
'</body></html>',
- 'a|web/test2/foo.html.scriptUrls': '[]',
- 'a|web/test2/foo.html.0.dart':
- "library a.web.test2.foo_html_0;\n"
- "import 'package:qux/qux.dart';"
- "import 'foo.dart';"
- "export 'bar.dart';"
- "part 'baz.dart';",
- });
-
- testPhases('from web folder, component', phases, {
- 'a|web/test.html':
- '<!DOCTYPE html><html><head>'
- '<link rel="import" href="test2/foo.html">'
- '</head><body></body></html>',
- 'a|web/test2/foo.html':
- '<!DOCTYPE html><html><head></head><body>'
- '<script type="application/dart;component=1">'
- "import 'package:qux/qux.dart';"
- "import 'foo.dart';"
- "export 'bar.dart';"
- "part 'baz.dart';"
- '</script>'
- '</body></html>',
- }, {
- 'a|web/test.html':
- '<!DOCTYPE html><html><head></head><body></body></html>',
- 'a|web/test.html.scriptUrls': '[["a","web/test.html.0.dart"]]',
- 'a|web/test.html.0.dart':
- "library a.web.test2.foo_html_0;\n"
- "import 'package:qux/qux.dart';"
- "import 'test2/foo.dart';"
- "export 'test2/bar.dart';"
- "part 'test2/baz.dart';",
- 'a|web/test2/foo.html':
- '<!DOCTYPE html><html><head></head><body></body></html>',
- 'a|web/test2/foo.html.scriptUrls': '[["a","web/test2/foo.html.0.dart"]]',
+ 'a|web/test2/foo.html._data': expectedData(['web/test2/foo.html.0.dart']),
'a|web/test2/foo.html.0.dart':
"library a.web.test2.foo_html_0;\n"
"import 'package:qux/qux.dart';"
@@ -250,7 +156,7 @@ dartUriTests() {
'</head><body></body></html>',
'a|lib/test2/foo.html':
'<!DOCTYPE html><html><head></head><body>'
- '<script type="application/dart;component=1">'
+ '<script type="application/dart">'
"import 'package:qux/qux.dart';"
"import 'foo.dart';"
"export 'bar.dart';"
@@ -260,7 +166,7 @@ dartUriTests() {
}, {
'a|web/test.html':
'<!DOCTYPE html><html><head></head><body></body></html>',
- 'a|web/test.html.scriptUrls': '[["a","web/test.html.0.dart"]]',
+ 'a|web/test.html._data': expectedData(['web/test.html.0.dart']),
'a|web/test.html.0.dart':
"library a.test2.foo_html_0;\n"
"import 'package:qux/qux.dart';"
@@ -269,7 +175,7 @@ dartUriTests() {
"part 'package:a/test2/baz.dart';",
'a|lib/test2/foo.html':
'<!DOCTYPE html><html><head></head><body>'
- '<script type="application/dart;component=1">'
+ '<script type="application/dart">'
"import 'package:qux/qux.dart';"
"import 'foo.dart';"
"export 'bar.dart';"
@@ -285,7 +191,7 @@ dartUriTests() {
'</head><body></body></html>',
'b|lib/test2/foo.html':
'<!DOCTYPE html><html><head></head><body>'
- '<script type="application/dart;component=1">'
+ '<script type="application/dart">'
"import 'package:qux/qux.dart';"
"import 'foo.dart';"
"export 'bar.dart';"
@@ -295,7 +201,7 @@ dartUriTests() {
}, {
'a|web/test.html':
'<!DOCTYPE html><html><head></head><body></body></html>',
- 'a|web/test.html.scriptUrls': '[["a","web/test.html.0.dart"]]',
+ 'a|web/test.html._data': expectedData(['web/test.html.0.dart']),
'a|web/test.html.0.dart':
"library b.test2.foo_html_0;\n"
"import 'package:qux/qux.dart';"
@@ -304,7 +210,7 @@ dartUriTests() {
"part 'package:b/test2/baz.dart';",
'b|lib/test2/foo.html':
'<!DOCTYPE html><html><head></head><body>'
- '<script type="application/dart;component=1">'
+ '<script type="application/dart">'
"import 'package:qux/qux.dart';"
"import 'foo.dart';"
"export 'bar.dart';"
@@ -319,31 +225,31 @@ validateUriTests() {
testPhases('script is inline', phases, {
'a|web/test.html':
'<!DOCTYPE html><html><body>'
- '<script type="application/dart;component=1">'
+ '<script type="application/dart">'
'main(){}'
'</script>'
'</body></html>',
}, {
- 'a|web/test.html.scriptUrls': '[["a","web/test.html.0.dart"]]',
+ 'a|web/test.html._data': expectedData(['web/test.html.0.dart']),
}, []);
testPhases('script src is valid', phases, {
'a|web/test.html':
'<!DOCTYPE html><html><body>'
- '<script type="application/dart;component=1" src="a.dart"></script>'
+ '<script type="application/dart" src="a.dart"></script>'
'</body></html>',
'a|web/a.dart': 'main() {}',
}, {
- 'a|web/test.html.scriptUrls': '[["a","web/a.dart"]]',
+ 'a|web/test.html._data': expectedData(['web/a.dart']),
}, []);
testPhases('script src is invalid', phases, {
'a|web/test.html':
'<!DOCTYPE html><html><body>\n'
- '<script type="application/dart;component=1" src="a.dart"></script>'
+ '<script type="application/dart" src="a.dart"></script>'
'</body></html>',
}, {
- 'a|web/test.html.scriptUrls': '[]',
+ 'a|web/test.html._data': EMPTY_DATA,
}, [
'warning: Script file at "a.dart" not found. (web/test.html 1 0)',
]);
@@ -351,15 +257,15 @@ validateUriTests() {
testPhases('many script src around, valid and invalid', phases, {
'a|web/test.html':
'<!DOCTYPE html><html><body>'
- '<script type="application/dart;component=1" src="a.dart"></script>'
- '\n<script type="application/dart;component=1" src="b.dart"></script>'
- '\n<script type="application/dart;component=1" src="c.dart"></script>'
- '\n<script type="application/dart;component=1" src="d.dart"></script>'
+ '<script type="application/dart" src="a.dart"></script>'
+ '\n<script type="application/dart" src="b.dart"></script>'
+ '\n<script type="application/dart" src="c.dart"></script>'
+ '\n<script type="application/dart" src="d.dart"></script>'
'</body></html>',
'a|web/a.dart': 'main() {}',
'a|web/c.dart': 'main() {}',
}, {
- 'a|web/test.html.scriptUrls': '[["a","web/a.dart"],["a","web/c.dart"]]',
+ 'a|web/test.html._data': expectedData(['web/a.dart', 'web/c.dart']),
}, [
'warning: Script file at "b.dart" not found. (web/test.html 1 0)',
'warning: Script file at "d.dart" not found. (web/test.html 3 0)',
« no previous file with comments | « pkg/polymer/test/build/all_phases_test.dart ('k') | pkg/polymer/test/build/common.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698