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 |