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 0b03d6a9dd95b2177f5233aaa61e93beb6229ef7..c3e6bcdddbe9018588f7641e448375f6081faefc 100644 |
| --- a/javatests/org/chromium/distiller/ContentExtractorTest.java |
| +++ b/javatests/org/chromium/distiller/ContentExtractorTest.java |
| @@ -86,14 +86,17 @@ public class ContentExtractorTest extends DomDistillerJsTestCase { |
| MARKUP_PARSER_TITLE, extractor.extractTitle()); |
| } |
| - public void testImageWithSrcset() { |
| + public void testImage() { |
| // Test the absolute and different kinds of relative URLs for image sources, |
| // and also add an extra comma (,) as malformed srcset syntax for robustness. |
| + // Also test images in WebImage, WebText, and WebTable. |
|
wychen
2015/12/09 05:17:40
TODO(wychen): how do I get images inside a WebText
mdjones
2015/12/09 17:40:16
This is an unsolved problem. Since tables are curr
|
| final String html = |
| "<h1>" + CONTENT_TEXT + "</h1>" + |
| - "<img src=\"image\" srcset=\"image200 200w, //example.org/image400 400w\">" + |
| + "<img id=\"a\" style=\"a\" align=\"left\" src=\"image\" srcset=\"image200 200w, //example.org/image400 400w\">" + |
| + "<img id=\"a\" style=\"a\" align=\"left\" src=\"image2\">" + |
| "<table role=\"grid\"><tbody><tr><td>" + |
| - "<img src=\"/image\" srcset=\"https://example.com/image2x 2x, /image4x 4x,\">" + |
| + "<img id=\"a\" style=\"a\" align=\"left\" src=\"/image\" srcset=\"https://example.com/image2x 2x, /image4x 4x,\">" + |
| + "<img id=\"a\" style=\"a\" align=\"left\" src=\"/image2\">" + |
| "</td></tr></tbody></table>" + |
| "<p>" + CONTENT_TEXT + "</p>"; |
| @@ -101,9 +104,11 @@ public class ContentExtractorTest extends DomDistillerJsTestCase { |
| "<h1>" + CONTENT_TEXT + "</h1>" + |
| "<img src=\"http://example.com/path/image\" " + |
| "srcset=\"http://example.com/path/image200 200w, http://example.org/image400 400w\">" + |
| + "<img src=\"http://example.com/path/image2\">" + |
| "<table role=\"grid\"><tbody><tr><td>" + |
| "<img src=\"http://example.com/image\" " + |
| "srcset=\"https://example.com/image2x 2x, http://example.com/image4x 4x, \">" + |
| + "<img src=\"http://example.com/image2\">" + |
| "</td></tr></tbody></table>" + |
| "<p>" + CONTENT_TEXT + "</p>"; |
| @@ -151,10 +156,13 @@ public class ContentExtractorTest extends DomDistillerJsTestCase { |
| "<p style=\"\">" + |
| CONTENT_TEXT + |
| "</p>" + |
| + "<img style=\"align: left\" src=\"/test.png\">" + |
| "<table style=\"position: absolute\">" + |
| "<tbody style=\"font-size: 2\">" + |
| "<tr style=\"z-index: 0\">" + |
| - "<th style=\"top: 0px\">" + CONTENT_TEXT + "</th>" + |
| + "<th style=\"top: 0px\">" + CONTENT_TEXT + |
| + "<img style=\"align: left\" src=\"/test.png\">" + |
| + "</th>" + |
| "<th style=\"width: 20px\">" + CONTENT_TEXT + "</th>" + |
| "</tr><tr style=\"left: 0\">" + |
| "<td style=\"display: block\">" + CONTENT_TEXT + "</td>" + |
| @@ -170,10 +178,13 @@ public class ContentExtractorTest extends DomDistillerJsTestCase { |
| "<p>" + |
| CONTENT_TEXT + |
| "</p>" + |
| + "<img src=\"http://example.com/test.png\">" + |
| "<table>" + |
| "<tbody>" + |
| "<tr>" + |
| - "<th>" + CONTENT_TEXT + "</th>" + |
| + "<th>" + CONTENT_TEXT + |
| + "<img src=\"http://example.com/test.png\">" + |
| + "</th>" + |
| "<th>" + CONTENT_TEXT + "</th>" + |
| "</tr><tr>" + |
| "<td>" + CONTENT_TEXT + "</td>" + |
| @@ -182,6 +193,7 @@ public class ContentExtractorTest extends DomDistillerJsTestCase { |
| "</tbody>" + |
| "</table>"; |
| + mHead.setInnerHTML("<base href=\"http://example.com/\">"); |
| mBody.setInnerHTML(html); |
| ContentExtractor extractor = new ContentExtractor(mRoot); |