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

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

Issue 1754213004: Retain image sizes (Closed) Base URL: https://github.com/chromium/dom-distiller.git@master
Patch Set: comments addressed Created 4 years, 9 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/ContentExtractorTest.java
diff --git a/javatests/org/chromium/distiller/ContentExtractorTest.java b/javatests/org/chromium/distiller/ContentExtractorTest.java
index a30c468fdf13e6353eeaed2d1c74a8312a1c5af3..c9d255f448d506f89cc8791779ca853196256de3 100644
--- a/javatests/org/chromium/distiller/ContentExtractorTest.java
+++ b/javatests/org/chromium/distiller/ContentExtractorTest.java
@@ -203,6 +203,42 @@ public class ContentExtractorTest extends DomDistillerJsTestCase {
TestUtil.removeAllDirAttributes(extractedContent));
}
+ public void testKeepingWidthAndHeightAttributes() {
+ String html =
+ "<h1>" +
+ CONTENT_TEXT +
+ "</h1>" +
+ "<p>" +
+ CONTENT_TEXT +
+ "</p>" +
+ "<img style=\"align: left\" src=\"/test.png\" " +
+ "width=\"200\" height=\"300\">" +
+ "<img style=\"align: left\" src=\"/test.png\" " +
+ "width=\"200\">" +
+ "<img style=\"align: left\" src=\"/test.png\">";
+
+ final String expected =
+ "<h1>" +
+ CONTENT_TEXT +
+ "</h1>" +
+ "<p>" +
+ CONTENT_TEXT +
+ "</p>" +
+ "<img src=\"http://example.com/test.png\" " +
+ "width=\"200\" height=\"300\">" +
+ "<img src=\"http://example.com/test.png\" " +
+ "width=\"200\">" +
+ "<img src=\"http://example.com/test.png\">";
+
+ mHead.setInnerHTML("<base href=\"http://example.com/\">");
+ mBody.setInnerHTML(html);
+
+ ContentExtractor extractor = new ContentExtractor(mRoot);
+ String extractedContent = extractor.extractContent();
+ assertEquals(expected,
+ TestUtil.removeAllDirAttributes(extractedContent));
+ }
+
public void testPreserveOrderedList() {
Element outerListTag = Document.get().createElement("OL");
mBody.appendChild(outerListTag);
« no previous file with comments | « java/org/chromium/distiller/webdocument/WebImage.java ('k') | javatests/org/chromium/distiller/EmbedExtractorTest.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698