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

Side by Side Diff: tests/html/location_test.dart

Issue 16019002: Merge the dart:uri library into dart:core and update the Uri class (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Final cleanup Created 7 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
« no previous file with comments | « tests/html/form_data_test.dart ('k') | tests/lib/analyzer/analyze_tests.status » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 library LocationTest; 1 library LocationTest;
2 import '../../pkg/unittest/lib/unittest.dart'; 2 import '../../pkg/unittest/lib/unittest.dart';
3 import '../../pkg/unittest/lib/html_config.dart'; 3 import '../../pkg/unittest/lib/html_config.dart';
4 import 'dart:html'; 4 import 'dart:html';
5 import 'dart:uri';
6 5
7 main() { 6 main() {
8 useHtmlConfiguration(); 7 useHtmlConfiguration();
9 8
10 var isLocation = predicate((x) => x is Location, 'is a Location'); 9 var isLocation = predicate((x) => x is Location, 'is a Location');
11 10
12 test('location hash', () { 11 test('location hash', () {
13 final location = window.location; 12 final location = window.location;
14 expect(location, isLocation); 13 expect(location, isLocation);
15 14
16 // The only navigation we dare try is hash. 15 // The only navigation we dare try is hash.
17 location.hash = 'hello'; 16 location.hash = 'hello';
18 var h = location.hash; 17 var h = location.hash;
19 expect(h, '#hello'); 18 expect(h, '#hello');
20 }); 19 });
21 20
22 test('location.origin', () { 21 test('location.origin', () {
23 var origin = window.location.origin; 22 var origin = window.location.origin;
24 23
25 // We build up the origin from Uri, then make sure that it matches. 24 // We build up the origin from Uri, then make sure that it matches.
26 var uri = new Uri(window.location.href); 25 var uri = new Uri(window.location.href);
27 var reconstructedOrigin = '${uri.scheme}://${uri.domain}'; 26 var reconstructedOrigin = '${uri.scheme}://${uri.host}';
28 if (uri.port != 0) { 27 if (uri.port != 0) {
29 reconstructedOrigin = '$reconstructedOrigin:${uri.port}'; 28 reconstructedOrigin = '$reconstructedOrigin:${uri.port}';
30 } 29 }
31 30
32 expect(origin, reconstructedOrigin); 31 expect(origin, reconstructedOrigin);
33 }); 32 });
34 } 33 }
OLDNEW
« no previous file with comments | « tests/html/form_data_test.dart ('k') | tests/lib/analyzer/analyze_tests.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698