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

Unified Diff: components/dom_distiller/core/task_tracker_unittest.cc

Issue 1879613003: Convert //components/dom_distiller from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 8 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
« no previous file with comments | « components/dom_distiller/core/task_tracker.cc ('k') | components/dom_distiller/core/viewer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/dom_distiller/core/task_tracker_unittest.cc
diff --git a/components/dom_distiller/core/task_tracker_unittest.cc b/components/dom_distiller/core/task_tracker_unittest.cc
index bb5adce1ff53ada4e870127d76f40bba3f4285c3..b760b4abf8266894d8ce61704ad65607b7cb1c4c 100644
--- a/components/dom_distiller/core/task_tracker_unittest.cc
+++ b/components/dom_distiller/core/task_tracker_unittest.cc
@@ -77,7 +77,7 @@ class DomDistillerTaskTrackerTest : public testing::Test {
}
protected:
- scoped_ptr<base::MessageLoop> message_loop_;
+ std::unique_ptr<base::MessageLoop> message_loop_;
std::string entry_id_;
GURL page_0_url_;
GURL page_1_url_;
@@ -110,8 +110,10 @@ TEST_F(DomDistillerTaskTrackerTest, TestViewerCancelled) {
FakeViewRequestDelegate viewer_delegate;
FakeViewRequestDelegate viewer_delegate2;
- scoped_ptr<ViewerHandle> handle(task_tracker.AddViewer(&viewer_delegate));
- scoped_ptr<ViewerHandle> handle2(task_tracker.AddViewer(&viewer_delegate2));
+ std::unique_ptr<ViewerHandle> handle(
+ task_tracker.AddViewer(&viewer_delegate));
+ std::unique_ptr<ViewerHandle> handle2(
+ task_tracker.AddViewer(&viewer_delegate2));
EXPECT_FALSE(cancel_callback.Cancelled());
handle.reset();
@@ -127,7 +129,8 @@ TEST_F(DomDistillerTaskTrackerTest, TestViewerCancelledWithSaveRequest) {
GetDefaultEntry(), cancel_callback.GetCallback(), NULL);
FakeViewRequestDelegate viewer_delegate;
- scoped_ptr<ViewerHandle> handle(task_tracker.AddViewer(&viewer_delegate));
+ std::unique_ptr<ViewerHandle> handle(
+ task_tracker.AddViewer(&viewer_delegate));
EXPECT_FALSE(cancel_callback.Cancelled());
MockSaveCallback save_callback;
@@ -149,12 +152,14 @@ TEST_F(DomDistillerTaskTrackerTest, TestViewerNotifiedOnDistillationComplete) {
GetDefaultEntry(), cancel_callback.GetCallback(), NULL);
FakeViewRequestDelegate viewer_delegate;
- scoped_ptr<ViewerHandle> handle(task_tracker.AddViewer(&viewer_delegate));
+ std::unique_ptr<ViewerHandle> handle(
+ task_tracker.AddViewer(&viewer_delegate));
base::RunLoop().RunUntilIdle();
EXPECT_CALL(viewer_delegate, OnArticleReady(_));
- task_tracker.StartDistiller(&distiller_factory, scoped_ptr<DistillerPage>());
+ task_tracker.StartDistiller(&distiller_factory,
+ std::unique_ptr<DistillerPage>());
base::RunLoop().RunUntilIdle();
EXPECT_FALSE(cancel_callback.Cancelled());
@@ -171,14 +176,16 @@ TEST_F(DomDistillerTaskTrackerTest, TestDistillerFails) {
GetDefaultEntry(), cancel_callback.GetCallback(), NULL);
FakeViewRequestDelegate viewer_delegate;
- scoped_ptr<ViewerHandle> handle(task_tracker.AddViewer(&viewer_delegate));
+ std::unique_ptr<ViewerHandle> handle(
+ task_tracker.AddViewer(&viewer_delegate));
base::RunLoop().RunUntilIdle();
EXPECT_CALL(viewer_delegate, OnArticleReady(_));
- task_tracker.StartDistiller(&distiller_factory, scoped_ptr<DistillerPage>());
+ task_tracker.StartDistiller(&distiller_factory,
+ std::unique_ptr<DistillerPage>());
distiller->RunDistillerCallback(
- scoped_ptr<DistilledArticleProto>(new DistilledArticleProto));
+ std::unique_ptr<DistilledArticleProto>(new DistilledArticleProto));
base::RunLoop().RunUntilIdle();
EXPECT_FALSE(cancel_callback.Cancelled());
@@ -201,7 +208,8 @@ TEST_F(DomDistillerTaskTrackerTest,
EXPECT_CALL(save_callback, Save(_, _, _));
- task_tracker.StartDistiller(&distiller_factory, scoped_ptr<DistillerPage>());
+ task_tracker.StartDistiller(&distiller_factory,
+ std::unique_ptr<DistillerPage>());
base::RunLoop().RunUntilIdle();
EXPECT_TRUE(cancel_callback.Cancelled());
@@ -230,7 +238,8 @@ TEST_F(DomDistillerTaskTrackerTest, TestBlobFetcher) {
entry_with_blob, cancel_callback.GetCallback(), &content_store);
FakeViewRequestDelegate viewer_delegate;
- scoped_ptr<ViewerHandle> handle(task_tracker.AddViewer(&viewer_delegate));
+ std::unique_ptr<ViewerHandle> handle(
+ task_tracker.AddViewer(&viewer_delegate));
base::RunLoop().RunUntilIdle();
const DistilledArticleProto* distilled_article;
@@ -263,7 +272,8 @@ TEST_F(DomDistillerTaskTrackerTest, TestBlobFetcherFinishesFirst) {
entry_with_blob, cancel_callback.GetCallback(), &content_store);
FakeViewRequestDelegate viewer_delegate;
- scoped_ptr<ViewerHandle> handle(task_tracker.AddViewer(&viewer_delegate));
+ std::unique_ptr<ViewerHandle> handle(
+ task_tracker.AddViewer(&viewer_delegate));
base::RunLoop().RunUntilIdle();
DistilledArticleProto distilled_article;
@@ -274,7 +284,8 @@ TEST_F(DomDistillerTaskTrackerTest, TestBlobFetcherFinishesFirst) {
EXPECT_CALL(*distiller, Die())
.WillOnce(testing::Assign(&distiller_destroyed, true));
- task_tracker.StartDistiller(&distiller_factory, scoped_ptr<DistillerPage>());
+ task_tracker.StartDistiller(&distiller_factory,
+ std::unique_ptr<DistillerPage>());
task_tracker.StartBlobFetcher();
base::RunLoop().RunUntilIdle();
@@ -295,7 +306,7 @@ TEST_F(DomDistillerTaskTrackerTest, TestBlobFetcherWithoutBlob) {
ArticleEntry entry(GetDefaultEntry());
InMemoryContentStore content_store(kDefaultMaxNumCachedEntries);
- scoped_ptr<DistilledArticleProto> distilled_article(
+ std::unique_ptr<DistilledArticleProto> distilled_article(
new DistilledArticleProto(CreateDistilledArticleForEntry(entry)));
TestCancelCallback cancel_callback;
@@ -303,11 +314,13 @@ TEST_F(DomDistillerTaskTrackerTest, TestBlobFetcherWithoutBlob) {
GetDefaultEntry(), cancel_callback.GetCallback(), &content_store);
FakeViewRequestDelegate viewer_delegate;
- scoped_ptr<ViewerHandle> handle(task_tracker.AddViewer(&viewer_delegate));
+ std::unique_ptr<ViewerHandle> handle(
+ task_tracker.AddViewer(&viewer_delegate));
base::RunLoop().RunUntilIdle();
task_tracker.StartBlobFetcher();
- task_tracker.StartDistiller(&distiller_factory, scoped_ptr<DistillerPage>());
+ task_tracker.StartDistiller(&distiller_factory,
+ std::unique_ptr<DistillerPage>());
// OnArticleReady shouldn't be called until distillation finishes (i.e. the
// blob fetcher shouldn't return distilled content).
@@ -335,25 +348,26 @@ TEST_F(DomDistillerTaskTrackerTest, TestDistillerFailsFirst) {
GetDefaultEntry(), cancel_callback.GetCallback(), &content_store);
FakeViewRequestDelegate viewer_delegate;
- scoped_ptr<ViewerHandle> handle(task_tracker.AddViewer(&viewer_delegate));
+ std::unique_ptr<ViewerHandle> handle(
+ task_tracker.AddViewer(&viewer_delegate));
DistilledContentStore::LoadCallback content_store_load_callback;
EXPECT_CALL(content_store, LoadContent(_, _))
.WillOnce(testing::SaveArg<1>(&content_store_load_callback));
- task_tracker.StartDistiller(&distiller_factory, scoped_ptr<DistillerPage>());
+ task_tracker.StartDistiller(&distiller_factory,
+ std::unique_ptr<DistillerPage>());
task_tracker.StartBlobFetcher();
EXPECT_CALL(viewer_delegate, OnArticleReady(_)).Times(0);
distiller->RunDistillerCallback(
- scoped_ptr<DistilledArticleProto>(new DistilledArticleProto));
+ std::unique_ptr<DistilledArticleProto>(new DistilledArticleProto));
base::RunLoop().RunUntilIdle();
EXPECT_CALL(viewer_delegate, OnArticleReady(_));
content_store_load_callback.Run(
- true,
- scoped_ptr<DistilledArticleProto>(
- new DistilledArticleProto(CreateDistilledArticleForEntry(entry))));
+ true, std::unique_ptr<DistilledArticleProto>(new DistilledArticleProto(
+ CreateDistilledArticleForEntry(entry))));
base::RunLoop().RunUntilIdle();
EXPECT_FALSE(cancel_callback.Cancelled());
@@ -375,17 +389,19 @@ TEST_F(DomDistillerTaskTrackerTest, ContentIsSaved) {
GetDefaultEntry(), cancel_callback.GetCallback(), &content_store);
FakeViewRequestDelegate viewer_delegate;
- scoped_ptr<ViewerHandle> handle(task_tracker.AddViewer(&viewer_delegate));
+ std::unique_ptr<ViewerHandle> handle(
+ task_tracker.AddViewer(&viewer_delegate));
DistilledArticleProto stored_distilled_article;
DistilledContentStore::LoadCallback content_store_load_callback;
EXPECT_CALL(content_store, SaveContent(_, _, _))
.WillOnce(testing::SaveArg<1>(&stored_distilled_article));
- task_tracker.StartDistiller(&distiller_factory, scoped_ptr<DistillerPage>());
+ task_tracker.StartDistiller(&distiller_factory,
+ std::unique_ptr<DistillerPage>());
EXPECT_CALL(viewer_delegate, OnArticleReady(_));
- distiller->RunDistillerCallback(scoped_ptr<DistilledArticleProto>(
+ distiller->RunDistillerCallback(std::unique_ptr<DistilledArticleProto>(
new DistilledArticleProto(distilled_article)));
base::RunLoop().RunUntilIdle();
« no previous file with comments | « components/dom_distiller/core/task_tracker.cc ('k') | components/dom_distiller/core/viewer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698