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

Unified Diff: pkg/polymer/test/build/script_compactor_test.dart

Issue 427623002: Polymer transformer logs now show on the frontend for pub serve. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: added tests for the log widget 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 side-by-side diff with in-line comments
Download patch
Index: pkg/polymer/test/build/script_compactor_test.dart
diff --git a/pkg/polymer/test/build/script_compactor_test.dart b/pkg/polymer/test/build/script_compactor_test.dart
index ba536305d9b90ea31c60c36c2eabe4eac358a444..fbf3e03817d4c904d3e98ad19ffe9a1f8c39c725 100644
--- a/pkg/polymer/test/build/script_compactor_test.dart
+++ b/pkg/polymer/test/build/script_compactor_test.dart
@@ -4,6 +4,8 @@
library polymer.test.build.script_compactor_test;
+import 'dart:convert';
+
import 'package:code_transformers/tests.dart' show testingDartSdkDirectory;
import 'package:polymer/src/build/common.dart';
import 'package:polymer/src/build/script_compactor.dart';
@@ -20,6 +22,7 @@ void main() {
group('initializers', () => initializerTests(phases));
group('experimental', () => initializerTestsExperimental(phases));
group('codegen', () => codegenTests(phases));
+ group('output logs', logOutputTests);
}
initializerTests(phases) {
@@ -1093,3 +1096,63 @@ codegenTests(phases) {
});
}
+void logOutputTests() {
+ final outputLogsPhases = [[new ScriptCompactor(
+ new TransformOptions(injectBuildLogsInOutput: true),
+ sdkDir: testingDartSdkDirectory)]];
+
+ testPhases("logs are output and converted to warnings", outputLogsPhases, {
+ 'a|web/test.html': '<!DOCTYPE html><html><head>',
+ 'a|web/test.html._data': expectedData(['web/a.dart'], experimental: true),
+ 'a|web/a.dart':
+ 'library a;\n'
+ 'import "package:polymer/polymer.broken.import.dart";\n'
+ '@CustomTag("x-foo")\n'
+ 'class XFoo extends PolymerElement {\n}\n'
+ 'main(){}',
+ }, {
+ 'a|web/test.html._buildLogs.1':
+ '[{'
+ '"level":"Warning",'
+ '"message":"$NO_INITIALIZERS_ERROR"'
+ '}]',
+ }, [
+ 'warning: $NO_INITIALIZERS_ERROR',
+ ]);
+
+ testPhases('Injects logging element and styles', outputLogsPhases, {
+ 'a|web/test.html': '<!DOCTYPE html><html><head>',
+ 'a|web/test.html._data': expectedData(['web/a.dart']),
+ 'a|web/a.dart':
+ 'library a;\n'
+ 'import "package:polymer/polymer.dart";\n'
+ 'main(){}',
+ }, {
+ 'a|web/test.html':
+ '<!DOCTYPE html><html><head>'
+ '<link rel="stylesheet" type="text/css" '
+ 'href="packages/polymer/src/build/log_injector.css">'
+ '</head><body>'
+ '<script type="application/dart" '
+ 'src="test.html_bootstrap.dart"></script>'
+ '</body></html>',
+ 'a|web/test.html_bootstrap.dart':
+ '''$MAIN_HEADER
+ import 'a.dart' as i0;
+ import 'package:polymer/src/build/log_injector.dart';
+ ${DEFAULT_IMPORTS.join('\n')}
+
+ void main() {
+ useGeneratedCode(new StaticConfiguration(
+ checkedMode: false));
+ new LogInjector().injectLogs();
+ configureForDeployment([]);
+ i0.main();
+ }
+ '''.replaceAll('\n ', '\n'),
+ 'a|web/a.dart':
+ 'library a;\n'
+ 'import "package:polymer/polymer.dart";\n'
+ 'main(){}',
+ });
+}

Powered by Google App Engine
This is Rietveld 408576698