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

Unified Diff: LayoutTests/fast/domurl/url-origin.html

Issue 24066010: Implement URLUtils and URL interface (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: updates based on code review comments Created 7 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « LayoutTests/fast/domurl/url-href-expected.txt ('k') | LayoutTests/fast/domurl/url-origin-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: LayoutTests/fast/domurl/url-origin.html
diff --git a/LayoutTests/fast/domurl/url-origin.html b/LayoutTests/fast/domurl/url-origin.html
new file mode 100644
index 0000000000000000000000000000000000000000..536e03fdb1e73839a6adba202018d191c5605ec5
--- /dev/null
+++ b/LayoutTests/fast/domurl/url-origin.html
@@ -0,0 +1,36 @@
+<!DOCTYPE HTML>
+<link rel="help" href="http://url.spec.whatwg.org/#dom-url-origin">
+<script src="../../resources/testharness.js"></script>
+<script src="../../resources/testharnessreport.js"></script>
+<script>
+
+function assertOrigin(url, expectedOrigin) {
+ var url = new URL(url);
+ assert_equals(url.origin, expectedOrigin);
+}
+
+test(function() {
+ assertOrigin('http://example.com/foo/bar', 'http://example.com');
+ assertOrigin('HTTP://example.com/foo/bar', 'http://example.com');
+ assertOrigin('https://example.com/ttt?ggg', 'https://example.com');
+ assertOrigin('ftp://example.com/ttt?ggg', 'ftp://example.com');
+ assertOrigin('file:///home/abarth', 'file://');
+
+ // The following are implementation specific.
+ assertOrigin('data:text/html,<b>foo</b>', 'null');
+ assertOrigin('about:blank', 'null');
+}, 'origin property');
+
+test(function() {
+ var url = new URL('http://www.domain.com/');
+ url.origin = 'changed'; // readonly
+ assert_equals(url.origin, 'http://www.domain.com');
+}, 'origin property is readonly');
+
+test(function() {
+ var url = new URL('http://www.domain.com/');
+ url.href = 'invalid';
+ assert_equals(url.origin, '');
+}, 'origin property invalid URL');
+
+</script>
« no previous file with comments | « LayoutTests/fast/domurl/url-href-expected.txt ('k') | LayoutTests/fast/domurl/url-origin-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698