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

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

Issue 1507373003: Clean up attributes of image elements (Closed) Base URL: git@github.com:chromium/dom-distiller.git@master
Patch Set: add todos Created 5 years 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
« no previous file with comments | « javatests/org/chromium/distiller/ContentExtractorTest.java ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: javatests/org/chromium/distiller/DomUtilTest.java
diff --git a/javatests/org/chromium/distiller/DomUtilTest.java b/javatests/org/chromium/distiller/DomUtilTest.java
index a636a5e181f8e99e66ba9ff21716f351d42758b9..53769a20dd48776fc63da642b5f3d66467b1a90f 100644
--- a/javatests/org/chromium/distiller/DomUtilTest.java
+++ b/javatests/org/chromium/distiller/DomUtilTest.java
@@ -248,6 +248,7 @@ public class DomUtilTest extends DomDistillerJsTestCase {
"<html><head><base href=\"http://example.com/\"></head><body>" +
"<a href=\"link\"></a>" +
"<img src=\"image\" srcset=\"image200 200w, image400 400w\">" +
+ "<img src=\"image2\">" +
"<video src=\"video\" poster=\"poster\">" +
"<source src=\"source\">" +
"<track src=\"track\"></track>" +
@@ -258,6 +259,7 @@ public class DomUtilTest extends DomDistillerJsTestCase {
"<a href=\"http://example.com/link\"></a>" +
"<img src=\"http://example.com/image\" " +
"srcset=\"http://example.com/image200 200w, http://example.com/image400 400w\">" +
+ "<img src=\"http://example.com/image2\">" +
"<video src=\"http://example.com/video\" poster=\"http://example.com/poster\">" +
"<source src=\"http://example.com/source\">" +
"<track src=\"http://example.com/track\"></track>" +
@@ -345,4 +347,20 @@ public class DomUtilTest extends DomDistillerJsTestCase {
DomUtil.stripStyleAttributes(mBody);
assertEquals(expected, mBody.getInnerHTML());
}
+
+ public void testStripImageElements() {
+ String html =
+ "<img id=\"a\" alt=\"alt\" dir=\"rtl\" title=\"t\" style=\"typo\" align=\"left\"" +
+ "src=\"image\" class=\"a\" srcset=\"image200 200w\" data-dummy=\"a\">" +
+ "<img mulformed=\"nothing\" data-empty data-dup=\"1\" data-dup=\"2\"" +
+ "src=\"image\" src=\"second\">";
+
+ final String expected =
+ "<img alt=\"alt\" dir=\"rtl\" title=\"t\" src=\"image\" srcset=\"image200 200w\">" +
+ "<img src=\"image\">";
+
+ mBody.setInnerHTML(html);
+ DomUtil.stripImageElements(Node.as(mBody));
+ assertEquals(expected, mBody.getInnerHTML());
+ }
}
« no previous file with comments | « javatests/org/chromium/distiller/ContentExtractorTest.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698