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

Unified 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, 5 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
Index: pkg/polymer/test/build/import_inliner_test.dart
diff --git a/pkg/polymer/test/build/import_inliner_test.dart b/pkg/polymer/test/build/import_inliner_test.dart
index f6daa409ff7a720a50bf6723a0b76aa3e33bcd95..3e7c54c05d840b69a05a663fa2c16d31d19543c0 100644
--- a/pkg/polymer/test/build/import_inliner_test.dart
+++ b/pkg/polymer/test/build/import_inliner_test.dart
@@ -159,6 +159,47 @@ void importTests() {
'a|web/second.js': '/*second*/'
});
+ final cspPhases = [[new ImportInliner(
+ new TransformOptions(contentSecurityPolicy: true))]];
+ testPhases('extract Js scripts in CSP mode', cspPhases,
+ {
+ 'a|web/test.html':
+ '<!DOCTYPE html><html><head>'
+ '<script type="text/javascript">/*first*/</script>'
+ '<script src="second.js"></script>'
+ '<link rel="import" href="test2.html">'
+ '<script type="application/dart">/*fifth*/</script>'
+ '</head></html>',
+ 'a|web/test2.html':
+ '<!DOCTYPE html><html><head><script>/*third*/</script>'
+ '<script type="application/dart">/*forth*/</script>'
+ '</head><body><polymer-element>2</polymer-element></html>',
+ 'a|web/second.js': '/*second*/'
+ }, {
+ 'a|web/test.html':
+ '<!DOCTYPE html><html><head>'
+ '</head><body>'
+ '<script type="text/javascript" src="test.html.0.js"></script>'
+ '<script src="second.js"></script>'
+ '<script src="test.html.2.js"></script>'
+ '<polymer-element>2</polymer-element>'
+ '</body></html>',
+ 'a|web/test.html._data': expectedData([
+ 'web/test.html.3.dart','web/test.html.1.dart']),
+ 'a|web/test.html.3.dart': 'library a.web.test2_html_0;\n/*forth*/',
+ 'a|web/test.html.1.dart': 'library a.web.test_html_0;\n/*fifth*/',
+ 'a|web/test.html.0.js': '/*first*/',
+ 'a|web/test.html.2.js': '/*third*/',
+ 'a|web/test2.html':
+ '<!DOCTYPE html><html><head></head><body>'
+ '<script src="test2.html.0.js"></script>'
+ '<polymer-element>2</polymer-element></body></html>',
+ 'a|web/test2.html._data': expectedData(['web/test2.html.1.dart']),
+ 'a|web/test2.html.0.js': '/*third*/',
+ 'a|web/test2.html.1.dart': 'library a.web.test2_html_0;\n/*forth*/',
+ 'a|web/second.js': '/*second*/'
+ });
+
testPhases('Cleans library names generated from file paths.', phases,
{
'a|web/01_test.html':
@@ -932,4 +973,4 @@ void entryPointTests() {
'<script rel="import" href="../../packages/b/bar/bar.js"></script>'
'</body></html>',
});
-}
+}

Powered by Google App Engine
This is Rietveld 408576698