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

Side by Side Diff: chrome/test/data/webui/icon_test.html

Issue 2280853002: Slightly nicer icon.js APIs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 3 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
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <html> 2 <html>
3 <body> 3 <body>
4 <script> 4 <script>
5 5
6 // Test the case where a non-favicon URL is passed. 6 // Test the case where a non-favicon URL is passed.
7 function testGetFaviconImageSet_NonFavicon() { 7 function testGetFavicon_NonFavicon() {
8 var url = 'http://foo.com'; 8 var url = 'http://foo.com';
9 var expectedDesktop = '-webkit-image-set(' + 9 var expectedDesktop = '-webkit-image-set(' +
10 'url("chrome://favicon/size/16@1x/http://foo.com") 1x, ' + 10 'url("chrome://favicon/size/16@1x/http://foo.com") 1x, ' +
11 'url("chrome://favicon/size/16@2x/http://foo.com") 2x)'; 11 'url("chrome://favicon/size/16@2x/http://foo.com") 2x)';
12 var expectedOther = '-webkit-image-set(' + 12 var expectedOther = '-webkit-image-set(' +
13 'url("chrome://favicon/size/16@1x/http://foo.com") ' + 13 'url("chrome://favicon/size/16@1x/http://foo.com") ' +
14 window.devicePixelRatio + 'x)'; 14 window.devicePixelRatio + 'x)';
15 15
16 var isDesktop = cr.isMac || cr.isChromeOS || cr.isWindows || cr.isLinux; 16 var isDesktop = cr.isMac || cr.isChromeOS || cr.isWindows || cr.isLinux;
17 var expected = isDesktop ? expectedDesktop : expectedOther; 17 var expected = isDesktop ? expectedDesktop : expectedOther;
18 assertEquals(expected, cr.icon.getFaviconImageSet(url)); 18 assertEquals(expected, cr.icon.getFavicon(url));
19 } 19 }
20 20
21 // Test the case where the favicon URL is passed. 21 // Test the case where the favicon URL is passed.
22 function testGetFaviconImageSet_IconUrl() { 22 function testGetFavicon_IconUrl() {
23 var url = 'http://foo.com/foo.ico'; 23 var url = 'http://foo.com/foo.ico';
24 var expectedDesktop = '-webkit-image-set(' + 24 var expectedDesktop = '-webkit-image-set(' +
25 'url("chrome://favicon/size/16@1x/iconurl/http://foo.com/foo.ico") 1x, ' + 25 'url("chrome://favicon/size/16@1x/iconurl/http://foo.com/foo.ico") 1x, ' +
26 'url("chrome://favicon/size/16@2x/iconurl/http://foo.com/foo.ico") 2x)'; 26 'url("chrome://favicon/size/16@2x/iconurl/http://foo.com/foo.ico") 2x)';
27 var expectedOther = '-webkit-image-set(' + 27 var expectedOther = '-webkit-image-set(' +
28 'url("chrome://favicon/size/16@1x/iconurl/http://foo.com/foo.ico") ' + 28 'url("chrome://favicon/size/16@1x/iconurl/http://foo.com/foo.ico") ' +
29 window.devicePixelRatio + 'x)'; 29 window.devicePixelRatio + 'x)';
30 30
31 var isDesktop = cr.isMac || cr.isChromeOS || cr.isWindows || cr.isLinux; 31 var isDesktop = cr.isMac || cr.isChromeOS || cr.isWindows || cr.isLinux;
32 var expected = isDesktop ? expectedDesktop : expectedOther; 32 var expected = isDesktop ? expectedDesktop : expectedOther;
33 assertEquals(expected, cr.icon.getFaviconImageSet(url)); 33 assertEquals(expected, cr.icon.getFavicon(url));
34 } 34 }
35 35
36 </script> 36 </script>
37 </body> 37 </body>
38 </html> 38 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698