Test and css changes for dom_distiller inclusion of video.

Adds tests for code in https://codereview.chromium.org/322553005/
Also, update stylesheet to restrict max video size.
BUG=376107
TBR=blundell

Review URL: https://codereview.chromium.org/318723004

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@276842 0039d316-1c4b-4281-b951-d872f2087c98
parent 6edb6488
...@@ -28,6 +28,7 @@ using testing::Not; ...@@ -28,6 +28,7 @@ using testing::Not;
namespace dom_distiller { namespace dom_distiller {
const char* kSimpleArticlePath = "/simple_article.html"; const char* kSimpleArticlePath = "/simple_article.html";
const char* kVideoArticlePath = "/video_article.html";
class DistillerPageWebContentsTest : public ContentBrowserTest { class DistillerPageWebContentsTest : public ContentBrowserTest {
public: public:
...@@ -217,6 +218,32 @@ IN_PROC_BROWSER_TEST_F(DistillerPageWebContentsTest, HandlesRelativeImages) { ...@@ -217,6 +218,32 @@ IN_PROC_BROWSER_TEST_F(DistillerPageWebContentsTest, HandlesRelativeImages) {
HasSubstr("src=\"http://www.google.com/absoluteimage.png\"")); HasSubstr("src=\"http://www.google.com/absoluteimage.png\""));
} }
IN_PROC_BROWSER_TEST_F(DistillerPageWebContentsTest, HandlesRelativeVideos) {
DistillerPageWebContents distiller_page(
shell()->web_contents()->GetBrowserContext(),
scoped_ptr<SourcePageHandleWebContents>());
distiller_page_ = &distiller_page;
base::RunLoop run_loop;
DistillPage(run_loop.QuitClosure(), kVideoArticlePath);
run_loop.Run();
// A relative source/track should've been updated.
EXPECT_THAT(
page_info_.get()->html,
ContainsRegex("src=\"http://127.0.0.1:.*/relative_video.mp4\""));
EXPECT_THAT(
page_info_.get()->html,
ContainsRegex("src=\"http://127.0.0.1:.*/relative_track_en.vtt\""));
EXPECT_THAT(
page_info_.get()->html,
HasSubstr("src=\"http://www.google.com/absolute_video.ogg\""));
EXPECT_THAT(
page_info_.get()->html,
HasSubstr("src=\"http://www.google.com/absolute_track_fr.vtt\""));
}
IN_PROC_BROWSER_TEST_F(DistillerPageWebContentsTest, VisibilityDetection) { IN_PROC_BROWSER_TEST_F(DistillerPageWebContentsTest, VisibilityDetection) {
DistillerPageWebContents distiller_page( DistillerPageWebContents distiller_page(
shell()->web_contents()->GetBrowserContext(), shell()->web_contents()->GetBrowserContext(),
......
...@@ -4,8 +4,8 @@ ...@@ -4,8 +4,8 @@
@charset "utf-8"; @charset "utf-8";
/* Document */ /* Document */
body{font-family:'Open Sans',sans-serif;font-size:18px;line-height:1.4;} body{font-family:'Open Sans',sans-serif;font-size:18px;line-height:1.4;}
/* Don't let images bleed out of viewport. */ /* Don't let images or video bleed out of viewport. */
img{max-width:100%;} img,video{max-width:100%;}
/* Margin */ /* Margin */
.margin-x-narrow{width:95%;} .margin-x-narrow{width:95%;}
.margin-narrow{width:85%;} .margin-narrow{width:85%;}
......
<html>
<head><title>Test Page Title</title></head>
<body>
<div>
<p>Lorem ipsum dolor sit amet, at alia aliquip vel. Quas inani labore an vel. Sed an nemore minimum accusata. Sint inermis tacimates est ex, ad movet iracundia mei, delicata iracundia laboramus ei eos. Illud principes complectitur te nec, ius alienum insolens ea, cu quo oratio omnesque.
<p>Lorem ipsum dolor sit amet, at alia aliquip vel. Quas inani labore an vel. Sed an nemore minimum accusata. Sint inermis tacimates est ex, ad movet iracundia mei, delicata iracundia laboramus ei eos. Illud principes complectitur te nec, ius alienum insolens ea, cu quo oratio omnesque.
<p>Lorem ipsum dolor sit amet, at alia aliquip vel. Quas inani labore an vel. Sed an nemore minimum accusata. Sint inermis tacimates est ex, ad movet iracundia mei, delicata iracundia laboramus ei eos. Illud principes complectitur te nec, ius alienum insolens ea, cu quo oratio omnesque.
<video width="500" height="400" controls>
<source src="relative_video.mp4" type="video/mp4">
<source src="http://www.google.com/absolute_video.ogg" type="video/ogg">
<track src="relative_track_en.vtt" kind="chapters" srclang="en" label="English">
<track src="http://www.google.com/absolute_track_fr.vtt" kind="chapters" srclang="fr" label="French">
</video>
</div>
<br>
<div>
I am questiontable content. <a href="http://some.questionable.content">Go here</a>
</div>
</body>
</html>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment