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

Unified Diff: components/dom_distiller/content/distiller_page_web_contents_browsertest.cc

Issue 411253008: dom distiller: extract markup properties from protobuf (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | components/dom_distiller/core/distiller_page.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/dom_distiller/content/distiller_page_web_contents_browsertest.cc
diff --git a/components/dom_distiller/content/distiller_page_web_contents_browsertest.cc b/components/dom_distiller/content/distiller_page_web_contents_browsertest.cc
index 74159eb677cfa356d74cf6b0c0d394d73c687361..af3b96d1df6b9619f645f6c3f179874717a2289f 100644
--- a/components/dom_distiller/content/distiller_page_web_contents_browsertest.cc
+++ b/components/dom_distiller/content/distiller_page_web_contents_browsertest.cc
@@ -354,4 +354,54 @@ void DistillerPageWebContentsTest::RunUseCurrentWebContentsTest(
EXPECT_EQ("Test Page Title", page_info_.get()->title);
}
+IN_PROC_BROWSER_TEST_F(DistillerPageWebContentsTest, MarkupInfo) {
+ DistillerPageWebContents distiller_page(
+ shell()->web_contents()->GetBrowserContext(),
+ shell()->web_contents()->GetContainerBounds().size(),
+ scoped_ptr<SourcePageHandleWebContents>());
+ distiller_page_ = &distiller_page;
+
+ base::RunLoop run_loop;
+ DistillPage(run_loop.QuitClosure(), "/markup_article.html");
+ run_loop.Run();
+
+ EXPECT_THAT(page_info_.get()->html, HasSubstr("Lorem ipsum"));
+ EXPECT_EQ("Marked-up Markup Test Page Title", page_info_.get()->title);
+
+ const DistilledPageInfo::MarkupInfo& markup_info = page_info_->markup_info;
+ EXPECT_EQ("Marked-up Markup Test Page Title", markup_info.title);
+ EXPECT_EQ("Article", markup_info.type);
+ EXPECT_EQ("http://test/markup.html", markup_info.url);
+ EXPECT_EQ("This page tests Markup Info.", markup_info.description);
+ EXPECT_EQ("Whoever Published", markup_info.publisher);
+ EXPECT_EQ("Copyright 2000-2014 Whoever Copyrighted", markup_info.copyright);
+ EXPECT_EQ("Whoever Authored", markup_info.author);
+
+ const DistilledPageInfo::MarkupArticle& markup_article = markup_info.article;
+ EXPECT_EQ("Whatever Section", markup_article.section);
+ EXPECT_EQ("July 23, 2014", markup_article.published_time);
+ EXPECT_EQ("2014-07-23T23:59", markup_article.modified_time);
+ EXPECT_EQ("", markup_article.expiration_time);
+ ASSERT_EQ(1U, markup_article.authors.size());
+ EXPECT_EQ("Whoever Authored", markup_article.authors[0]);
+
+ ASSERT_EQ(2U, markup_info.images.size());
+
+ const DistilledPageInfo::MarkupImage& markup_image1 = markup_info.images[0];
+ EXPECT_EQ("http://test/markup1.jpeg", markup_image1.url);
+ EXPECT_EQ("https://test/markup1.jpeg", markup_image1.secure_url);
+ EXPECT_EQ("jpeg", markup_image1.type);
+ EXPECT_EQ("", markup_image1.caption);
+ EXPECT_EQ(600, markup_image1.width);
+ EXPECT_EQ(400, markup_image1.height);
+
+ const DistilledPageInfo::MarkupImage& markup_image2 = markup_info.images[1];
+ EXPECT_EQ("http://test/markup2.gif", markup_image2.url);
+ EXPECT_EQ("https://test/markup2.gif", markup_image2.secure_url);
+ EXPECT_EQ("gif", markup_image2.type);
+ EXPECT_EQ("", markup_image2.caption);
+ EXPECT_EQ(1000, markup_image2.width);
+ EXPECT_EQ(600, markup_image2.height);
+}
+
} // namespace dom_distiller
« no previous file with comments | « no previous file | components/dom_distiller/core/distiller_page.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698