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

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

Issue 1231083007: Expose distiller functions to JavaScript (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@refactor-content
Patch Set: Function rename and remove unnecessary code Created 5 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
Index: components/dom_distiller/content/browser/distiller_page_web_contents_browsertest.cc
diff --git a/components/dom_distiller/content/browser/distiller_page_web_contents_browsertest.cc b/components/dom_distiller/content/browser/distiller_page_web_contents_browsertest.cc
index ac503d9859ee365381ddfc71d0c4ec8f1342d156..bd5fd89640601bf338740aca24853ff91ea0c088 100644
--- a/components/dom_distiller/content/browser/distiller_page_web_contents_browsertest.cc
+++ b/components/dom_distiller/content/browser/distiller_page_web_contents_browsertest.cc
@@ -157,7 +157,8 @@ class TestDistillerPageWebContents : public DistillerPageWebContents {
const gfx::Size& render_view_size,
scoped_ptr<SourcePageHandleWebContents> optional_web_contents_handle,
bool expect_new_web_contents)
- : DistillerPageWebContents(browser_context, render_view_size,
+ : DistillerPageWebContents(browser_context,
+ render_view_size,
optional_web_contents_handle.Pass()),
expect_new_web_contents_(expect_new_web_contents),
new_web_contents_created_(false) {}
@@ -231,7 +232,6 @@ 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(),
@@ -288,8 +288,7 @@ IN_PROC_BROWSER_TEST_F(DistillerPageWebContentsTest,
bool expect_new_web_contents = true;
bool setup_main_frame_observer = true;
bool wait_for_document_loaded = true;
- RunUseCurrentWebContentsTest(url,
- expect_new_web_contents,
+ RunUseCurrentWebContentsTest(url, expect_new_web_contents,
setup_main_frame_observer,
wait_for_document_loaded);
}
@@ -300,8 +299,7 @@ IN_PROC_BROWSER_TEST_F(DistillerPageWebContentsTest,
bool expect_new_web_contents = true;
bool setup_main_frame_observer = false;
bool wait_for_document_loaded = true;
- RunUseCurrentWebContentsTest(url,
- expect_new_web_contents,
+ RunUseCurrentWebContentsTest(url, expect_new_web_contents,
setup_main_frame_observer,
wait_for_document_loaded);
}
@@ -312,8 +310,7 @@ IN_PROC_BROWSER_TEST_F(DistillerPageWebContentsTest,
bool expect_new_web_contents = false;
bool setup_main_frame_observer = true;
bool wait_for_document_loaded = false;
- RunUseCurrentWebContentsTest(url,
- expect_new_web_contents,
+ RunUseCurrentWebContentsTest(url, expect_new_web_contents,
setup_main_frame_observer,
wait_for_document_loaded);
}
@@ -324,8 +321,7 @@ IN_PROC_BROWSER_TEST_F(DistillerPageWebContentsTest,
bool expect_new_web_contents = false;
bool setup_main_frame_observer = true;
bool wait_for_document_loaded = true;
- RunUseCurrentWebContentsTest(url,
- expect_new_web_contents,
+ RunUseCurrentWebContentsTest(url, expect_new_web_contents,
setup_main_frame_observer,
wait_for_document_loaded);
}
@@ -345,10 +341,8 @@ void DistillerPageWebContentsTest::RunUseCurrentWebContentsTest(
url_loaded_runner.QuitClosure(),
wait_for_document_loaded);
current_web_contents->GetController().LoadURL(
- embedded_test_server()->GetURL(url),
- content::Referrer(),
- ui::PAGE_TRANSITION_TYPED,
- std::string());
+ embedded_test_server()->GetURL(url), content::Referrer(),
+ ui::PAGE_TRANSITION_TYPED, std::string());
url_loaded_runner.Run();
scoped_ptr<SourcePageHandleWebContents> source_page_handle(
@@ -357,8 +351,7 @@ void DistillerPageWebContentsTest::RunUseCurrentWebContentsTest(
TestDistillerPageWebContents distiller_page(
shell()->web_contents()->GetBrowserContext(),
shell()->web_contents()->GetContainerBounds().size(),
- source_page_handle.Pass(),
- expect_new_web_contents);
+ source_page_handle.Pass(), expect_new_web_contents);
distiller_page_ = &distiller_page;
base::RunLoop run_loop;
@@ -372,32 +365,26 @@ void DistillerPageWebContentsTest::RunUseCurrentWebContentsTest(
IN_PROC_BROWSER_TEST_F(DistillerPageWebContentsTest,
PageDestroyedBeforeFinishDistillation) {
-
content::WebContents* current_web_contents = shell()->web_contents();
dom_distiller::WebContentsMainFrameObserver::CreateForWebContents(
current_web_contents);
base::RunLoop url_loaded_runner;
- WebContentsMainFrameHelper main_frame_loaded(current_web_contents,
- url_loaded_runner.QuitClosure(),
- true);
+ WebContentsMainFrameHelper main_frame_loaded(
+ current_web_contents, url_loaded_runner.QuitClosure(), true);
current_web_contents->GetController().LoadURL(
- embedded_test_server()->GetURL(kSimpleArticlePath),
- content::Referrer(),
- ui::PAGE_TRANSITION_TYPED,
- std::string());
+ embedded_test_server()->GetURL(kSimpleArticlePath), content::Referrer(),
+ ui::PAGE_TRANSITION_TYPED, std::string());
url_loaded_runner.Run();
scoped_ptr<SourcePageHandleWebContents> source_page_handle(
new SourcePageHandleWebContents(current_web_contents, false));
- TestDistillerPageWebContents* distiller_page(
- new TestDistillerPageWebContents(
- current_web_contents->GetBrowserContext(),
- current_web_contents->GetContainerBounds().size(),
- source_page_handle.Pass(),
- false));
+ TestDistillerPageWebContents* distiller_page(new TestDistillerPageWebContents(
+ current_web_contents->GetBrowserContext(),
+ current_web_contents->GetContainerBounds().size(),
+ source_page_handle.Pass(), false));
distiller_page_ = distiller_page;
base::RunLoop run_loop;
@@ -485,21 +472,17 @@ IN_PROC_BROWSER_TEST_F(DistillerPageWebContentsTest,
}
}
-IN_PROC_BROWSER_TEST_F(DistillerPageWebContentsTest,
- TestPinch) {
+IN_PROC_BROWSER_TEST_F(DistillerPageWebContentsTest, TestPinch) {
// Load the test file in content shell and wait until it has fully loaded.
content::WebContents* web_contents = shell()->web_contents();
dom_distiller::WebContentsMainFrameObserver::CreateForWebContents(
web_contents);
base::RunLoop url_loaded_runner;
- WebContentsMainFrameHelper main_frame_loaded(web_contents,
- url_loaded_runner.QuitClosure(),
- true);
+ WebContentsMainFrameHelper main_frame_loaded(
+ web_contents, url_loaded_runner.QuitClosure(), true);
web_contents->GetController().LoadURL(
- embedded_test_server()->GetURL("/pinch_tester.html"),
- content::Referrer(),
- ui::PAGE_TRANSITION_TYPED,
- std::string());
+ embedded_test_server()->GetURL("/pinch_tester.html"), content::Referrer(),
+ ui::PAGE_TRANSITION_TYPED, std::string());
url_loaded_runner.Run();
// Execute the JS to run the tests, and wait until it has finished.

Powered by Google App Engine
This is Rietveld 408576698