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

Unified Diff: LayoutTests/fast/dom/Window/atob-btoa.html

Issue 58143002: WindowBase64::atob() does not remove space characters from input (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fix nits Created 7 years, 1 month 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 | « no previous file | LayoutTests/fast/dom/Window/atob-btoa-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: LayoutTests/fast/dom/Window/atob-btoa.html
diff --git a/LayoutTests/fast/dom/Window/atob-btoa.html b/LayoutTests/fast/dom/Window/atob-btoa.html
index fb4c0b783093e341c9dcfc66dae8ebff7f1bb917..5eb80d409256b1c45dab7ca73a3e636761fb2864 100644
--- a/LayoutTests/fast/dom/Window/atob-btoa.html
+++ b/LayoutTests/fast/dom/Window/atob-btoa.html
@@ -5,52 +5,64 @@
</head>
<body>
<script>
-shouldBe('window.atob("YQ==")', '"a"');
-shouldBe('window.atob("YWI=")', '"ab"');
-shouldBe('window.atob("YWJj")', '"abc"');
-shouldBe('window.atob("YWJjZA==")', '"abcd"');
-shouldBe('window.atob("YWJjZGU=")', '"abcde"');
-shouldBe('window.atob("YWJjZGVm")', '"abcdef"');
-shouldBe('window.btoa("a")', '"YQ=="');
-shouldBe('window.btoa("ab")', '"YWI="');
-shouldBe('window.btoa("abc")', '"YWJj"');
-shouldBe('window.btoa("abcd")', '"YWJjZA=="');
-shouldBe('window.btoa("abcde")', '"YWJjZGU="');
-shouldBe('window.btoa("abcdef")', '"YWJjZGVm"');
+shouldBeEqualToString('window.atob("YQ==")', 'a');
+shouldBeEqualToString('window.atob("YWI=")', 'ab');
+shouldBeEqualToString('window.atob("YWJj")', 'abc');
+shouldBeEqualToString('window.atob("YWJjZA==")', 'abcd');
+shouldBeEqualToString('window.atob("YWJjZGU=")', 'abcde');
+shouldBeEqualToString('window.atob("YWJjZGVm")', 'abcdef');
-shouldBe('typeof window.btoa', '"function"');
+shouldBeEqualToString('window.btoa("a")', 'YQ==');
+shouldBeEqualToString('window.btoa("ab")', 'YWI=');
+shouldBeEqualToString('window.btoa("abc")', 'YWJj');
+shouldBeEqualToString('window.btoa("abcd")', 'YWJjZA==');
+shouldBeEqualToString('window.btoa("abcde")', 'YWJjZGU=');
+shouldBeEqualToString('window.btoa("abcdef")', 'YWJjZGVm');
+
+shouldBeEqualToString('typeof window.btoa', 'function');
shouldThrow('window.btoa()', '"TypeError: Failed to execute \'btoa\' on \'Window\': 1 argument required, but only 0 present."');
-shouldBe('window.btoa("")', '""');
-shouldBe('window.btoa(null)', '"bnVsbA=="'); // Gets converted to "null" string.
-shouldBe('window.btoa(undefined)', '"dW5kZWZpbmVk"');
-shouldBe('window.btoa(window)', '"W29iamVjdCBXaW5kb3dd"'); // "[object Window]"
-shouldBe('window.btoa("éé")', '"6ek="');
-shouldBe('window.btoa("\\u0080\\u0081")', '"gIE="');
+shouldBeEqualToString('window.btoa("")', '');
+shouldBeEqualToString('window.btoa(null)', 'bnVsbA=='); // Gets converted to "null" string.
+shouldBeEqualToString('window.btoa(undefined)', 'dW5kZWZpbmVk');
+shouldBeEqualToString('window.btoa(window)', 'W29iamVjdCBXaW5kb3dd'); // "[object Window]"
+shouldBeEqualToString('window.btoa("éé")', '6ek=');
+shouldBeEqualToString('window.btoa("\\u0080\\u0081")', 'gIE=');
shouldThrow('window.btoa("тест")');
window.btoa = 0;
shouldBe('window.btoa', '0');
-shouldBe('typeof window.btoa', '"number"');
+shouldBeEqualToString('typeof window.btoa', 'number');
-shouldBe('typeof window.atob', '"function"');
+shouldBeEqualToString('typeof window.atob', 'function');
shouldThrow('window.atob()', '"TypeError: Failed to execute \'atob\' on \'Window\': 1 argument required, but only 0 present."');
-shouldBe('window.atob("")', '""');
-shouldBe('window.atob(null)', '"\x9Eée"'); // Gets converted to "null" string.
+shouldBeEqualToString('window.atob("")', '');
+shouldBeEqualToString('window.atob(null)', '\x9Eée'); // Gets converted to "null" string.
shouldThrow('window.atob(undefined)');
-shouldThrow('window.atob(" YQ==")');
-shouldThrow('window.atob("YQ==\\u000a")');
-shouldBe('window.atob("6ek=")', '"éé"');
-shouldBe('window.atob("6ek")', '"éé"');
-shouldBe('window.atob("gIE=")', '"\u0080\u0081"');
+
+// HTML space characters in input.
+shouldBeEqualToString('window.atob(" YQ==")', 'a');
+shouldBeEqualToString('window.atob("YQ== ")', 'a');
+shouldBeEqualToString('window.atob("YQ== ")', 'a');
+shouldBeEqualToString('window.atob("YQ==\\u000a")', 'a');
+shouldBeEqualToString('window.atob("YQ ==")', 'a');
+shouldBeEqualToString('window.atob("YQ\\t==")', 'a');
+shouldBeEqualToString('window.atob("YQ\\n==")', 'a');
+shouldBeEqualToString('window.atob("YQ\\f==")', 'a');
+shouldBeEqualToString('window.atob("YQ\\r==")', 'a');
+shouldBeEqualToString('window.atob("YQ\\t\\n\\f\\r ==")', 'a');
+
+shouldBeEqualToString('window.atob("6ek=")', 'éé');
+shouldBeEqualToString('window.atob("6ek")', 'éé');
+shouldBeEqualToString('window.atob("gIE=")', '\u0080\u0081');
shouldThrow('window.atob("тест")');
shouldThrow('window.atob("z")');
-shouldBe('window.atob("zz")', '"Ï"');
-shouldBe('window.atob("zzz")', '"Ï\u003C"');
-shouldBe('window.atob("zzz=")', '"Ï\u003C"');
+shouldBeEqualToString('window.atob("zz")', 'Ï');
+shouldBeEqualToString('window.atob("zzz")', 'Ï\u003C');
+shouldBeEqualToString('window.atob("zzz=")', 'Ï\u003C');
shouldThrow('window.atob("zzz==")'); // excess pad characters.
shouldThrow('window.atob("zzz===")'); // excess pad characters.
shouldThrow('window.atob("zzz====")'); // excess pad characters.
shouldThrow('window.atob("zzz=====")'); // excess pad characters.
-shouldBe('window.atob("zzzz")', '"Ï\u003Có"');
+shouldBeEqualToString('window.atob("zzzz")', 'Ï\u003Có');
shouldThrow('window.atob("zzzzz")');
shouldThrow('window.atob("z=zz")');
shouldThrow('window.atob("=")');
@@ -60,7 +72,7 @@ shouldThrow('window.atob("====")');
shouldThrow('window.atob("=====")');
window.atob = 0;
shouldBe('window.atob', '0');
-shouldBe('typeof window.atob', '"number"');
+shouldBeEqualToString('typeof window.atob', 'number');
</script>
</body>
« no previous file with comments | « no previous file | LayoutTests/fast/dom/Window/atob-btoa-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698