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

Side by Side Diff: javatests/org/chromium/distiller/DomUtilTest.java

Issue 2092553003: Fix schema.org article matching (Closed) Base URL: git@github.com:chromium/dom-distiller.git@master
Patch Set: Created 4 years, 5 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 unified diff | Download patch
« no previous file with comments | « java/org/chromium/distiller/DomUtil.java ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 package org.chromium.distiller; 5 package org.chromium.distiller;
6 6
7 import org.chromium.distiller.webdocument.WebTable; 7 import org.chromium.distiller.webdocument.WebTable;
8 8
9 import com.google.gwt.core.client.JsArray; 9 import com.google.gwt.core.client.JsArray;
10 import com.google.gwt.dom.client.Document; 10 import com.google.gwt.dom.client.Document;
(...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after
497 497
498 final String expected = 498 final String expected =
499 "<div itemscope=\"\" " + 499 "<div itemscope=\"\" " +
500 "itemtype=\"http://schema.org/BlogPosting\">" + 500 "itemtype=\"http://schema.org/BlogPosting\">" +
501 "</div>"; 501 "</div>";
502 502
503 Element result = getArticleElement(htmlArticle); 503 Element result = getArticleElement(htmlArticle);
504 assertEquals(expected, result.getString()); 504 assertEquals(expected, result.getString());
505 } 505 }
506 506
507 public void testOnlyProcessSchemaOrgPostal() {
508 final String htmlArticle =
509 "<h1></h1>" +
510 "<div itemscope itemtype=\"http://schema.org/PostalAddress\">" +
511 "</div>";
512
513 Element result = getArticleElement(htmlArticle);
514 assertNull(result);
515 }
516
507 public void testOnlyProcessSchemaOrgArticleNested() { 517 public void testOnlyProcessSchemaOrgArticleNested() {
508 final String htmlArticle = 518 final String htmlArticle =
509 "<h1></h1>" + 519 "<h1></h1>" +
510 "<div itemscope itemtype=\"http://schema.org/Article\">" + 520 "<div itemscope itemtype=\"http://schema.org/Article\">" +
511 "<div itemscope itemtype=\"http://schema.org/Article\">" + 521 "<div itemscope itemtype=\"http://schema.org/Article\">" +
512 "</div>" + 522 "</div>" +
513 "</div>"; 523 "</div>";
514 524
515 final String expected = 525 final String expected =
516 "<div itemscope=\"\" itemtype=\"http://schema.org/Article\">" + 526 "<div itemscope=\"\" itemtype=\"http://schema.org/Article\">" +
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
602 element = element.getNextSiblingElement(); 612 element = element.getNextSiblingElement();
603 assertEquals(300*200, DomUtil.getArea(element)); 613 assertEquals(300*200, DomUtil.getArea(element));
604 614
605 element = element.getNextSiblingElement(); 615 element = element.getNextSiblingElement();
606 assertEquals(400*100, DomUtil.getArea(element)); 616 assertEquals(400*100, DomUtil.getArea(element));
607 617
608 element = element.getFirstChildElement(); 618 element = element.getFirstChildElement();
609 assertEquals(400*100, DomUtil.getArea(element)); 619 assertEquals(400*100, DomUtil.getArea(element));
610 } 620 }
611 } 621 }
OLDNEW
« no previous file with comments | « java/org/chromium/distiller/DomUtil.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698