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

Unified Diff: javatests/org/chromium/distiller/webdocument/DomConverterTest.java

Issue 2669723002: Fix more partially hidden articles (Closed)
Patch Set: don't rely on article Created 3 years, 11 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
« no previous file with comments | « java/org/chromium/distiller/webdocument/DomConverter.java ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: javatests/org/chromium/distiller/webdocument/DomConverterTest.java
diff --git a/javatests/org/chromium/distiller/webdocument/DomConverterTest.java b/javatests/org/chromium/distiller/webdocument/DomConverterTest.java
index 0fa94bbb58f006c6362d1345207d0ebf7b71536c..a4c6f64789c54ade50b1bcba5fc92d4461db2320 100644
--- a/javatests/org/chromium/distiller/webdocument/DomConverterTest.java
+++ b/javatests/org/chromium/distiller/webdocument/DomConverterTest.java
@@ -14,11 +14,18 @@ import java.util.List;
public class DomConverterTest extends DomDistillerJsTestCase {
private void runTest(String innerHtml, String expectedHtml) throws Throwable {
+ runTest(innerHtml, expectedHtml, false);
+ }
+
+ private void runTest(String innerHtml, String expectedHtml, boolean mobileArticle)
+ throws Throwable {
Element container = Document.get().createDivElement();
mBody.appendChild(container);
container.setInnerHTML(innerHtml);
FakeWebDocumentBuilder builder = new FakeWebDocumentBuilder();
DomConverter filteringDomVisitor = new DomConverter(builder);
+ filteringDomVisitor.setHasArticleElement(mobileArticle);
+ filteringDomVisitor.setIsMobileFriendly(mobileArticle);
new DomWalker(filteringDomVisitor).walk(container);
String expectedDocument = "<div>" + expectedHtml + "</div>";
assertEquals(expectedDocument, builder.getDocumentString().toLowerCase());
@@ -51,8 +58,15 @@ public class DomConverterTest extends DomDistillerJsTestCase {
public void testVisibleInInvisible() throws Throwable {
String html = "<div style=\"visibility:hidden\">invisible parent" +
- "<div>visible child</div>" +
- "</div>";
+ "<div>visible child</div>" +
+ "</div>";
+ runTest(html, "");
+ }
+
+ public void testVisibleInInvisible2() throws Throwable {
+ String html = "<div style=\"display:none\">invisible parent" +
+ "<div>visible child</div>" +
+ "</div>";
runTest(html, "");
}
@@ -92,6 +106,30 @@ public class DomConverterTest extends DomDistillerJsTestCase {
runTest(html, "");
}
+ public void testKeepHidden() throws Throwable {
+ String html = "<div class=\"hidden\" style=\"display: none\">visible element</div>";
+ runTest(html, html, true);
+ }
+
+ public void testKeepHiddenNested() throws Throwable {
+ // "visibility: hidden" is used. See crbug.com/599121
+ String html = "<div class=\"hidden\" style=\"visibility: hidden\">" +
+ "<div>visible element</div></div>";
+ runTest(html, html, true);
+ }
+
+ public void testKeepContinue() throws Throwable {
+ String html = "<div class=\"continue\" style=\"display: none\">visible element</div>";
+ runTest(html, html, true);
+ }
+
+ public void testKeepContinueNested() throws Throwable {
+ // "display: none" is used. See crbug.com/687071
+ String html = "<div class=\"continue\" style=\"display: none\">" +
+ "<div>visible element</div></div>";
+ runTest(html, html, true);
+ }
+
public void testDataTable() throws Throwable {
String html = "<table align=\"left\" role=\"grid\">" + // role=grid make this a data table.
"<tbody align=\"left\">" +
« no previous file with comments | « java/org/chromium/distiller/webdocument/DomConverter.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698