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

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 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="application/dart;component=1">/*forth*/</script>'
165 '<script type="application/dart;component=1">/*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="application/dart;component=1" src="s1.dart">'
479 '</script></html>',
480 'a|web/test_2.html':
481 '<!DOCTYPE html><html><head>'
482 '<link rel="import" href="test_1.html">'
372 '</head><body><polymer-element>2' 483 '</head><body><polymer-element>2'
373 '<script type="application/dart" src="s2.dart"></script>' 484 '<script type="application/dart;component=1" src="s2.dart"></script>'
374 '</polymer-element>' 485 '</polymer-element>'
375 '</html>', 486 '</html>',
376 }, { 487 }, {
377 'a|web/test.html': 488 'a|web/test.html':
378 '<!DOCTYPE html><html><head>' 489 '<!DOCTYPE html><html><head>'
379 '</head><body>' 490 '</head><body>'
380 '<polymer-element>2</polymer-element>' 491 '<polymer-element>2</polymer-element>'
381 '<polymer-element>1</polymer-element>' 492 '<polymer-element>1</polymer-element>'
382 '</body></html>', 493 '</body></html>',
383 'a|web/test.html.scriptUrls': '[["a","web/s2.dart"],["a","web/s1.dart"]]', 494 'a|web/test.html.scriptUrls': '[["a","web/s2.dart"],["a","web/s1.dart"]]',
384 'a|web/test_1.html': 495 'a|web/test_1.html':
385 '<!DOCTYPE html><html><head>' 496 '<!DOCTYPE html><html><head>'
386 '</head><body>' 497 '</head><body>'
387 '<polymer-element>2</polymer-element>' 498 '<polymer-element>2</polymer-element>'
388 '<polymer-element>1</polymer-element>' 499 '<polymer-element>1</polymer-element>'
389 '<script type="application/dart" src="s1.dart"></script>'
390 '</body></html>', 500 '</body></html>',
391 'a|web/test_1.html.scriptUrls': 501 'a|web/test_1.html.scriptUrls':
392 '[["a","web/s2.dart"]]', 502 '[["a","web/s2.dart"],["a","web/s1.dart"]]',
393 'a|web/test_2.html': 503 'a|web/test_2.html':
394 '<!DOCTYPE html><html><head>' 504 '<!DOCTYPE html><html><head>'
395 '</head><body>' 505 '</head><body>'
396 '<polymer-element>1</polymer-element>' 506 '<polymer-element>1</polymer-element>'
397 '<polymer-element>2' 507 '<polymer-element>2</polymer-element>'
398 '<script type="application/dart" src="s2.dart"></script>'
399 '</polymer-element>'
400 '</body></html>', 508 '</body></html>',
401 'a|web/test_2.html.scriptUrls': 509 'a|web/test_2.html.scriptUrls':
402 '[["a","web/s1.dart"]]', 510 '[["a","web/s1.dart"],["a","web/s2.dart"]]',
403 }); 511 });
404 512
405 testPhases('imports with Dart script after JS script', phases, { 513 testPhases('imports with Dart script after JS script', phases, {
406 'a|web/test.html': 514 'a|web/test.html':
407 '<!DOCTYPE html><html><head>' 515 '<!DOCTYPE html><html><head>'
408 '<link rel="import" href="test_1.html">' 516 '<link rel="import" href="test_1.html">'
409 '</head></html>', 517 '</head></html>',
410 'a|web/test_1.html': 518 'a|web/test_1.html':
411 '<!DOCTYPE html><html><head>' 519 '<!DOCTYPE html><html><head>'
412 '<link rel="import" href="test_1.html">' 520 '<link rel="import" href="test_1.html">'
413 '</head><body>' 521 '</head><body>'
414 '<foo>42</foo><bar-baz></bar-baz>' 522 '<foo>42</foo><bar-baz></bar-baz>'
415 '<polymer-element>1' 523 '<polymer-element>1'
416 '<script src="s1.js"></script>' 524 '<script src="s1.js"></script>'
417 '<script type="application/dart" src="s1.dart"></script>' 525 '<script type="application/dart;component=1" src="s1.dart"></script>'
418 '</polymer-element>' 526 '</polymer-element>'
419 'FOO</body></html>', 527 'FOO</body></html>',
420 }, { 528 }, {
421 'a|web/test.html': 529 'a|web/test.html':
422 '<!DOCTYPE html><html><head>' 530 '<!DOCTYPE html><html><head>'
423 '</head><body>' 531 '</head><body>'
424 '<foo>42</foo><bar-baz></bar-baz>' 532 '<foo>42</foo><bar-baz></bar-baz>'
425 '<polymer-element>1' 533 '<polymer-element>1'
426 '<script src="s1.js"></script>' 534 '<script src="s1.js"></script>'
427 '</polymer-element>' 535 '</polymer-element>'
428 'FOO</body></html>', 536 'FOO</body></html>',
429 'a|web/test.html.scriptUrls': '[["a","web/s1.dart"]]', 537 'a|web/test.html.scriptUrls': '[["a","web/s1.dart"]]',
430 'a|web/test_1.html': 538 'a|web/test_1.html':
431 '<!DOCTYPE html><html><head>' 539 '<!DOCTYPE html><html><head>'
432 '</head><body>' 540 '</head><body>'
433 '<foo>42</foo><bar-baz></bar-baz>' 541 '<foo>42</foo><bar-baz></bar-baz>'
434 '<polymer-element>1' 542 '<polymer-element>1'
435 '<script src="s1.js"></script>' 543 '<script src="s1.js"></script>'
436 '<script type="application/dart" src="s1.dart"></script>'
437 '</polymer-element>' 544 '</polymer-element>'
438 'FOO</body></html>', 545 'FOO</body></html>',
439 'a|web/test_1.html.scriptUrls': '[]', 546 'a|web/test_1.html.scriptUrls': '[["a","web/s1.dart"]]',
440 }); 547 });
441 548
442 testPhases('imports cycle, 2-step lasso', phases, { 549 testPhases('imports cycle, 2-step lasso', phases, {
443 'a|web/test.html': 550 'a|web/test.html':
444 '<!DOCTYPE html><html><head>' 551 '<!DOCTYPE html><html><head>'
445 '<link rel="import" href="test_1.html">' 552 '<link rel="import" href="test_1.html">'
446 '</head></html>', 553 '</head></html>',
447 'a|web/test_1.html': 554 'a|web/test_1.html':
448 '<!DOCTYPE html><html><head>' 555 '<!DOCTYPE html><html><head>'
449 '<link rel="import" href="test_2.html">' 556 '<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>' 809 '<style>h1 { font-size: 70px; }</style>'
703 '<style>.second { color: black }</style>' 810 '<style>.second { color: black }</style>'
704 '</body></html>', 811 '</body></html>',
705 'a|web/test.html.scriptUrls': '[]', 812 'a|web/test.html.scriptUrls': '[]',
706 'a|web/test2.css': 813 'a|web/test2.css':
707 'h1 { font-size: 70px; }', 814 'h1 { font-size: 70px; }',
708 }); 815 });
709 816
710 } 817 }
711 818
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698