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

Unified Diff: chrome/test/data/webui/util_test.html

Issue 1914073005: Make getFaviconImageSet work with all expected URL types. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: case insensitive Created 4 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: chrome/test/data/webui/util_test.html
diff --git a/chrome/test/data/webui/util_test.html b/chrome/test/data/webui/util_test.html
index 0c8c4eabf43456b81243084ea5de692a6e0c649b..a93b48f89375fc2dcf6befdc8cc99c3c6fde8346 100644
--- a/chrome/test/data/webui/util_test.html
+++ b/chrome/test/data/webui/util_test.html
@@ -20,6 +20,36 @@ function testQuoteString() {
assertEquals(null, match);
}
+// Test the case where the origin URL is passed.
+function testGetFaviconImageSet_Origin() {
+ var url = 'http://foo.com';
+ var expectedDesktop = '-webkit-image-set(' +
+ 'url("chrome://favicon/size/16@1x/origin/http://foo.com") 1x, ' +
+ 'url("chrome://favicon/size/16@2x/origin/http://foo.com") 2x)';
+ var expectedOther = '-webkit-image-set(' +
+ 'url("chrome://favicon/size/16@1x/origin/http://foo.com") ' +
+ window.devicePixelRatio + 'x)';
+
+ var isDesktop = cr.isMac || cr.isChromeOS || cr.isWindows || cr.isLinux;
+ var expected = isDesktop ? expectedDesktop : expectedOther;
+ assertEquals(expected, getFaviconImageSet(url));
+}
+
+// Test the case where the favicon URL is passed.
+function testGetFaviconImageSet_IconUrl() {
+ var url = 'http://foo.com/foo.ico';
+ var expectedDesktop = '-webkit-image-set(' +
+ 'url("chrome://favicon/size/16@1x/iconurl/http://foo.com/foo.ico") 1x, ' +
+ 'url("chrome://favicon/size/16@2x/iconurl/http://foo.com/foo.ico") 2x)';
+ var expectedOther = '-webkit-image-set(' +
+ 'url("chrome://favicon/size/16@1x/iconurl/http://foo.com/foo.ico") ' +
+ window.devicePixelRatio + 'x)';
+
+ var isDesktop = cr.isMac || cr.isChromeOS || cr.isWindows || cr.isLinux;
+ var expected = isDesktop ? expectedDesktop : expectedOther;
+ assertEquals(expected, getFaviconImageSet(url));
+}
+
</script>
</body>
</html>

Powered by Google App Engine
This is Rietveld 408576698