Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / harness / user-preferred-language.html
blob5da6a140bf3146d08988d800a8a07fabb384b47f
1 <html>
2 <head>
3 <script>
5 if (testRunner)
6 testRunner.dumpAsText();
8 function test(message, success)
10 var li = document.createElement("li");
11 var text = document.createTextNode(message + ': ' + (success ? 'PASS' : 'FAIL'));
12 li.appendChild(text);
13 document.getElementById("console").appendChild(li);
16 function runTest()
18 var languages = internals.userPreferredLanguages();
20 test('internals.userPreferredLanguages returns a non-empty array', languages.length);
22 languages.unshift("first-language");
23 languages.push("last-language");
24 internals.setUserPreferredLanguages(languages);
26 var newLanguages = internals.userPreferredLanguages();
27 var sameContents = newLanguages.length == languages.length;
28 if (sameContents) {
29 for (var i = 0; i < newLanguages.length; i++) {
30 if (newLanguages[i] != languages[i]) {
31 sameContents = false;
32 break;
36 test('internals.userPreferredLanguages is mutable, and returns the same value passed to it', sameContents);
39 </script>
40 </head>
41 <body onload="runTest()">
42 <p>This test verifies that internals.userPreferredLanguages returns a mutable Array of the user's preferred languages.</p>
43 <ul id="console"></ul>
44 </body>
45 </html>