| 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 dadefe77dc17f73cb700930bb85f945a23db2f50..19feb3202fce83b21e7901588f14cc60d68a3305 100644
|
| --- a/components/dom_distiller/content/distiller_page_web_contents_browsertest.cc
|
| +++ b/components/dom_distiller/content/distiller_page_web_contents_browsertest.cc
|
| @@ -18,6 +18,7 @@
|
| #include "content/public/browser/web_contents_observer.h"
|
| #include "content/public/test/content_browser_test.h"
|
| #include "content/shell/browser/shell.h"
|
| +#include "grit/components_resources.h"
|
| #include "grit/components_strings.h"
|
| #include "net/test/embedded_test_server/embedded_test_server.h"
|
| #include "testing/gmock/include/gmock/gmock.h"
|
| @@ -42,6 +43,9 @@ class DistillerPageWebContentsTest : public ContentBrowserTest {
|
| AddComponentsResources();
|
| SetUpTestServer();
|
| ContentBrowserTest::SetUpOnMainThread();
|
| + distiller_js_script_ = ResourceBundle::GetSharedInstance()
|
| + .GetRawDataResource(IDR_DISTILLER_JS)
|
| + .as_string();
|
| }
|
|
|
| void DistillPage(const base::Closure& quit_closure, const std::string& url) {
|
| @@ -88,6 +92,7 @@ class DistillerPageWebContentsTest : public ContentBrowserTest {
|
| DistillerPageWebContents* distiller_page_;
|
| base::Closure quit_closure_;
|
| scoped_ptr<proto::DomDistillerResult> distiller_result_;
|
| + std::string distiller_js_script_;
|
| };
|
|
|
| // Use this class to be able to leak the WebContents, which is needed for when
|
| @@ -97,9 +102,12 @@ class TestDistillerPageWebContents : public DistillerPageWebContents {
|
| TestDistillerPageWebContents(
|
| content::BrowserContext* browser_context,
|
| const gfx::Size& render_view_size,
|
| + const std::string& distiller_js_script,
|
| scoped_ptr<SourcePageHandleWebContents> optional_web_contents_handle,
|
| bool expect_new_web_contents)
|
| - : DistillerPageWebContents(browser_context, render_view_size,
|
| + : DistillerPageWebContents(browser_context,
|
| + render_view_size,
|
| + distiller_js_script,
|
| optional_web_contents_handle.Pass()),
|
| expect_new_web_contents_(expect_new_web_contents),
|
| new_web_contents_created_(false) {}
|
| @@ -170,7 +178,7 @@ IN_PROC_BROWSER_TEST_F(DistillerPageWebContentsTest, BasicDistillationWorks) {
|
| DistillerPageWebContents distiller_page(
|
| shell()->web_contents()->GetBrowserContext(),
|
| shell()->web_contents()->GetContainerBounds().size(),
|
| - scoped_ptr<SourcePageHandleWebContents>());
|
| + distiller_js_script_, scoped_ptr<SourcePageHandleWebContents>());
|
| distiller_page_ = &distiller_page;
|
|
|
| base::RunLoop run_loop;
|
| @@ -190,7 +198,7 @@ IN_PROC_BROWSER_TEST_F(DistillerPageWebContentsTest, HandlesRelativeLinks) {
|
| DistillerPageWebContents distiller_page(
|
| shell()->web_contents()->GetBrowserContext(),
|
| shell()->web_contents()->GetContainerBounds().size(),
|
| - scoped_ptr<SourcePageHandleWebContents>());
|
| + distiller_js_script_, scoped_ptr<SourcePageHandleWebContents>());
|
| distiller_page_ = &distiller_page;
|
|
|
| base::RunLoop run_loop;
|
| @@ -208,7 +216,7 @@ IN_PROC_BROWSER_TEST_F(DistillerPageWebContentsTest, HandlesRelativeImages) {
|
| DistillerPageWebContents distiller_page(
|
| shell()->web_contents()->GetBrowserContext(),
|
| shell()->web_contents()->GetContainerBounds().size(),
|
| - scoped_ptr<SourcePageHandleWebContents>());
|
| + distiller_js_script_, scoped_ptr<SourcePageHandleWebContents>());
|
| distiller_page_ = &distiller_page;
|
|
|
| base::RunLoop run_loop;
|
| @@ -227,7 +235,7 @@ IN_PROC_BROWSER_TEST_F(DistillerPageWebContentsTest, HandlesRelativeVideos) {
|
| DistillerPageWebContents distiller_page(
|
| shell()->web_contents()->GetBrowserContext(),
|
| shell()->web_contents()->GetContainerBounds().size(),
|
| - scoped_ptr<SourcePageHandleWebContents>());
|
| + distiller_js_script_, scoped_ptr<SourcePageHandleWebContents>());
|
| distiller_page_ = &distiller_page;
|
|
|
| base::RunLoop run_loop;
|
| @@ -250,7 +258,7 @@ IN_PROC_BROWSER_TEST_F(DistillerPageWebContentsTest, VisibilityDetection) {
|
| DistillerPageWebContents distiller_page(
|
| shell()->web_contents()->GetBrowserContext(),
|
| shell()->web_contents()->GetContainerBounds().size(),
|
| - scoped_ptr<SourcePageHandleWebContents>());
|
| + distiller_js_script_, scoped_ptr<SourcePageHandleWebContents>());
|
| distiller_page_ = &distiller_page;
|
|
|
| // visble_style.html and invisible_style.html only differ by the visibility
|
| @@ -349,8 +357,7 @@ void DistillerPageWebContentsTest::RunUseCurrentWebContentsTest(
|
| TestDistillerPageWebContents distiller_page(
|
| shell()->web_contents()->GetBrowserContext(),
|
| shell()->web_contents()->GetContainerBounds().size(),
|
| - source_page_handle.Pass(),
|
| - expect_new_web_contents);
|
| + distiller_js_script_, source_page_handle.Pass(), expect_new_web_contents);
|
| distiller_page_ = &distiller_page;
|
|
|
| base::RunLoop run_loop;
|
| @@ -366,7 +373,7 @@ IN_PROC_BROWSER_TEST_F(DistillerPageWebContentsTest, MarkupInfo) {
|
| DistillerPageWebContents distiller_page(
|
| shell()->web_contents()->GetBrowserContext(),
|
| shell()->web_contents()->GetContainerBounds().size(),
|
| - scoped_ptr<SourcePageHandleWebContents>());
|
| + distiller_js_script_, scoped_ptr<SourcePageHandleWebContents>());
|
| distiller_page_ = &distiller_page;
|
|
|
| base::RunLoop run_loop;
|
|
|