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

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

Issue 424213004: Fix CSP mode of the polymer compiler. Turns out that inline Javascript <script> (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 4 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 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 'a|web/test.html.1.dart': 'library a.web.test2_html_0;\n/*forth*/', 152 'a|web/test.html.1.dart': 'library a.web.test2_html_0;\n/*forth*/',
153 'a|web/test.html.0.dart': 'library a.web.test_html_0;\n/*fifth*/', 153 'a|web/test.html.0.dart': 'library a.web.test_html_0;\n/*fifth*/',
154 'a|web/test2.html': 154 'a|web/test2.html':
155 '<!DOCTYPE html><html><head></head><body><script>/*third*/</script>' 155 '<!DOCTYPE html><html><head></head><body><script>/*third*/</script>'
156 '<polymer-element>2</polymer-element></body></html>', 156 '<polymer-element>2</polymer-element></body></html>',
157 'a|web/test2.html._data': expectedData(['web/test2.html.0.dart']), 157 'a|web/test2.html._data': expectedData(['web/test2.html.0.dart']),
158 'a|web/test2.html.0.dart': 'library a.web.test2_html_0;\n/*forth*/', 158 'a|web/test2.html.0.dart': 'library a.web.test2_html_0;\n/*forth*/',
159 'a|web/second.js': '/*second*/' 159 'a|web/second.js': '/*second*/'
160 }); 160 });
161 161
162 final cspPhases = [[new ImportInliner(
163 new TransformOptions(contentSecurityPolicy: true))]];
164 testPhases('extract Js scripts in CSP mode', cspPhases,
165 {
166 'a|web/test.html':
167 '<!DOCTYPE html><html><head>'
168 '<script type="text/javascript">/*first*/</script>'
169 '<script src="second.js"></script>'
170 '<link rel="import" href="test2.html">'
171 '<script type="application/dart">/*fifth*/</script>'
172 '</head></html>',
173 'a|web/test2.html':
174 '<!DOCTYPE html><html><head><script>/*third*/</script>'
175 '<script type="application/dart">/*forth*/</script>'
176 '</head><body><polymer-element>2</polymer-element></html>',
177 'a|web/second.js': '/*second*/'
178 }, {
179 'a|web/test.html':
180 '<!DOCTYPE html><html><head>'
181 '</head><body>'
182 '<script type="text/javascript" src="test.html.0.js"></script>'
183 '<script src="second.js"></script>'
184 '<script src="test.html.2.js"></script>'
185 '<polymer-element>2</polymer-element>'
186 '</body></html>',
187 'a|web/test.html._data': expectedData([
188 'web/test.html.3.dart','web/test.html.1.dart']),
189 'a|web/test.html.3.dart': 'library a.web.test2_html_0;\n/*forth*/',
190 'a|web/test.html.1.dart': 'library a.web.test_html_0;\n/*fifth*/',
191 'a|web/test.html.0.js': '/*first*/',
192 'a|web/test.html.2.js': '/*third*/',
193 'a|web/test2.html':
194 '<!DOCTYPE html><html><head></head><body>'
195 '<script src="test2.html.0.js"></script>'
196 '<polymer-element>2</polymer-element></body></html>',
197 'a|web/test2.html._data': expectedData(['web/test2.html.1.dart']),
198 'a|web/test2.html.0.js': '/*third*/',
199 'a|web/test2.html.1.dart': 'library a.web.test2_html_0;\n/*forth*/',
200 'a|web/second.js': '/*second*/'
201 });
202
162 testPhases('Cleans library names generated from file paths.', phases, 203 testPhases('Cleans library names generated from file paths.', phases,
163 { 204 {
164 'a|web/01_test.html': 205 'a|web/01_test.html':
165 '<!DOCTYPE html><html><head>' 206 '<!DOCTYPE html><html><head>'
166 '<script type="application/dart">/*1*/</script>' 207 '<script type="application/dart">/*1*/</script>'
167 '</head></html>', 208 '</head></html>',
168 'a|web/foo_02_test.html': 209 'a|web/foo_02_test.html':
169 '<!DOCTYPE html><html><head>' 210 '<!DOCTYPE html><html><head>'
170 '<script type="application/dart">/*2*/</script>' 211 '<script type="application/dart">/*2*/</script>'
171 '</head></html>', 212 '</head></html>',
(...skipping 753 matching lines...) Expand 10 before | Expand all | Expand 10 after
925 'a|lib/foo/foo.html': 966 'a|lib/foo/foo.html':
926 '<script rel="import" href="../../../packages/b/bar/bar.js"></script>', 967 '<script rel="import" href="../../../packages/b/bar/bar.js"></script>',
927 'b|lib/bar/bar.js': 968 'b|lib/bar/bar.js':
928 'console.log("here");', 969 'console.log("here");',
929 }, { 970 }, {
930 'a|web/test/well/test.html': 971 'a|web/test/well/test.html':
931 '<!DOCTYPE html><html><head></head><body>' 972 '<!DOCTYPE html><html><head></head><body>'
932 '<script rel="import" href="../../packages/b/bar/bar.js"></script>' 973 '<script rel="import" href="../../packages/b/bar/bar.js"></script>'
933 '</body></html>', 974 '</body></html>',
934 }); 975 });
935 } 976 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698