summaryrefslogtreecommitdiffstats
path: root/components
diff options
context:
space:
mode:
authoryfriedman@chromium.org <yfriedman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-06-12 23:05:37 +0000
committeryfriedman@chromium.org <yfriedman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-06-12 23:05:37 +0000
commit101a5f7745000368e22a61b63dfcfe2c44beed46 (patch)
tree08948ae2969dd1843c7cd33cf5224d7b550417a9 /components
parent6edb648820e11ef8e822f65813c19c386ca6bffb (diff)
downloadchromium_src-101a5f7745000368e22a61b63dfcfe2c44beed46.zip
chromium_src-101a5f7745000368e22a61b63dfcfe2c44beed46.tar.gz
chromium_src-101a5f7745000368e22a61b63dfcfe2c44beed46.tar.bz2
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
Diffstat (limited to 'components')
-rw-r--r--components/dom_distiller/content/distiller_page_web_contents_browsertest.cc27
-rw-r--r--components/dom_distiller/core/css/distilledpage.css4
-rw-r--r--components/test/data/dom_distiller/video_article.html21
3 files changed, 50 insertions, 2 deletions
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 e319097..e8c1efa 100644
--- a/components/dom_distiller/content/distiller_page_web_contents_browsertest.cc
+++ b/components/dom_distiller/content/distiller_page_web_contents_browsertest.cc
@@ -28,6 +28,7 @@ using testing::Not;
namespace dom_distiller {
const char* kSimpleArticlePath = "/simple_article.html";
+const char* kVideoArticlePath = "/video_article.html";
class DistillerPageWebContentsTest : public ContentBrowserTest {
public:
@@ -217,6 +218,32 @@ IN_PROC_BROWSER_TEST_F(DistillerPageWebContentsTest, HandlesRelativeImages) {
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) {
DistillerPageWebContents distiller_page(
shell()->web_contents()->GetBrowserContext(),
diff --git a/components/dom_distiller/core/css/distilledpage.css b/components/dom_distiller/core/css/distilledpage.css
index fc7b565..0e04891 100644
--- a/components/dom_distiller/core/css/distilledpage.css
+++ b/components/dom_distiller/core/css/distilledpage.css
@@ -4,8 +4,8 @@
@charset "utf-8";
/* Document */
body{font-family:'Open Sans',sans-serif;font-size:18px;line-height:1.4;}
-/* Don't let images bleed out of viewport. */
-img{max-width:100%;}
+/* Don't let images or video bleed out of viewport. */
+img,video{max-width:100%;}
/* Margin */
.margin-x-narrow{width:95%;}
.margin-narrow{width:85%;}
diff --git a/components/test/data/dom_distiller/video_article.html b/components/test/data/dom_distiller/video_article.html
new file mode 100644
index 0000000..7fac7ae
--- /dev/null
+++ b/components/test/data/dom_distiller/video_article.html
@@ -0,0 +1,21 @@
+<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>