| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 /// Tests how canonicalization works when using the deployed app. | 5 /// Tests how canonicalization works when using the deployed app. This is |
| 6 library canonicalization.bad_lib_import_negative; | 6 /// identical to the code in ../dir/deploy_common.dart but we need to copy it |
| 7 /// here because the 'packages/...' URLs below should be relative from the |
| 8 /// entrypoint directory. |
| 9 library canonicalization.test.dir.deploy_common; |
| 7 | 10 |
| 8 import 'package:unittest/unittest.dart'; | 11 import 'package:unittest/unittest.dart'; |
| 9 import 'package:unittest/html_config.dart'; | 12 import 'package:unittest/html_config.dart'; |
| 10 import 'package:polymer/polymer.dart'; | 13 import 'package:polymer/polymer.dart'; |
| 11 | 14 |
| 12 import 'package:canonicalization2/a.dart'; | 15 import 'package:canonicalization/a.dart' show a; |
| 13 import 'packages/canonicalization2/b.dart'; | 16 import 'packages/canonicalization/b.dart' show b; |
| 14 import 'package:canonicalization2/c.dart'; | 17 import 'package:canonicalization/c.dart' show c; |
| 15 import 'package:canonicalization2/d.dart' as d1; | 18 import 'package:canonicalization/d.dart' as d1 show d; |
| 16 import 'packages/canonicalization2/d.dart' as d2; | 19 import 'packages/canonicalization/d.dart' as d2 show d; |
| 17 | 20 |
| 18 @initMethod | |
| 19 main() { | 21 main() { |
| 22 initPolymer(); |
| 20 useHtmlConfiguration(); | 23 useHtmlConfiguration(); |
| 21 | 24 |
| 22 setUp(() => Polymer.onReady); | 25 setUp(() => Polymer.onReady); |
| 23 | 26 |
| 24 test('canonicalization', () { | 27 test('canonicalization', () { |
| 25 // "package:" urls work the same during development and deployment | |
| 26 expect(a, 1, reason: | 28 expect(a, 1, reason: |
| 27 'deploy picks the "package:" url as the canonical url for script tags.'); | 29 'deploy picks the "package:" url as the canonical url for script tags.'); |
| 28 | 30 |
| 29 // relative urls do not. true, we shouldn't be using 'packages/' above, so | 31 // We shouldn't be using 'packages/' above, so that's ok. |
| 30 // that's ok. | |
| 31 expect(b, 0, reason: | 32 expect(b, 0, reason: |
| 32 'deploy picks the "package:" url as the canonical url for script tags.'); | 33 'we pick the "package:" url as the canonical url for script tags.'); |
| 33 expect(c, 2, reason: 'c was always imported with "package:" urls.'); | 34 expect(c, 2, reason: 'c was always imported with "package:" urls.'); |
| 34 expect(d1.d, 2, reason: 'both a and b are loaded using package: urls'); | 35 expect(d1.d, 2, reason: 'both a and b are loaded using package: urls'); |
| 35 | |
| 36 // same here | |
| 37 expect(d2.d, 0, reason: 'both a and b are loaded using package: urls'); | 36 expect(d2.d, 0, reason: 'both a and b are loaded using package: urls'); |
| 38 }); | 37 }); |
| 39 } | 38 } |
| OLD | NEW |