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

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

Issue 180373003: [polymer] switch comment style (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 10 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';
11 import 'package:unittest/unittest.dart'; 11 import 'package:unittest/unittest.dart';
12 12
13 String idToString(AssetId id) => '${id.package}|${id.path}'; 13 String idToString(AssetId id) => '${id.package}|${id.path}';
14 AssetId idFromString(String s) { 14 AssetId idFromString(String s) {
15 int index = s.indexOf('|'); 15 int index = s.indexOf('|');
16 return new AssetId(s.substring(0, index), s.substring(index + 1)); 16 return new AssetId(s.substring(0, index), s.substring(index + 1));
17 } 17 }
18 18
19 String _removeTrailingWhitespace(String str) => 19 String _removeTrailingWhitespace(String str) =>
20 str.splitMapJoin('\n', 20 str.splitMapJoin('\n',
21 onNonMatch: (s) => s.replaceAll(new RegExp(r'\s+$'), '')); 21 onNonMatch: (s) => s.replaceAll(new RegExp(r'\s+$'), ''));
22 22
23 /** 23 /// A helper package provider that has files stored in memory, also wraps
24 * A helper package provider that has files stored in memory, also wraps 24 /// [Barback] to simply our tests.
25 * [Barback] to simply our tests.
26 */
27 class TestHelper implements PackageProvider { 25 class TestHelper implements PackageProvider {
28 /** 26 /// Maps from an asset string identifier of the form 'package|path' to the
29 * Maps from an asset string identifier of the form 'package|path' to the 27 /// file contents.
30 * file contents.
31 */
32 final Map<String, String> files; 28 final Map<String, String> files;
33 final Iterable<String> packages; 29 final Iterable<String> packages;
34 final List<String> messages; 30 final List<String> messages;
35 int messagesSeen = 0; 31 int messagesSeen = 0;
36 bool errorSeen = false; 32 bool errorSeen = false;
37 33
38 Barback barback; 34 Barback barback;
39 var errorSubscription; 35 var errorSubscription;
40 var resultSubscription; 36 var resultSubscription;
41 var logSubscription; 37 var logSubscription;
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 expect('$msg$spanInfo', messages[messagesSeen++]); 77 expect('$msg$spanInfo', messages[messagesSeen++]);
82 }); 78 });
83 } 79 }
84 80
85 void tearDown() { 81 void tearDown() {
86 errorSubscription.cancel(); 82 errorSubscription.cancel();
87 resultSubscription.cancel(); 83 resultSubscription.cancel();
88 logSubscription.cancel(); 84 logSubscription.cancel();
89 } 85 }
90 86
91 /** 87 /// Tells barback which files have changed, and thus anything that depends on
92 * Tells barback which files have changed, and thus anything that depends on 88 /// it on should be computed. By default mark all the input files.
93 * it on should be computed. By default mark all the input files.
94 */
95 void run([Iterable<String> paths]) { 89 void run([Iterable<String> paths]) {
96 if (paths == null) paths = files.keys; 90 if (paths == null) paths = files.keys;
97 barback.updateSources(paths.map(idFromString)); 91 barback.updateSources(paths.map(idFromString));
98 } 92 }
99 93
100 Future<String> operator [](String assetString){ 94 Future<String> operator [](String assetString){
101 return barback.getAssetById(idFromString(assetString)) 95 return barback.getAssetById(idFromString(assetString))
102 .then((asset) => asset.readAsString()); 96 .then((asset) => asset.readAsString());
103 } 97 }
104 98
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 }); 130 });
137 } 131 }
138 132
139 const WEB_COMPONENTS_TAG = 133 const WEB_COMPONENTS_TAG =
140 '<script src="packages/web_components/platform.js"></script>\n' 134 '<script src="packages/web_components/platform.js"></script>\n'
141 '<script src="packages/web_components/dart_support.js"></script>\n'; 135 '<script src="packages/web_components/dart_support.js"></script>\n';
142 136
143 const INTEROP_TAG = '<script src="packages/browser/interop.js"></script>\n'; 137 const INTEROP_TAG = '<script src="packages/browser/interop.js"></script>\n';
144 const DART_JS_TAG = '<script src="packages/browser/dart.js"></script>'; 138 const DART_JS_TAG = '<script src="packages/browser/dart.js"></script>';
145 139
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698