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

Side by Side Diff: LayoutTests/fast/encoding/api/base64.html

Issue 143943017: Added Base64 support in TextEncoder and TextDecoder. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 11 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 unified diff | Download patch
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <script src="../../../resources/js-test.js"></script>
3 <script src="resources/shared.js"></script>
4 <script>
5
6 description("Verify Base64 encoding/decoding");
jsbell 2014/01/24 22:15:05 Need a streaming encode and streaming decode test.
7
8 string = 'AQIzh6L+';
9 decoded = null;
jsbell 2014/01/24 22:15:05 No need to initialize vars to null that will be as
10 bytes = [0x01, 0x02, 0x33, 0x87, 0xA2, 0xFE];
11
12 decoder = null;
13 evalAndLog("decoder = new TextDecoder(" + JSON.stringify('base64') + ")");
jsbell 2014/01/24 22:15:05 Can you add a comment (or debug("...") line) that
14 if (decoder) {
jsbell 2014/01/24 22:15:05 No need for this if() block.
15 evalAndLog("decoded = decoder.decode(new Uint8Array(bytes))");
16 // encodeURIComponent ensures output is printable
17 shouldBe("encodeURIComponent(string)", "encodeURIComponent(decoded)");
18 }
19
20 encoder = null;
21 encoded = null;
22 evalAndLog("encoder = new TextEncoder(" + JSON.stringify('base64') + ")");
jsbell 2014/01/24 22:15:05 ... and can you add a comment about the reverse he
23 if (encoder) {
jsbell 2014/01/24 22:15:05 No need for this if() block.
24 evalAndLog("encoded = encoder.encode(string)");
25 shouldBeTrue("encoded.length === bytes.length");
jsbell 2014/01/24 22:15:05 This and the rest of the test can just use areArra
26 if (encoded.length != bytes.length) {
27 return;
28 }
29 for (var i = 0; i < bytes.length; i++) {
30 shouldBeTrue("encoded[i] === bytes[i]");
31 }
32 }
33
34 </script>
OLDNEW
« no previous file with comments | « no previous file | LayoutTests/fast/encoding/api/base64-expected.txt » ('j') | Source/wtf/text/TextCodecBase64.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698