Chromium Code Reviews| Index: tests/utils/uri_test.dart |
| diff --git a/tests/utils/uri_test.dart b/tests/utils/uri_test.dart |
| index ff03d4a35e19747844392b33c32dec047d68db15..d2e959a1ddf938f191424cd2cf27d7501e01f763 100644 |
| --- a/tests/utils/uri_test.dart |
| +++ b/tests/utils/uri_test.dart |
| @@ -106,6 +106,46 @@ main() { |
| Expect.stringEquals("http://a/b/g;p/h;s", |
| base.resolve("../g;p/h;s").toString()); |
| + Expect.stringEquals( |
| + "http://example.com", |
| + new Uri.fromString("http://example.com/a/b/c").origin); |
| + Expect.stringEquals( |
| + "https://example.com", |
| + new Uri.fromString("https://example.com/a/b/c").origin); |
| + Expect.stringEquals( |
| + "http://example.com:1234", |
| + new Uri.fromString("http://example.com:1234/a/b/c").origin); |
| + Expect.stringEquals( |
| + "https://example.com:1234", |
| + new Uri.fromString("https://example.com:1234/a/b/c").origin); |
| + Expect.throws( |
| + () => new Uri.fromString("http:").origin, |
| + (e) { return e is IllegalArgumentException; }, |
| + "origin for uri with empty domain should fail"); |
| + Expect.throws( |
| + () => const Uri("http", null, "", 80, "/a/b/c", |
|
ahe
2012/08/21 20:36:28
You probably need to update this to use fromCompon
|
| + "query", "fragment").origin, |
| + (e) { return e is IllegalArgumentException; }, |
| + "origin for uri with empty domain should fail"); |
| + Expect.throws( |
| + () => const Uri(null, null, "", 80, "/a/b/c", |
| + "query", "fragment").origin, |
| + (e) { return e is IllegalArgumentException; }, |
| + "origin for uri with empty scheme should fail"); |
| + Expect.throws( |
| + () => const Uri("http", null, null, 80, "/a/b/c", |
| + "query", "fragment").origin, |
| + (e) { return e is IllegalArgumentException; }, |
| + "origin for uri with empty domain should fail"); |
| + Expect.throws( |
| + () => new Uri.fromString("http://:80").origin, |
| + (e) { return e is IllegalArgumentException; }, |
| + "origin for uri with empty domain should fail"); |
| + Expect.throws( |
| + () => new Uri.fromString("file://localhost/test.txt").origin, |
| + (e) { return e is IllegalArgumentException; }, |
| + "origin for non-http/https uri should fail"); |
| + |
| // URI encode tests |
| // Note: dart2js won't handle '\ud800\udc00' and frog |
| // won't handle '\u{10000}'. So we cons this up synthetically... |