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

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

Issue 336013003: Version 1.5.0-dev.4.14 (Closed) Base URL: http://dart.googlecode.com/svn/trunk/
Patch Set: Created 6 years, 6 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.common; 5 library polymer.test.build.common;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 8
9 import 'package:barback/barback.dart'; 9 import 'package:barback/barback.dart';
10 import 'package:stack_trace/stack_trace.dart'; 10 import 'package:stack_trace/stack_trace.dart';
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 // Ignore info messages. 68 // Ignore info messages.
69 if (entry.level == LogLevel.INFO) return; 69 if (entry.level == LogLevel.INFO) return;
70 if (entry.level == LogLevel.ERROR) errorSeen = true; 70 if (entry.level == LogLevel.ERROR) errorSeen = true;
71 // We only check messages when an expectation is provided. 71 // We only check messages when an expectation is provided.
72 if (messages == null) return; 72 if (messages == null) return;
73 73
74 var msg = '${entry.level.name.toLowerCase()}: ${entry.message}'; 74 var msg = '${entry.level.name.toLowerCase()}: ${entry.message}';
75 var span = entry.span; 75 var span = entry.span;
76 var spanInfo = span == null ? '' : 76 var spanInfo = span == null ? '' :
77 ' (${span.sourceUrl} ${span.start.line} ${span.start.column})'; 77 ' (${span.sourceUrl} ${span.start.line} ${span.start.column})';
78 expect(messagesSeen, lessThan(messages.length), 78 var index = messagesSeen++;
79 expect(messagesSeen, lessThanOrEqualTo(messages.length),
79 reason: 'more messages than expected.\nMessage seen: $msg$spanInfo'); 80 reason: 'more messages than expected.\nMessage seen: $msg$spanInfo');
80 expect('$msg$spanInfo', messages[messagesSeen++]); 81 expect('$msg$spanInfo', messages[index]);
81 }); 82 });
82 } 83 }
83 84
84 void tearDown() { 85 void tearDown() {
85 errorSubscription.cancel(); 86 errorSubscription.cancel();
86 resultSubscription.cancel(); 87 resultSubscription.cancel();
87 logSubscription.cancel(); 88 logSubscription.cancel();
88 } 89 }
89 90
90 /// Tells barback which files have changed, and thus anything that depends on 91 /// Tells barback which files have changed, and thus anything that depends on
(...skipping 20 matching lines...) Expand all
111 return barback.results.first.then((_) { 112 return barback.results.first.then((_) {
112 if (files == null) return null; 113 if (files == null) return null;
113 var futures = []; 114 var futures = [];
114 files.forEach((k, v) { 115 files.forEach((k, v) {
115 futures.add(check(k, v)); 116 futures.add(check(k, v));
116 }); 117 });
117 return Future.wait(futures); 118 return Future.wait(futures);
118 }).then((_) { 119 }).then((_) {
119 // We only check messages when an expectation is provided. 120 // We only check messages when an expectation is provided.
120 if (messages == null) return; 121 if (messages == null) return;
121 expect(messages.length, messagesSeen, 122 expect(messagesSeen, messages.length,
122 reason: 'less messages than expected'); 123 reason: 'less messages than expected');
123 }); 124 });
124 } 125 }
125 } 126 }
126 127
127 testPhases(String testName, List<List<Transformer>> phases, 128 testPhases(String testName, List<List<Transformer>> phases,
128 Map<String, String> inputFiles, Map<String, String> expectedFiles, 129 Map<String, String> inputFiles, Map<String, String> expectedFiles,
129 [List<String> expectedMessages, bool solo = false]) { 130 [List<String> expectedMessages, bool solo = false]) {
130 131
131 // Include mock versions of the polymer library that can be used to test 132 // Include mock versions of the polymer library that can be used to test
(...skipping 21 matching lines...) Expand all
153 const EMPTY_DATA = '{"experimental_bootstrap":false,"script_ids":[]}'; 154 const EMPTY_DATA = '{"experimental_bootstrap":false,"script_ids":[]}';
154 155
155 const WEB_COMPONENTS_TAG = 156 const WEB_COMPONENTS_TAG =
156 '<script src="packages/web_components/platform.js"></script>\n' 157 '<script src="packages/web_components/platform.js"></script>\n'
157 '<script src="packages/web_components/dart_support.js"></script>\n'; 158 '<script src="packages/web_components/dart_support.js"></script>\n';
158 159
159 const INTEROP_TAG = '<script src="packages/browser/interop.js"></script>\n'; 160 const INTEROP_TAG = '<script src="packages/browser/interop.js"></script>\n';
160 const DART_JS_TAG = '<script src="packages/browser/dart.js"></script>'; 161 const DART_JS_TAG = '<script src="packages/browser/dart.js"></script>';
161 162
162 const POLYMER_MOCKS = const { 163 const POLYMER_MOCKS = const {
163 'polymer|lib/polymer.html': '<!DOCTYPE html><html>', 164 'polymer|lib/src/js/polymer/polymer.html': '<!DOCTYPE html><html>',
164 'polymer|lib/polymer_experimental.html': '<!DOCTYPE html><html>', 165 'polymer|lib/polymer.html': '<!DOCTYPE html><html>'
166 '<link rel="import" href="src/js/polymer/polymer.html">',
167 'polymer|lib/polymer_experimental.html':
168 '<!DOCTYPE html><html>'
169 '<link rel="import" href="polymer.html">',
165 'polymer|lib/polymer.dart': 170 'polymer|lib/polymer.dart':
166 'library polymer;\n' 171 'library polymer;\n'
167 'import "dart:html";\n' 172 'import "dart:html";\n'
168 'export "package:observe/observe.dart";\n' // for @observable 173 'export "package:observe/observe.dart";\n' // for @observable
169 'part "src/loader.dart";\n' // for @CustomTag and @initMethod 174 'part "src/loader.dart";\n' // for @CustomTag and @initMethod
170 'part "src/instance.dart";\n', // for @published and @ObserveProperty 175 'part "src/instance.dart";\n', // for @published and @ObserveProperty
171 176
172 'polymer|lib/src/loader.dart': 177 'polymer|lib/src/loader.dart':
173 'part of polymer;\n' 178 'part of polymer;\n'
174 'class CustomTag {\n' 179 'class CustomTag {\n'
(...skipping 18 matching lines...) Expand all
193 198
194 'observe|lib/observe.dart': 199 'observe|lib/observe.dart':
195 'library observe;\n' 200 'library observe;\n'
196 'export "src/metadata.dart";', 201 'export "src/metadata.dart";',
197 202
198 'observe|lib/src/metadata.dart': 203 'observe|lib/src/metadata.dart':
199 'library observe.src.metadata;\n' 204 'library observe.src.metadata;\n'
200 'class ObservableProperty { const ObservableProperty(); }\n' 205 'class ObservableProperty { const ObservableProperty(); }\n'
201 'const observable = const ObservableProperty();\n', 206 'const observable = const ObservableProperty();\n',
202 }; 207 };
OLDNEW
« no previous file with comments | « dart/pkg/polymer/test/build/code_extractor.dart ('k') | dart/pkg/polymer/test/build/import_inliner_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698