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

Unified Diff: LayoutTests/fast/domurl/url-username.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-search-expected.txt ('k') | LayoutTests/fast/domurl/url-username-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: LayoutTests/fast/domurl/url-username.html
diff --git a/LayoutTests/fast/domurl/url-username.html b/LayoutTests/fast/domurl/url-username.html
new file mode 100644
index 0000000000000000000000000000000000000000..6587d0d656ad9eba27a24fb16f5a9acaf42282a7
--- /dev/null
+++ b/LayoutTests/fast/domurl/url-username.html
@@ -0,0 +1,40 @@
+<!DOCTYPE HTML>
+<link rel="help" href="http://url.spec.whatwg.org/#dom-url-username">
+<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.username, '');
+
+ url = new URL('http://user@www.domain.com/');
+ assert_equals(url.username, 'user');
+
+ url.username = 'changed';
+ assert_equals(url.toString(), 'http://changed@www.domain.com/');
+
+ url.username = '';
+ assert_equals(url.toString(), 'http://www.domain.com/');
+}, 'username property');
+
+test(function() {
+ var url = new URL('about:test');
+ assert_equals(url.username, '');
+
+ url.username = 'user';
+ assert_equals(url.username, '');
+ assert_equals(url.toString(), 'about:test');
+}, 'username property on non relative URL');
+
+test(function() {
+ var url = new URL('http://www.domain.com/');
+ url.href = 'invalid';
+ assert_equals(url.username, '');
+
+ url.username = 'changed';
+ assert_equals(url.username, '');
+ assert_equals(url.href, 'invalid');
+}, 'username property invalid URL');
+
+</script>
« no previous file with comments | « LayoutTests/fast/domurl/url-search-expected.txt ('k') | LayoutTests/fast/domurl/url-username-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698