| Index: javatests/org/chromium/distiller/webdocument/WebTableTest.java
|
| diff --git a/javatests/org/chromium/distiller/webdocument/WebTableTest.java b/javatests/org/chromium/distiller/webdocument/WebTableTest.java
|
| index 0b3e460bf8f7026b4b348cd093fc3454080d3b7c..c7dd0548610e5c3fff476020335d4371a82a1c7d 100644
|
| --- a/javatests/org/chromium/distiller/webdocument/WebTableTest.java
|
| +++ b/javatests/org/chromium/distiller/webdocument/WebTableTest.java
|
| @@ -13,12 +13,44 @@ import com.google.gwt.dom.client.Document;
|
| import com.google.gwt.dom.client.Element;
|
|
|
| public class WebTableTest extends DomDistillerJsTestCase {
|
| + public void testGetImageUrlList() {
|
| + mHead.setInnerHTML("<base href=\"http://example.com/\">");
|
| + Element table = Document.get().createTableElement();
|
| +
|
| + String html =
|
| + "<tbody>" +
|
| + "<tr>" +
|
| + "<td><img src=\"http://example.com/table.png\" " +
|
| + "srcset=\"image100 100w, //example.org/image300 300w\"></td>" +
|
| + "<td>" +
|
| + "<picture>" +
|
| + "<source srcset=\"image200 200w, //example.org/image400 400w\">" +
|
| + "<img>" +
|
| + "</picture>" +
|
| + "</td>" +
|
| + "</tr>" +
|
| + "</tbody>";
|
| +
|
| + table.setInnerHTML(html);
|
| + mBody.appendChild(table);
|
| +
|
| + WebTable webTable = new WebTable(table);
|
| + List<String> urls = webTable.getImageUrlList();
|
| + assertEquals(5, urls.size());
|
| + assertEquals("http://example.com/table.png", urls.get(0));
|
| + assertEquals("http://example.com/image100", urls.get(1));
|
| + assertEquals("http://example.org/image300", urls.get(2));
|
| + assertEquals("http://example.com/image200", urls.get(3));
|
| + assertEquals("http://example.org/image400", urls.get(4));
|
| + }
|
| +
|
| public void testGenerateOutput() {
|
| Element table = Document.get().createTableElement();
|
| String html = "<tbody>" +
|
| "<tr>" +
|
| "<td>row1col1</td>" +
|
| "<td><img src=\"http://example.com/table.png\"></td>" +
|
| + "<td><picture><img></picture></td>" +
|
| "</tr>" +
|
| "</tbody>";
|
| table.setInnerHTML(html);
|
| @@ -29,6 +61,8 @@ public class WebTableTest extends DomDistillerJsTestCase {
|
|
|
| // Output should be the same as the input in this case.
|
| assertEquals("<table>" + html + "</table>", TestUtil.removeAllDirAttributes(got));
|
| +
|
| + // Test getImageUrlList() as well.
|
| List<String> imgUrls = webTable.getImageUrlList();
|
| assertEquals(1, imgUrls.size());
|
| assertEquals("http://example.com/table.png", imgUrls.get(0));
|
|
|