Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / dom / icon-url-list.html
blob2e95d7b6127c4c825548087382e4ad2f4c19c149
1 <html>
2 <head>
3 <title>Original Title</title>
4 <link rel="shortcut icon" type="image/x-icon" href="http://test.com/oldfavicon.ico"/>
5 <link rel="shortcut icon" type="image/x-icon" href="http://test.com/foofavicon.ico"/>
6 <link rel="shortcut icon" type="image/x-icon" href="http://test.com/barfavicon.ico"/>
7 <script src="../../resources/js-test.js"></script>
8 <script>
10 function setFavIcon(iconURL) {
11 var docHead = document.getElementsByTagName("head")[0];
13 // set up a new node for the new iconURL
14 var newLink = document.createElement("link");
15 newLink.type = "image/x-icon";
16 newLink.rel = "shortcut icon";
17 newLink.href = iconURL;
19 var links = docHead.getElementsByTagName("link");
20 for (var i = 0; i < links.length; ++i) {
21 var oldLink = links[i];
22 if (oldLink.type=="image/x-icon" && oldLink.rel=="shortcut icon") {
23 // if we find the child, replace it with the new node.
24 docHead.replaceChild(newLink, oldLink);
25 return; // Assuming only one match at most.
29 // if we didn't find the icon URL link, add it now.
30 docHead.appendChild(newLink);
33 function runTests() {
34 if (window.testRunner)
35 testRunner.dumpAsText();
37 iconURL = document.getElementsByTagName("link")[0].href;
38 debug('Original iconURL is: ' + iconURL);
40 // change icon to new icon
41 newURL = 'http://test.com/newfavicon.ico';
42 debug('Setting new icon URL to: ' + newURL);
43 setFavIcon(newURL);
44 iconURL = document.getElementsByTagName("link")[0].href
45 debug('New iconURL is: ' + iconURL);
47 // check that the URL list in the document is as we expect
48 var expectedURL0 = "http://test.com/barfavicon.ico";
49 var expectedURL1 = "http://test.com/foofavicon.ico";
50 var expectedURL2 = "http://test.com/newfavicon.ico";
51 var iconURLs = window.internals.shortcutIconURLs(document);
52 if (expectedURL0 == iconURLs[0] && expectedURL1 == iconURLs[1] && expectedURL2 == iconURLs[2])
53 testPassed('URL list matches expected');
54 else
55 testFailed('URL list does not match expected');
58 </script>
59 </head>
60 <body onload='runTests();'>
61 </div>
62 </body>
63 </html>