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..f05445f6224a934a9f29b0034e45d51ebcdf9289 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/18 08:20:25
I still don't feel 0 is right. If we know nothing
dalmirsilva
2016/03/18 17:20:37
Done.
|
| + "<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,43 @@ public class ContentExtractorTest extends DomDistillerJsTestCase { |
| TestUtil.removeAllDirAttributes(extractedContent)); |
| } |
| + public void testKeepingWidthAndHeightAttributes() { |
| + String html = |
| + "<h1>" + |
| + CONTENT_TEXT + |
| + "</h1>" + |
| + "<p style=\"\">" + |
|
wychen
2016/03/18 08:20:25
Why specifying style?
dalmirsilva
2016/03/18 17:20:37
Done.
|
| + 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\" height=\"0\">" + |
|
wychen
2016/03/18 08:20:25
0 handling.
dalmirsilva
2016/03/18 17:20:37
Done.
|
| + "<img src=\"http://example.com/test.png\" width=\"0\" " + |
| + "height=\"0\">"; |
| + |
| + 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); |