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

Unified Diff: javatests/org/chromium/distiller/DomUtilTest.java

Issue 2203563002: Extract image URLs in srcset as well (Closed) Base URL: git@github.com:chromium/dom-distiller.git@master
Patch Set: format Created 4 years, 5 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: javatests/org/chromium/distiller/DomUtilTest.java
diff --git a/javatests/org/chromium/distiller/DomUtilTest.java b/javatests/org/chromium/distiller/DomUtilTest.java
index 85e61cf4e9b055646dd7d0e8aefed26230481181..295e2fe64092e4c5d9a660955807454fe9bdd3e0 100644
--- a/javatests/org/chromium/distiller/DomUtilTest.java
+++ b/javatests/org/chromium/distiller/DomUtilTest.java
@@ -9,6 +9,7 @@ import org.chromium.distiller.webdocument.WebTable;
import com.google.gwt.core.client.JsArray;
import com.google.gwt.dom.client.Document;
import com.google.gwt.dom.client.Element;
+import com.google.gwt.dom.client.ImageElement;
import com.google.gwt.dom.client.Node;
import com.google.gwt.dom.client.NodeList;
@@ -273,6 +274,18 @@ public class DomUtilTest extends DomDistillerJsTestCase {
assertEquals(expected, mBody.getInnerHTML());
}
+ public void testGetSrcSetUrls() {
+ String html =
+ "<img src=\"http://example.com/image\" " +
+ "srcset=\"http://example.com/image200 200w, http://example.com/image400 400w\">";
+
+ mBody.setInnerHTML(html);
+ List<String> list = DomUtil.getSrcSetUrls((ImageElement) mBody.getChild(0));
+ assertEquals(2, list.size());
+ assertEquals("http://example.com/image200", list.get(0));
+ assertEquals("http://example.com/image400", list.get(1));
+ }
+
public void testStripTableBackgroundColorAttributes() {
String tableWithBGColorHTML =
"<table bgcolor=\"red\">" +
« no previous file with comments | « java/org/chromium/distiller/webdocument/WebImage.java ('k') | javatests/org/chromium/distiller/webdocument/WebImageTest.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698