Use testRunner instead of layoutTestController in tests still found to be using layou...
[WebKit-https.git] / LayoutTests / fast / harness / user-preferred-language.html
1 <html>
2     <head>
3         <script>
4             
5             if (testRunner)
6                 testRunner.dumpAsText();
7             
8             function test(message, success)
9             {
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);
14             }
15         
16             function runTest()
17             {
18                 var languages = internals.userPreferredLanguages();
19
20                 test('internals.userPreferredLanguages returns a non-empty array', languages.length);
21
22                 languages.unshift("first-language");
23                 languages.push("last-language");
24                 internals.setUserPreferredLanguages(languages);
25
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;
33                         }
34                     }
35                 }
36                 test('internals.userPreferredLanguages is mutable, and returns the same value passed to it', sameContents);
37             }
38         
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>