OLD | NEW |
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 package com.google.dart.compiler.end2end.inc; | 5 package com.google.dart.compiler.end2end.inc; |
6 | 6 |
7 import static com.google.dart.compiler.DartCompiler.EXTENSION_API; | 7 import static com.google.dart.compiler.DartCompiler.EXTENSION_API; |
8 import static com.google.dart.compiler.DartCompiler.EXTENSION_DEPS; | 8 import static com.google.dart.compiler.DartCompiler.EXTENSION_DEPS; |
9 import static com.google.dart.compiler.backend.js.JavascriptBackend.EXTENSION_AP
P_JS; | 9 import static com.google.dart.compiler.backend.js.JavascriptBackend.EXTENSION_AP
P_JS; |
10 import static com.google.dart.compiler.backend.js.JavascriptBackend.EXTENSION_JS
; | 10 import static com.google.dart.compiler.backend.js.JavascriptBackend.EXTENSION_JS
; |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 | 167 |
168 didNotWrite("some.dart", EXTENSION_JS, provider); | 168 didNotWrite("some.dart", EXTENSION_JS, provider); |
169 didNotWrite("some.lib.dart", EXTENSION_API, provider); | 169 didNotWrite("some.lib.dart", EXTENSION_API, provider); |
170 didNotWrite("some.lib.dart", EXTENSION_DEPS, provider); | 170 didNotWrite("some.lib.dart", EXTENSION_DEPS, provider); |
171 | 171 |
172 didNotWrite("myother0.dart", EXTENSION_JS, provider); | 172 didNotWrite("myother0.dart", EXTENSION_JS, provider); |
173 didNotWrite("myother1.dart", EXTENSION_JS, provider); | 173 didNotWrite("myother1.dart", EXTENSION_JS, provider); |
174 didNotWrite("myother2.dart", EXTENSION_JS, provider); | 174 didNotWrite("myother2.dart", EXTENSION_JS, provider); |
175 } | 175 } |
176 | 176 |
| 177 public void testNormalizationTracking() { |
| 178 compile(); |
| 179 |
| 180 provider.resetReadsAndWrites(); |
| 181 myAppSource.touchSource("myother7.dart"); |
| 182 compile(); |
| 183 |
| 184 // Test against normalization having an effect on hashcodes |
| 185 // SomeInterface2 is an empty interface that can have an extra default const
ructor added by |
| 186 // the dartc backend normalization process. By depending on a class that im
plements the interface, |
| 187 // my.app.dart.deps will transitively depend on the empty interface. If som
ething changes |
| 188 // with how hashcodes are generated, this test should be updated. |
| 189 |
| 190 // We just bumped the timestamp on myother7.dart, so only myother7.dart.js a
nd my.app.js should |
| 191 // be changed. At present, the app's deps and api will be rewritten. |
| 192 |
| 193 didWrite("myother7.dart", EXTENSION_JS, provider); |
| 194 didWrite("my.app.dart", EXTENSION_APP_JS, provider); |
| 195 didWrite("my.app.dart", EXTENSION_DEPS, provider); |
| 196 didWrite("my.app.dart", EXTENSION_API, provider); |
| 197 |
| 198 // Nothing else should have changed. |
| 199 didNotWrite("my.dart", EXTENSION_JS, provider); |
| 200 didNotWrite("someimpl.dart", EXTENSION_JS, provider); |
| 201 didNotWrite("someimpl.lib.dart", EXTENSION_API, provider); |
| 202 didNotWrite("someimpl.lib.dart", EXTENSION_DEPS, provider); |
| 203 |
| 204 didNotWrite("some.dart", EXTENSION_JS, provider); |
| 205 didNotWrite("some.lib.dart", EXTENSION_API, provider); |
| 206 didNotWrite("some.lib.dart", EXTENSION_DEPS, provider); |
| 207 |
| 208 didNotWrite("myother0.dart", EXTENSION_JS, provider); |
| 209 didNotWrite("myother1.dart", EXTENSION_JS, provider); |
| 210 didNotWrite("myother2.dart", EXTENSION_JS, provider); |
| 211 } |
| 212 |
177 public void testKnockout_jsArtifact() { | 213 public void testKnockout_jsArtifact() { |
178 compile(); | 214 compile(); |
179 | 215 |
180 provider.resetReadsAndWrites(); | 216 provider.resetReadsAndWrites(); |
181 provider.removeArtifact("my.dart", "", EXTENSION_JS); | 217 provider.removeArtifact("my.dart", "", EXTENSION_JS); |
182 compile(); | 218 compile(); |
183 | 219 |
184 // At present, knocking out a js artifact will force an update of the librar
y's api and | 220 // At present, knocking out a js artifact will force an update of the librar
y's api and |
185 // deps. This could be optimized. | 221 // deps. This could be optimized. |
186 didWrite("my.dart", EXTENSION_JS, provider); | 222 didWrite("my.dart", EXTENSION_JS, provider); |
(...skipping 529 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
716 private void didWrite(String sourceName, String extension, IncMockArtifactProv
ider provider) { | 752 private void didWrite(String sourceName, String extension, IncMockArtifactProv
ider provider) { |
717 String spec = sourceName + "/" + extension; | 753 String spec = sourceName + "/" + extension; |
718 assertTrue("Expected write: " + spec, provider.writes.contains(spec)); | 754 assertTrue("Expected write: " + spec, provider.writes.contains(spec)); |
719 } | 755 } |
720 | 756 |
721 private void didNotWrite(String sourceName, String extension, IncMockArtifactP
rovider provider) { | 757 private void didNotWrite(String sourceName, String extension, IncMockArtifactP
rovider provider) { |
722 String spec = sourceName + "/" + extension; | 758 String spec = sourceName + "/" + extension; |
723 assertFalse("Didn't expect write: " + spec, provider.writes.contains(spec)); | 759 assertFalse("Didn't expect write: " + spec, provider.writes.contains(spec)); |
724 } | 760 } |
725 } | 761 } |
OLD | NEW |