Chromium Code Reviews| 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..9125faaa106b892b13fd9aa5f5a1e2ae729d62c6 100644 |
| --- a/javatests/org/chromium/distiller/ContentExtractorTest.java |
| +++ b/javatests/org/chromium/distiller/ContentExtractorTest.java |
| @@ -104,8 +104,10 @@ public class ContentExtractorTest extends DomDistillerJsTestCase { |
| final String expected = |
| "<h1>" + CONTENT_TEXT + "</h1>" + |
| "<img src=\"http://example.com/path/image\" " + |
| - "srcset=\"http://example.com/path/image200 200w, http://example.org/image400 400w\">" + |
| - "<img alt=\"b\" src=\"http://example.com/path/image2\">" + |
| + "srcset=\"http://example.com/path/image200 200w, http://example.org/image400 400w\" " + |
| + "width=\"0\" height=\"0\">" + |
|
wychen
2016/03/11 08:25:35
If the dimension is not specified in the source, w
|
| + "<img alt=\"b\" src=\"http://example.com/path/image2\" " + |
| + "width=\"0\" height=\"0\">" + |
| "<table role=\"grid\"><tbody><tr><td>" + |
| "<img alt=\"b\" src=\"http://example.com/image\" " + |
| "srcset=\"https://example.com/image2x 2x, http://example.com/image4x 4x, \">" + |
| @@ -179,7 +181,8 @@ public class ContentExtractorTest extends DomDistillerJsTestCase { |
| "<p>" + |
| CONTENT_TEXT + |
| "</p>" + |
| - "<img src=\"http://example.com/test.png\">" + |
| + "<img src=\"http://example.com/test.png\" " + |
| + "width=\"0\" height=\"0\">" + |
| "<table>" + |
| "<tbody>" + |
| "<tr>" + |
| @@ -203,6 +206,36 @@ public class ContentExtractorTest extends DomDistillerJsTestCase { |
| TestUtil.removeAllDirAttributes(extractedContent)); |
| } |
| + public void testKeepingWidthAndHeightAttributes() { |
| + String html = |
| + "<h1 style=\"font-weight: folder\">" + |
|
wychen
2016/03/11 08:25:35
The padding text can be simplified. We don't need
dalmirsilva
2016/03/14 18:28:06
Done.
|
| + CONTENT_TEXT + |
| + "</h1>" + |
| + "<p style=\"\">" + |
| + CONTENT_TEXT + |
| + "</p>" + |
| + "<img style=\"align: left\" src=\"/test.png\" " + |
| + "width=\"200\" height=\"300\">"; |
| + |
| + final String expected = |
| + "<h1>" + |
| + CONTENT_TEXT + |
| + "</h1>" + |
| + "<p>" + |
| + CONTENT_TEXT + |
| + "</p>" + |
| + "<img src=\"http://example.com/test.png\" " + |
| + "width=\"200\" height=\"300\">"; |
|
wychen
2016/03/11 08:25:35
Maybe another img with only width, and one with ne
dalmirsilva
2016/03/14 18:28:06
Done.
|
| + |
| + 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); |