Upstream version 7.36.149.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / LayoutTests / fast / encoding / api / latin-1.html
1 <!DOCTYPE html>
2 <title>Encoding API: Latin-1 decoders</title>
3 <script src="../../../resources/testharness.js"></script>
4 <script src="../../../resources/testharnessreport.js"></script>
5 <script src="resources/shared.js"></script>
6 <script>
7
8 // Blink uses separate decoder object intances for these encoding aliases,
9 // so test that they are behaving identically.
10
11 test(function() {
12
13     var labels;
14     encodings_table.forEach(function(section) {
15         section.encodings.forEach(function(encoding) {
16             if (encoding.name === 'windows-1252')
17                 labels = encoding.labels;
18         });
19     });
20     labels = labels.filter(function(label) { return label !== 'windows-1252'; });
21
22     var array = new Uint8Array(256);
23     for (var cp = 0; cp <= 255; ++cp) {
24         array[cp] = cp;
25     }
26
27     var windows1252 = new TextDecoder('windows-1252');
28
29     labels.forEach(function(label) {
30         var decoder = new TextDecoder(label);
31         assert_equals(decoder.decode(array), windows1252.decode(array));
32     });
33
34 }, 'Latin-1 decoders (windows-1252, iso-8859-1, us-ascii, etc) decode identically.');
35
36 </script>