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

Unified Diff: LayoutTests/fast/dom/DOMURL/url-password.html

Issue 24066010: Implement URLUtils and URL interface (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: git rebase 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
Index: LayoutTests/fast/dom/DOMURL/url-password.html
diff --git a/LayoutTests/fast/dom/DOMURL/url-password.html b/LayoutTests/fast/dom/DOMURL/url-password.html
new file mode 100644
index 0000000000000000000000000000000000000000..fc7aa1327011051b3a9eb09b49801f699eddc9d4
--- /dev/null
+++ b/LayoutTests/fast/dom/DOMURL/url-password.html
@@ -0,0 +1,40 @@
+<!DOCTYPE HTML>
+<link rel="help" href="http://url.spec.whatwg.org/#dom-url-password">
+<script src="../../../resources/testharness.js"></script>
+<script src="../../../resources/testharnessreport.js"></script>
+<script>
+
+test(function() {
+ var url = new URL('http://www.domain.com/');
+ assert_equals(url.password, '');
+
+ url = new URL('http://user:pass@www.domain.com/');
+ assert_equals(url.password, 'pass');
+
+ url.password = 'changed';
+ assert_equals(url.toString(), 'http://user:changed@www.domain.com/');
+
+ url.password = '';
+ assert_equals(url.toString(), 'http://user@www.domain.com/');
+}, 'password property');
+
+test(function() {
+ var url = new URL('about:test');
+ assert_equals(url.password, '');
+
+ url.password = 'pass';
+ assert_equals(url.password, '');
+ assert_equals(url.toString(), 'about:test');
+}, 'password property on non relative URL');
+
+test(function() {
+ var url = new URL('http://www.domain.com/');
+ url.href = 'invalid';
+ assert_equals(url.password, '');
+
+ url.password = 'pass';
+ assert_equals(url.password, '');
+ assert_equals(url.href, 'invalid');
+}, 'password property invalid URL');
+
+</script>

Powered by Google App Engine
This is Rietveld 408576698