diff options
Diffstat (limited to 'chromium/components/dom_distiller')
14 files changed, 33 insertions, 33 deletions
diff --git a/chromium/components/dom_distiller/content/browser/distillable_page_utils_browsertest.cc b/chromium/components/dom_distiller/content/browser/distillable_page_utils_browsertest.cc index 43a6f040035..db2d88d6383 100644 --- a/chromium/components/dom_distiller/content/browser/distillable_page_utils_browsertest.cc +++ b/chromium/components/dom_distiller/content/browser/distillable_page_utils_browsertest.cc @@ -59,10 +59,10 @@ class DomDistillerDistillablePageUtilsTest : public content::ContentBrowserTest, base::FilePath pak_file; base::FilePath pak_dir; #if defined(OS_ANDROID) - CHECK(PathService::Get(base::DIR_ANDROID_APP_DATA, &pak_dir)); + CHECK(base::PathService::Get(base::DIR_ANDROID_APP_DATA, &pak_dir)); pak_dir = pak_dir.Append(FILE_PATH_LITERAL("paks")); #else - PathService::Get(base::DIR_MODULE, &pak_dir); + base::PathService::Get(base::DIR_MODULE, &pak_dir); #endif // OS_ANDROID pak_file = pak_dir.Append(FILE_PATH_LITERAL("components_tests_resources.pak")); @@ -72,7 +72,7 @@ class DomDistillerDistillablePageUtilsTest : public content::ContentBrowserTest, void SetUpTestServer() { base::FilePath path; - PathService::Get(base::DIR_SOURCE_ROOT, &path); + base::PathService::Get(base::DIR_SOURCE_ROOT, &path); path = path.AppendASCII("components/test/data/dom_distiller"); embedded_test_server()->ServeFilesFromDirectory(path); ASSERT_TRUE(embedded_test_server()->Start()); diff --git a/chromium/components/dom_distiller/content/browser/distiller_page_web_contents.cc b/chromium/components/dom_distiller/content/browser/distiller_page_web_contents.cc index 9c821be249e..9dd3a81fea2 100644 --- a/chromium/components/dom_distiller/content/browser/distiller_page_web_contents.cc +++ b/chromium/components/dom_distiller/content/browser/distiller_page_web_contents.cc @@ -121,19 +121,20 @@ void DistillerPageWebContents::CreateNewWebContents(const GURL& url) { // Create new WebContents to use for distilling the content. content::WebContents::CreateParams create_params(browser_context_); create_params.initially_hidden = true; - content::WebContents* web_contents = + std::unique_ptr<content::WebContents> web_contents = content::WebContents::Create(create_params); DCHECK(web_contents); web_contents->SetDelegate(this); // Start observing WebContents and load the requested URL. - content::WebContentsObserver::Observe(web_contents); + content::WebContentsObserver::Observe(web_contents.get()); content::NavigationController::LoadURLParams params(url); web_contents->GetController().LoadURLWithParams(params); + // SourcePageHandleWebContents takes ownership of |web_contents|. source_page_handle_.reset( - new SourcePageHandleWebContents(web_contents, true)); + new SourcePageHandleWebContents(web_contents.release(), true)); } gfx::Size DistillerPageWebContents::GetSizeForNewRenderView( diff --git a/chromium/components/dom_distiller/content/browser/distiller_page_web_contents_browsertest.cc b/chromium/components/dom_distiller/content/browser/distiller_page_web_contents_browsertest.cc index eaf9ed8717e..1fb0fad2e79 100644 --- a/chromium/components/dom_distiller/content/browser/distiller_page_web_contents_browsertest.cc +++ b/chromium/components/dom_distiller/content/browser/distiller_page_web_contents_browsertest.cc @@ -122,10 +122,10 @@ class DistillerPageWebContentsTest : public ContentBrowserTest { base::FilePath pak_file; base::FilePath pak_dir; #if defined(OS_ANDROID) - CHECK(PathService::Get(base::DIR_ANDROID_APP_DATA, &pak_dir)); + CHECK(base::PathService::Get(base::DIR_ANDROID_APP_DATA, &pak_dir)); pak_dir = pak_dir.Append(FILE_PATH_LITERAL("paks")); #else - PathService::Get(base::DIR_MODULE, &pak_dir); + base::PathService::Get(base::DIR_MODULE, &pak_dir); #endif // OS_ANDROID pak_file = pak_dir.Append(FILE_PATH_LITERAL("components_tests_resources.pak")); @@ -135,7 +135,7 @@ class DistillerPageWebContentsTest : public ContentBrowserTest { void SetUpTestServer() { base::FilePath path; - PathService::Get(base::DIR_SOURCE_ROOT, &path); + base::PathService::Get(base::DIR_SOURCE_ROOT, &path); embedded_test_server()->ServeFilesFromDirectory( path.AppendASCII("components/test/data/dom_distiller")); embedded_test_server()->ServeFilesFromDirectory( diff --git a/chromium/components/dom_distiller/content/browser/dom_distiller_viewer_source_unittest.cc b/chromium/components/dom_distiller/content/browser/dom_distiller_viewer_source_unittest.cc index df1fa73cc9f..5238069e723 100644 --- a/chromium/components/dom_distiller/content/browser/dom_distiller_viewer_source_unittest.cc +++ b/chromium/components/dom_distiller/content/browser/dom_distiller_viewer_source_unittest.cc @@ -22,9 +22,8 @@ class DomDistillerViewerSourceTest : public testing::Test { }; TEST_F(DomDistillerViewerSourceTest, TestMimeType) { - EXPECT_EQ("text/css", source_.get()->GetMimeType(kViewerCssPath)); - EXPECT_EQ("text/html", source_.get()->GetMimeType("anythingelse")); - + EXPECT_EQ("text/css", source_->GetMimeType(kViewerCssPath)); + EXPECT_EQ("text/html", source_->GetMimeType("anythingelse")); } } // namespace dom_distiller diff --git a/chromium/components/dom_distiller/core/distiller.cc b/chromium/components/dom_distiller/core/distiller.cc index f3ebbd8f66c..e7417310609 100644 --- a/chromium/components/dom_distiller/core/distiller.cc +++ b/chromium/components/dom_distiller/core/distiller.cc @@ -159,7 +159,7 @@ void DistillerImpl::OnPageDistillationFinished( } } - DCHECK(distiller_result.get()); + DCHECK(distiller_result); DistilledPageData* page_data = GetPageAtIndex(started_pages_index_[page_num]); page_data->distilled_page_proto = @@ -311,7 +311,7 @@ void DistillerImpl::OnFetchImageDone(int page_num, const std::string& response) { DCHECK(started_pages_index_.find(page_num) != started_pages_index_.end()); DistilledPageData* page_data = GetPageAtIndex(started_pages_index_[page_num]); - DCHECK(page_data->distilled_page_proto.get()); + DCHECK(page_data->distilled_page_proto); DCHECK(url_fetcher); auto fetcher_it = std::find_if( page_data->image_fetchers_.begin(), page_data->image_fetchers_.end(), diff --git a/chromium/components/dom_distiller/core/distiller_unittest.cc b/chromium/components/dom_distiller/core/distiller_unittest.cc index d64a86234e3..3420e542d1b 100644 --- a/chromium/components/dom_distiller/core/distiller_unittest.cc +++ b/chromium/components/dom_distiller/core/distiller_unittest.cc @@ -18,6 +18,7 @@ #include "base/location.h" #include "base/macros.h" #include "base/message_loop/message_loop.h" +#include "base/message_loop/message_loop_current.h" #include "base/run_loop.h" #include "base/single_thread_task_runner.h" #include "base/strings/string_number_conversions.h" @@ -241,7 +242,7 @@ class TestDistillerURLFetcher : public DistillerURLFetcher { } void PostCallbackTask() { - ASSERT_TRUE(base::MessageLoop::current()); + ASSERT_TRUE(base::MessageLoopCurrent::Get()); ASSERT_FALSE(callback_.is_null()); base::ThreadTaskRunnerHandle::Get()->PostTask( FROM_HERE, base::Bind(callback_, responses_[url_])); @@ -267,7 +268,7 @@ class TestDistillerURLFetcherFactory : public DistillerURLFetcherFactory { class MockDistillerURLFetcherFactory : public DistillerURLFetcherFactory { public: MockDistillerURLFetcherFactory() : DistillerURLFetcherFactory(nullptr) {} - virtual ~MockDistillerURLFetcherFactory() {} + ~MockDistillerURLFetcherFactory() override {} MOCK_CONST_METHOD0(CreateDistillerURLFetcher, DistillerURLFetcher*()); }; diff --git a/chromium/components/dom_distiller/core/dom_distiller_request_view_base_unittest.cc b/chromium/components/dom_distiller/core/dom_distiller_request_view_base_unittest.cc index 102c2d5e5e7..f7d8dd9a1e5 100644 --- a/chromium/components/dom_distiller/core/dom_distiller_request_view_base_unittest.cc +++ b/chromium/components/dom_distiller/core/dom_distiller_request_view_base_unittest.cc @@ -194,7 +194,7 @@ TEST_F(DomDistillerRequestViewTest, TestContentNeverEmpty) { std::unique_ptr<ArticleDistillationUpdate> article_update( new ArticleDistillationUpdate(pages, false, false)); - handle.OnArticleUpdated(*article_update.get()); + handle.OnArticleUpdated(*article_update); EXPECT_THAT(handle.GetJavaScriptBuffer(), HasSubstr(no_content)); EXPECT_THAT(handle.GetJavaScriptBuffer(), Not(HasSubstr(valid_content))); @@ -220,7 +220,7 @@ TEST_F(DomDistillerRequestViewTest, TestLoadingIndicator) { std::unique_ptr<ArticleDistillationUpdate> article_update( new ArticleDistillationUpdate(pages, true, false)); - handle.OnArticleUpdated(*article_update.get()); + handle.OnArticleUpdated(*article_update); EXPECT_THAT(handle.GetJavaScriptBuffer(), HasSubstr(show_loader)); } diff --git a/chromium/components/dom_distiller/core/dom_distiller_service_unittest.cc b/chromium/components/dom_distiller/core/dom_distiller_service_unittest.cc index 027339337a6..2e2271d46fc 100644 --- a/chromium/components/dom_distiller/core/dom_distiller_service_unittest.cc +++ b/chromium/components/dom_distiller/core/dom_distiller_service_unittest.cc @@ -36,7 +36,7 @@ namespace { class FakeViewRequestDelegate : public ViewRequestDelegate { public: - virtual ~FakeViewRequestDelegate() {} + ~FakeViewRequestDelegate() override {} MOCK_METHOD1(OnArticleReady, void(const DistilledArticleProto* proto)); MOCK_METHOD1(OnArticleUpdated, void(ArticleDistillationUpdate article_update)); @@ -45,7 +45,7 @@ class FakeViewRequestDelegate : public ViewRequestDelegate { class MockDistillerObserver : public DomDistillerObserver { public: MOCK_METHOD1(ArticleEntriesUpdated, void(const std::vector<ArticleUpdate>&)); - virtual ~MockDistillerObserver() {} + ~MockDistillerObserver() override {} }; class MockArticleAvailableCallback { diff --git a/chromium/components/dom_distiller/core/dom_distiller_store_unittest.cc b/chromium/components/dom_distiller/core/dom_distiller_store_unittest.cc index 09cb30ee9ca..ce2a0fc27e2 100644 --- a/chromium/components/dom_distiller/core/dom_distiller_store_unittest.cc +++ b/chromium/components/dom_distiller/core/dom_distiller_store_unittest.cc @@ -122,7 +122,7 @@ ArticleEntry GetSampleEntry(int id) { class MockDistillerObserver : public DomDistillerObserver { public: MOCK_METHOD1(ArticleEntriesUpdated, void(const std::vector<ArticleUpdate>&)); - virtual ~MockDistillerObserver() {} + ~MockDistillerObserver() override {} }; } // namespace diff --git a/chromium/components/dom_distiller/core/fake_distiller.h b/chromium/components/dom_distiller/core/fake_distiller.h index 94092d0105c..ff020145f49 100644 --- a/chromium/components/dom_distiller/core/fake_distiller.h +++ b/chromium/components/dom_distiller/core/fake_distiller.h @@ -20,7 +20,7 @@ namespace test { class MockDistillerFactory : public DistillerFactory { public: MockDistillerFactory(); - virtual ~MockDistillerFactory(); + ~MockDistillerFactory() override; MOCK_METHOD0(CreateDistillerImpl, Distiller*()); std::unique_ptr<Distiller> CreateDistillerForUrl( const GURL& unused) override { diff --git a/chromium/components/dom_distiller/core/page_features_unittest.cc b/chromium/components/dom_distiller/core/page_features_unittest.cc index 0bfeb142d69..93795c34f4c 100644 --- a/chromium/components/dom_distiller/core/page_features_unittest.cc +++ b/chromium/components/dom_distiller/core/page_features_unittest.cc @@ -24,7 +24,7 @@ namespace dom_distiller { // done in Chromium matches that in the training pipeline. TEST(DomDistillerPageFeaturesTest, TestCalculateDerivedFeatures) { base::FilePath dir_source_root; - EXPECT_TRUE(PathService::Get(base::DIR_SOURCE_ROOT, &dir_source_root)); + EXPECT_TRUE(base::PathService::Get(base::DIR_SOURCE_ROOT, &dir_source_root)); std::string input_data; ASSERT_TRUE(base::ReadFileToString( dir_source_root.AppendASCII( diff --git a/chromium/components/dom_distiller/core/task_tracker_unittest.cc b/chromium/components/dom_distiller/core/task_tracker_unittest.cc index 8df60da74cc..5759cfa6bcb 100644 --- a/chromium/components/dom_distiller/core/task_tracker_unittest.cc +++ b/chromium/components/dom_distiller/core/task_tracker_unittest.cc @@ -22,7 +22,7 @@ namespace test { class FakeViewRequestDelegate : public ViewRequestDelegate { public: - virtual ~FakeViewRequestDelegate() {} + ~FakeViewRequestDelegate() override {} MOCK_METHOD1(OnArticleReady, void(const DistilledArticleProto* article_proto)); MOCK_METHOD1(OnArticleUpdated, diff --git a/chromium/components/dom_distiller/core/viewer_unittest.cc b/chromium/components/dom_distiller/core/viewer_unittest.cc index d064704d033..e7bfd5afd83 100644 --- a/chromium/components/dom_distiller/core/viewer_unittest.cc +++ b/chromium/components/dom_distiller/core/viewer_unittest.cc @@ -92,9 +92,9 @@ TEST_F(DomDistillerViewerTest, TestCreatingViewUrlRequest) { std::unique_ptr<FakeViewRequestDelegate> view_request_delegate( new FakeViewRequestDelegate()); ViewerHandle* viewer_handle(new ViewerHandle(ViewerHandle::CancelCallback())); - EXPECT_CALL(*service_.get(), ViewUrlImpl()) + EXPECT_CALL(*service_, ViewUrlImpl()) .WillOnce(testing::Return(viewer_handle)); - EXPECT_CALL(*service_.get(), ViewEntryImpl()).Times(0); + EXPECT_CALL(*service_, ViewEntryImpl()).Times(0); CreateViewRequest( std::string("?") + kUrlKey + "=http%3A%2F%2Fwww.example.com%2F", view_request_delegate.get()); @@ -104,9 +104,9 @@ TEST_F(DomDistillerViewerTest, TestCreatingViewEntryRequest) { std::unique_ptr<FakeViewRequestDelegate> view_request_delegate( new FakeViewRequestDelegate()); ViewerHandle* viewer_handle(new ViewerHandle(ViewerHandle::CancelCallback())); - EXPECT_CALL(*service_.get(), ViewEntryImpl()) + EXPECT_CALL(*service_, ViewEntryImpl()) .WillOnce(testing::Return(viewer_handle)); - EXPECT_CALL(*service_.get(), ViewUrlImpl()).Times(0); + EXPECT_CALL(*service_, ViewUrlImpl()).Times(0); CreateViewRequest(std::string("?") + kEntryIdKey + "=abc-def", view_request_delegate.get()); } @@ -114,8 +114,8 @@ TEST_F(DomDistillerViewerTest, TestCreatingViewEntryRequest) { TEST_F(DomDistillerViewerTest, TestCreatingInvalidViewRequest) { std::unique_ptr<FakeViewRequestDelegate> view_request_delegate( new FakeViewRequestDelegate()); - EXPECT_CALL(*service_.get(), ViewEntryImpl()).Times(0); - EXPECT_CALL(*service_.get(), ViewUrlImpl()).Times(0); + EXPECT_CALL(*service_, ViewEntryImpl()).Times(0); + EXPECT_CALL(*service_, ViewUrlImpl()).Times(0); // Specify none of the required query parameters. CreateViewRequest("?foo=bar", view_request_delegate.get()); // Specify both of the required query parameters. diff --git a/chromium/components/dom_distiller/standalone/content_extractor_browsertest.cc b/chromium/components/dom_distiller/standalone/content_extractor_browsertest.cc index c9014ca1c73..5acc5f380e6 100644 --- a/chromium/components/dom_distiller/standalone/content_extractor_browsertest.cc +++ b/chromium/components/dom_distiller/standalone/content_extractor_browsertest.cc @@ -11,7 +11,6 @@ #include "base/files/scoped_temp_dir.h" #include "base/location.h" #include "base/memory/ptr_util.h" -#include "base/message_loop/message_loop.h" #include "base/path_service.h" #include "base/run_loop.h" #include "base/single_thread_task_runner.h" @@ -186,7 +185,7 @@ std::unique_ptr<DomDistillerService> CreateDomDistillerService( void AddComponentsTestResources() { base::FilePath pak_file; base::FilePath pak_dir; - PathService::Get(base::DIR_MODULE, &pak_dir); + base::PathService::Get(base::DIR_MODULE, &pak_dir); pak_file = pak_dir.Append(FILE_PATH_LITERAL("components_tests_resources.pak")); ui::ResourceBundle::GetSharedInstance().AddDataPackFromPath( @@ -422,7 +421,7 @@ class ContentExtractor : public ContentBrowserTest { requests_.clear(); service_.reset(); base::ThreadTaskRunnerHandle::Get()->PostTask( - FROM_HERE, base::MessageLoop::QuitWhenIdleClosure()); + FROM_HERE, base::RunLoop::QuitCurrentWhenIdleClosureDeprecated()); } size_t pending_tasks_; |