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

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

Issue 225043004: Replace bootstrap logic with 'boot.js', use 'component/dart' mime-type and add (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 8 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.import_inliner_test; 5 library polymer.test.build.import_inliner_test;
6 6
7 import 'dart:convert' show JSON; 7 import 'dart:convert' show JSON;
8 import 'package:polymer/src/build/common.dart'; 8 import 'package:polymer/src/build/common.dart';
9 import 'package:polymer/src/build/import_inliner.dart'; 9 import 'package:polymer/src/build/import_inliner.dart';
10 import 'package:unittest/compact_vm_config.dart'; 10 import 'package:unittest/compact_vm_config.dart';
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 'a|web/test2.html.scriptUrls': '[]', 91 'a|web/test2.html.scriptUrls': '[]',
92 }); 92 });
93 93
94 testPhases('preserves order of scripts', phases, 94 testPhases('preserves order of scripts', phases,
95 { 95 {
96 'a|web/test.html': 96 'a|web/test.html':
97 '<!DOCTYPE html><html><head>' 97 '<!DOCTYPE html><html><head>'
98 '<script type="text/javascript">/*first*/</script>' 98 '<script type="text/javascript">/*first*/</script>'
99 '<script src="second.js"></script>' 99 '<script src="second.js"></script>'
100 '<link rel="import" href="test2.html">' 100 '<link rel="import" href="test2.html">'
101 '<script>/*forth*/</script>'
102 '</head></html>',
103 'a|web/test2.html':
104 '<!DOCTYPE html><html><head><script>/*third*/</script>'
105 '</head><body><polymer-element>2</polymer-element></html>',
106 'a|web/second.js': '/*second*/'
107 }, {
108 'a|web/test.html':
109 '<!DOCTYPE html><html><head>'
110 '</head><body>'
111 '<script type="text/javascript">/*first*/</script>'
112 '<script src="second.js"></script>'
113 '<script>/*third*/</script>'
114 '<polymer-element>2</polymer-element>'
115 '<script>/*forth*/</script>'
116 '</body></html>',
117 'a|web/test.html.scriptUrls': '[]',
118 'a|web/test2.html':
119 '<!DOCTYPE html><html><head><script>/*third*/</script>'
120 '</head><body><polymer-element>2</polymer-element></html>',
121 'a|web/test2.html.scriptUrls': '[]',
122 'a|web/second.js': '/*second*/'
123 });
124
125 testPhases('preserves order of scripts, including Dart scripts', phases,
126 {
127 'a|web/test.html':
128 '<!DOCTYPE html><html><head>'
129 '<script type="text/javascript">/*first*/</script>'
130 '<script src="second.js"></script>'
131 '<link rel="import" href="test2.html">'
101 '<script type="application/dart">/*forth*/</script>' 132 '<script type="application/dart">/*forth*/</script>'
102 '</head></html>', 133 '</head></html>',
103 'a|web/test2.html': 134 'a|web/test2.html':
104 '<!DOCTYPE html><html><head><script>/*third*/</script>' 135 '<!DOCTYPE html><html><head><script>/*third*/</script>'
105 '</head><body><polymer-element>2</polymer-element></html>', 136 '</head><body><polymer-element>2</polymer-element></html>',
106 'a|web/second.js': '/*second*/' 137 'a|web/second.js': '/*second*/'
107 }, { 138 }, {
108 'a|web/test.html': 139 'a|web/test.html':
109 '<!DOCTYPE html><html><head>' 140 '<!DOCTYPE html><html><head>'
110 '</head><body>' 141 '</head><body>'
111 '<script type="text/javascript">/*first*/</script>' 142 '<script type="text/javascript">/*first*/</script>'
112 '<script src="second.js"></script>' 143 '<script src="second.js"></script>'
113 '<script>/*third*/</script>' 144 '<script>/*third*/</script>'
114 '<polymer-element>2</polymer-element>' 145 '<polymer-element>2</polymer-element>'
115 '<script type="application/dart" src="test.html.0.dart"></script>' 146 '<script type="application/dart" src="test.html.0.dart"></script>'
116 '</body></html>', 147 '</body></html>',
117 'a|web/test.html.scriptUrls': '[]', 148 'a|web/test.html.scriptUrls': '[]',
118 'a|web/test.html.0.dart': 'library a.web.test_html;\n/*forth*/', 149 'a|web/test.html.0.dart': 'library a.web.test_html_0;\n/*forth*/',
119 'a|web/test2.html': 150 'a|web/test2.html':
120 '<!DOCTYPE html><html><head><script>/*third*/</script>' 151 '<!DOCTYPE html><html><head><script>/*third*/</script>'
121 '</head><body><polymer-element>2</polymer-element></html>', 152 '</head><body><polymer-element>2</polymer-element></html>',
153 'a|web/test2.html.scriptUrls': '[]',
154 'a|web/second.js': '/*second*/'
155 });
156
157 testPhases('preserves order, extract component/dart scripts', phases,
158 {
159 'a|web/test.html':
160 '<!DOCTYPE html><html><head>'
161 '<script type="text/javascript">/*first*/</script>'
162 '<script src="second.js"></script>'
163 '<link rel="import" href="test2.html">'
164 '<script type="component/dart">/*forth*/</script>'
165 '<script type="component/dart">/*fifth*/</script>'
166 '</head></html>',
167 'a|web/test2.html':
168 '<!DOCTYPE html><html><head><script>/*third*/</script>'
169 '</head><body><polymer-element>2</polymer-element></html>',
170 'a|web/second.js': '/*second*/'
171 }, {
172 'a|web/test.html':
173 '<!DOCTYPE html><html><head>'
174 '</head><body>'
175 '<script type="text/javascript">/*first*/</script>'
176 '<script src="second.js"></script>'
177 '<script>/*third*/</script>'
178 '<polymer-element>2</polymer-element>'
179 '</body></html>',
180 'a|web/test.html.scriptUrls':
181 '[["a","web/test.html.0.dart"],["a","web/test.html.1.dart"]]',
182 'a|web/test.html.0.dart': 'library a.web.test_html_0;\n/*forth*/',
183 'a|web/test.html.1.dart': 'library a.web.test_html_1;\n/*fifth*/',
184 'a|web/test2.html':
185 '<!DOCTYPE html><html><head><script>/*third*/</script>'
186 '</head><body><polymer-element>2</polymer-element></html>',
122 'a|web/test2.html.scriptUrls': '[]', 187 'a|web/test2.html.scriptUrls': '[]',
123 'a|web/second.js': '/*second*/' 188 'a|web/second.js': '/*second*/'
124 }); 189 });
125 190
126 testPhases('no transformation outside web/', phases, 191 testPhases('no transformation outside web/', phases,
127 { 192 {
128 'a|lib/test.html': 193 'a|lib/test.html':
129 '<!DOCTYPE html><html><head>' 194 '<!DOCTYPE html><html><head>'
130 '<link rel="import" href="test2.html">' 195 '<link rel="import" href="test2.html">'
131 '</head></html>', 196 '</head></html>',
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
362 '<link rel="import" href="test_1.html">' 427 '<link rel="import" href="test_1.html">'
363 '</head></html>', 428 '</head></html>',
364 'a|web/test_1.html': 429 'a|web/test_1.html':
365 '<!DOCTYPE html><html><head>' 430 '<!DOCTYPE html><html><head>'
366 '<link rel="import" href="test_2.html">' 431 '<link rel="import" href="test_2.html">'
367 '</head><body><polymer-element>1</polymer-element>' 432 '</head><body><polymer-element>1</polymer-element>'
368 '<script type="application/dart" src="s1.dart"></script></html>', 433 '<script type="application/dart" src="s1.dart"></script></html>',
369 'a|web/test_2.html': 434 'a|web/test_2.html':
370 '<!DOCTYPE html><html><head>' 435 '<!DOCTYPE html><html><head>'
371 '<link rel="import" href="test_1.html">' 436 '<link rel="import" href="test_1.html">'
437 '</head><body><polymer-element>2</polymer-element>'
438 '<script type="application/dart" src="s2.dart"></script></html>',
439 }, {
440 'a|web/test.html':
441 '<!DOCTYPE html><html><head>'
442 '</head><body>'
443 '<polymer-element>2</polymer-element>'
444 '<script type="application/dart" src="s2.dart"></script>'
445 '<polymer-element>1</polymer-element>'
446 '<script type="application/dart" src="s1.dart"></script>'
447 '</body></html>',
448 'a|web/test.html.scriptUrls': '[]',
449 'a|web/test_1.html':
450 '<!DOCTYPE html><html><head>'
451 '</head><body>'
452 '<polymer-element>2</polymer-element>'
453 '<script type="application/dart" src="s2.dart"></script>'
454 '<polymer-element>1</polymer-element>'
455 '<script type="application/dart" src="s1.dart"></script>'
456 '</body></html>',
457 'a|web/test_1.html.scriptUrls': '[]',
458 'a|web/test_2.html':
459 '<!DOCTYPE html><html><head>'
460 '</head><body>'
461 '<polymer-element>1</polymer-element>'
462 '<script type="application/dart" src="s1.dart"></script>'
463 '<polymer-element>2</polymer-element>'
464 '<script type="application/dart" src="s2.dart"></script>'
465 '</body></html>',
466 'a|web/test_2.html.scriptUrls': '[]',
467 });
468
469 testPhases('imports cycle, 1-step lasso, Dart components scripts', phases, {
470 'a|web/test.html':
471 '<!DOCTYPE html><html><head>'
472 '<link rel="import" href="test_1.html">'
473 '</head></html>',
474 'a|web/test_1.html':
475 '<!DOCTYPE html><html><head>'
476 '<link rel="import" href="test_2.html">'
477 '</head><body><polymer-element>1</polymer-element>'
478 '<script type="component/dart" src="s1.dart"></script></html>',
479 'a|web/test_2.html':
480 '<!DOCTYPE html><html><head>'
481 '<link rel="import" href="test_1.html">'
372 '</head><body><polymer-element>2' 482 '</head><body><polymer-element>2'
373 '<script type="application/dart" src="s2.dart"></script>' 483 '<script type="component/dart" src="s2.dart"></script>'
374 '</polymer-element>' 484 '</polymer-element>'
375 '</html>', 485 '</html>',
376 }, { 486 }, {
377 'a|web/test.html': 487 'a|web/test.html':
378 '<!DOCTYPE html><html><head>' 488 '<!DOCTYPE html><html><head>'
379 '</head><body>' 489 '</head><body>'
380 '<polymer-element>2</polymer-element>' 490 '<polymer-element>2</polymer-element>'
381 '<polymer-element>1</polymer-element>' 491 '<polymer-element>1</polymer-element>'
382 '</body></html>', 492 '</body></html>',
383 'a|web/test.html.scriptUrls': '[["a","web/s2.dart"],["a","web/s1.dart"]]', 493 'a|web/test.html.scriptUrls': '[["a","web/s2.dart"],["a","web/s1.dart"]]',
384 'a|web/test_1.html': 494 'a|web/test_1.html':
385 '<!DOCTYPE html><html><head>' 495 '<!DOCTYPE html><html><head>'
386 '</head><body>' 496 '</head><body>'
387 '<polymer-element>2</polymer-element>' 497 '<polymer-element>2</polymer-element>'
388 '<polymer-element>1</polymer-element>' 498 '<polymer-element>1</polymer-element>'
389 '<script type="application/dart" src="s1.dart"></script>'
390 '</body></html>', 499 '</body></html>',
391 'a|web/test_1.html.scriptUrls': 500 'a|web/test_1.html.scriptUrls':
392 '[["a","web/s2.dart"]]', 501 '[["a","web/s2.dart"],["a","web/s1.dart"]]',
393 'a|web/test_2.html': 502 'a|web/test_2.html':
394 '<!DOCTYPE html><html><head>' 503 '<!DOCTYPE html><html><head>'
395 '</head><body>' 504 '</head><body>'
396 '<polymer-element>1</polymer-element>' 505 '<polymer-element>1</polymer-element>'
397 '<polymer-element>2' 506 '<polymer-element>2</polymer-element>'
398 '<script type="application/dart" src="s2.dart"></script>'
399 '</polymer-element>'
400 '</body></html>', 507 '</body></html>',
401 'a|web/test_2.html.scriptUrls': 508 'a|web/test_2.html.scriptUrls':
402 '[["a","web/s1.dart"]]', 509 '[["a","web/s1.dart"],["a","web/s2.dart"]]',
403 }); 510 });
404 511
405 testPhases('imports with Dart script after JS script', phases, { 512 testPhases('imports with Dart script after JS script', phases, {
406 'a|web/test.html': 513 'a|web/test.html':
407 '<!DOCTYPE html><html><head>' 514 '<!DOCTYPE html><html><head>'
408 '<link rel="import" href="test_1.html">' 515 '<link rel="import" href="test_1.html">'
409 '</head></html>', 516 '</head></html>',
410 'a|web/test_1.html': 517 'a|web/test_1.html':
411 '<!DOCTYPE html><html><head>' 518 '<!DOCTYPE html><html><head>'
412 '<link rel="import" href="test_1.html">' 519 '<link rel="import" href="test_1.html">'
413 '</head><body>' 520 '</head><body>'
414 '<foo>42</foo><bar-baz></bar-baz>' 521 '<foo>42</foo><bar-baz></bar-baz>'
415 '<polymer-element>1' 522 '<polymer-element>1'
416 '<script src="s1.js"></script>' 523 '<script src="s1.js"></script>'
417 '<script type="application/dart" src="s1.dart"></script>' 524 '<script type="component/dart" src="s1.dart"></script>'
418 '</polymer-element>' 525 '</polymer-element>'
419 'FOO</body></html>', 526 'FOO</body></html>',
420 }, { 527 }, {
421 'a|web/test.html': 528 'a|web/test.html':
422 '<!DOCTYPE html><html><head>' 529 '<!DOCTYPE html><html><head>'
423 '</head><body>' 530 '</head><body>'
424 '<foo>42</foo><bar-baz></bar-baz>' 531 '<foo>42</foo><bar-baz></bar-baz>'
425 '<polymer-element>1' 532 '<polymer-element>1'
426 '<script src="s1.js"></script>' 533 '<script src="s1.js"></script>'
427 '</polymer-element>' 534 '</polymer-element>'
428 'FOO</body></html>', 535 'FOO</body></html>',
429 'a|web/test.html.scriptUrls': '[["a","web/s1.dart"]]', 536 'a|web/test.html.scriptUrls': '[["a","web/s1.dart"]]',
430 'a|web/test_1.html': 537 'a|web/test_1.html':
431 '<!DOCTYPE html><html><head>' 538 '<!DOCTYPE html><html><head>'
432 '</head><body>' 539 '</head><body>'
433 '<foo>42</foo><bar-baz></bar-baz>' 540 '<foo>42</foo><bar-baz></bar-baz>'
434 '<polymer-element>1' 541 '<polymer-element>1'
435 '<script src="s1.js"></script>' 542 '<script src="s1.js"></script>'
436 '<script type="application/dart" src="s1.dart"></script>'
437 '</polymer-element>' 543 '</polymer-element>'
438 'FOO</body></html>', 544 'FOO</body></html>',
439 'a|web/test_1.html.scriptUrls': '[]', 545 'a|web/test_1.html.scriptUrls': '[["a","web/s1.dart"]]',
440 }); 546 });
441 547
442 testPhases('imports cycle, 2-step lasso', phases, { 548 testPhases('imports cycle, 2-step lasso', phases, {
443 'a|web/test.html': 549 'a|web/test.html':
444 '<!DOCTYPE html><html><head>' 550 '<!DOCTYPE html><html><head>'
445 '<link rel="import" href="test_1.html">' 551 '<link rel="import" href="test_1.html">'
446 '</head></html>', 552 '</head></html>',
447 'a|web/test_1.html': 553 'a|web/test_1.html':
448 '<!DOCTYPE html><html><head>' 554 '<!DOCTYPE html><html><head>'
449 '<link rel="import" href="test_2.html">' 555 '<link rel="import" href="test_2.html">'
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
702 '<style>h1 { font-size: 70px; }</style>' 808 '<style>h1 { font-size: 70px; }</style>'
703 '<style>.second { color: black }</style>' 809 '<style>.second { color: black }</style>'
704 '</body></html>', 810 '</body></html>',
705 'a|web/test.html.scriptUrls': '[]', 811 'a|web/test.html.scriptUrls': '[]',
706 'a|web/test2.css': 812 'a|web/test2.css':
707 'h1 { font-size: 70px; }', 813 'h1 { font-size: 70px; }',
708 }); 814 });
709 815
710 } 816 }
711 817
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698