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

Side by Side Diff: pkg/polymer/test/build/all_phases_test.dart

Issue 27518006: Practically remove boot.js, adds the initialization from the Dart side of (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 2 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) 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.all_phases_test; 5 library polymer.test.build.all_phases_test;
6 6
7 import 'package:polymer/transformer.dart'; 7 import 'package:polymer/transformer.dart';
8 import 'package:polymer/src/build/script_compactor.dart' show MAIN_HEADER; 8 import 'package:polymer/src/build/script_compactor.dart' show MAIN_HEADER;
9 import 'package:unittest/compact_vm_config.dart'; 9 import 'package:unittest/compact_vm_config.dart';
10 10
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 '<script src="packages/browser/dart.js"></script>' 44 '<script src="packages/browser/dart.js"></script>'
45 '</body></html>', 45 '</body></html>',
46 46
47 'a|web/test.html_bootstrap.dart': 47 'a|web/test.html_bootstrap.dart':
48 '''$MAIN_HEADER 48 '''$MAIN_HEADER
49 import 'a.dart' as i0; 49 import 'a.dart' as i0;
50 50
51 void main() { 51 void main() {
52 initPolymer([ 52 initPolymer([
53 'a.dart', 53 'a.dart',
54 ], currentMirrorSystem().isolate.rootLibrary.uri.toString()); 54 ]);
55 } 55 }
56 '''.replaceAll('\n ', '\n'), 56 '''.replaceAll('\n ', '\n'),
57 'a|web/test.dart': _sampleObservableOutput('A', 'foo'), 57 'a|web/test.dart': _sampleObservableOutput('A', 'foo'),
58 }); 58 });
59 59
60 testPhases('single inline script', phases, { 60 testPhases('single inline script', phases, {
61 'a|web/test.html': 61 'a|web/test.html':
62 '<!DOCTYPE html><html><head>' 62 '<!DOCTYPE html><html><head>'
63 '<script type="application/dart">' 63 '<script type="application/dart">'
64 '${_sampleObservable("B", "bar")}</script>', 64 '${_sampleObservable("B", "bar")}</script>',
65 }, { 65 }, {
66 'a|web/test.html': 66 'a|web/test.html':
67 '<!DOCTYPE html><html><head></head><body>' 67 '<!DOCTYPE html><html><head></head><body>'
68 '$SHADOW_DOM_TAG' 68 '$SHADOW_DOM_TAG'
69 '$CUSTOM_ELEMENT_TAG' 69 '$CUSTOM_ELEMENT_TAG'
70 '$INTEROP_TAG' 70 '$INTEROP_TAG'
71 '<script type="application/dart" ' 71 '<script type="application/dart" '
72 'src="test.html_bootstrap.dart"></script>' 72 'src="test.html_bootstrap.dart"></script>'
73 '<script src="packages/browser/dart.js"></script>' 73 '<script src="packages/browser/dart.js"></script>'
74 '</body></html>', 74 '</body></html>',
75 75
76 'a|web/test.html_bootstrap.dart': 76 'a|web/test.html_bootstrap.dart':
77 '''$MAIN_HEADER 77 '''$MAIN_HEADER
78 import 'test.html.0.dart' as i0; 78 import 'test.html.0.dart' as i0;
79 79
80 void main() { 80 void main() {
81 initPolymer([ 81 initPolymer([
82 'test.html.0.dart', 82 'test.html.0.dart',
83 ], currentMirrorSystem().isolate.rootLibrary.uri.toString()); 83 ]);
84 } 84 }
85 '''.replaceAll('\n ', '\n'), 85 '''.replaceAll('\n ', '\n'),
86 'a|web/test.html.0.dart': _sampleObservableOutput("B", "bar"), 86 'a|web/test.html.0.dart': _sampleObservableOutput("B", "bar"),
87 }); 87 });
88 88
89 testPhases('several scripts', phases, { 89 testPhases('several scripts', phases, {
90 'a|web/test.html': 90 'a|web/test.html':
91 '<!DOCTYPE html><html><head>' 91 '<!DOCTYPE html><html><head>'
92 '<script type="application/dart" src="a.dart"></script>' 92 '<script type="application/dart" src="a.dart"></script>'
93 '<script type="application/dart">' 93 '<script type="application/dart">'
(...skipping 22 matching lines...) Expand all
116 import 'test.html.0.dart' as i1; 116 import 'test.html.0.dart' as i1;
117 import 'test.html.1.dart' as i2; 117 import 'test.html.1.dart' as i2;
118 import 'd.dart' as i3; 118 import 'd.dart' as i3;
119 119
120 void main() { 120 void main() {
121 initPolymer([ 121 initPolymer([
122 'a.dart', 122 'a.dart',
123 'test.html.0.dart', 123 'test.html.0.dart',
124 'test.html.1.dart', 124 'test.html.1.dart',
125 'd.dart', 125 'd.dart',
126 ], currentMirrorSystem().isolate.rootLibrary.uri.toString()); 126 ]);
127 } 127 }
128 '''.replaceAll('\n ', '\n'), 128 '''.replaceAll('\n ', '\n'),
129 'a|web/a.dart': _sampleObservableOutput('A', 'foo'), 129 'a|web/a.dart': _sampleObservableOutput('A', 'foo'),
130 'a|web/test.html.0.dart': _sampleObservableOutput("B", "bar"), 130 'a|web/test.html.0.dart': _sampleObservableOutput("B", "bar"),
131 'a|web/test.html.1.dart': _sampleObservableOutput("C", "car"), 131 'a|web/test.html.1.dart': _sampleObservableOutput("C", "car"),
132 }); 132 });
133 133
134 testPhases('with imports', phases, { 134 testPhases('with imports', phases, {
135 'a|web/index.html': 135 'a|web/index.html':
136 '<!DOCTYPE html><html><head>' 136 '<!DOCTYPE html><html><head>'
(...skipping 24 matching lines...) Expand all
161 '''$MAIN_HEADER 161 '''$MAIN_HEADER
162 import 'test2.html.0.dart' as i0; 162 import 'test2.html.0.dart' as i0;
163 import 'b.dart' as i1; 163 import 'b.dart' as i1;
164 import 'index.html.0.dart' as i2; 164 import 'index.html.0.dart' as i2;
165 165
166 void main() { 166 void main() {
167 initPolymer([ 167 initPolymer([
168 'test2.html.0.dart', 168 'test2.html.0.dart',
169 'b.dart', 169 'b.dart',
170 'index.html.0.dart', 170 'index.html.0.dart',
171 ], currentMirrorSystem().isolate.rootLibrary.uri.toString()); 171 ]);
172 } 172 }
173 '''.replaceAll('\n ', '\n'), 173 '''.replaceAll('\n ', '\n'),
174 'a|web/test2.html.0.dart': _sampleObservableOutput("A", "foo"), 174 'a|web/test2.html.0.dart': _sampleObservableOutput("A", "foo"),
175 'a|web/b.dart': _sampleObservableOutput('B', 'bar'), 175 'a|web/b.dart': _sampleObservableOutput('B', 'bar'),
176 'a|web/index.html.0.dart': _sampleObservableOutput("C", "car"), 176 'a|web/index.html.0.dart': _sampleObservableOutput("C", "car"),
177 }); 177 });
178 } 178 }
179 179
180 String _sampleObservable(String className, String fieldName) => ''' 180 String _sampleObservable(String className, String fieldName) => '''
181 library ${className}_$fieldName; 181 library ${className}_$fieldName;
182 import 'package:observe/observe.dart'; 182 import 'package:observe/observe.dart';
183 183
184 class $className extends ObservableBase { 184 class $className extends ObservableBase {
185 @observable int $fieldName; 185 @observable int $fieldName;
186 $className(this.$fieldName); 186 $className(this.$fieldName);
187 } 187 }
188 '''; 188 ''';
189 189
190 String _sampleObservableOutput(String className, String field) => 190 String _sampleObservableOutput(String className, String field) =>
191 "library ${className}_$field;\n" 191 "library ${className}_$field;\n"
192 "import 'package:observe/observe.dart';\n\n" 192 "import 'package:observe/observe.dart';\n\n"
193 "class $className extends ChangeNotifierBase {\n" 193 "class $className extends ChangeNotifierBase {\n"
194 " @reflectable @observable int get $field => __\$$field; " 194 " @reflectable @observable int get $field => __\$$field; "
195 "int __\$$field; " 195 "int __\$$field; "
196 "@reflectable set $field(int value) { " 196 "@reflectable set $field(int value) { "
197 "__\$$field = notifyPropertyChange(#$field, __\$$field, value); " 197 "__\$$field = notifyPropertyChange(#$field, __\$$field, value); "
198 "}\n" 198 "}\n"
199 " $className($field) : __\$$field = $field;\n" 199 " $className($field) : __\$$field = $field;\n"
200 "}\n"; 200 "}\n";
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698