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

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

Issue 575883002: Fix handling of failed distillation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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/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 aeb1e95bb56e39de774db9b940ff05a7636865fc..0f2a4b7a01123712b3fb55e3ccf3dec9257eaad2 100644
--- a/components/dom_distiller/core/task_tracker_unittest.cc
+++ b/components/dom_distiller/core/task_tracker_unittest.cc
@@ -159,6 +159,31 @@ TEST_F(DomDistillerTaskTrackerTest, TestViewerNotifiedOnDistillationComplete) {
EXPECT_FALSE(cancel_callback.Cancelled());
}
+TEST_F(DomDistillerTaskTrackerTest, TestDistillerFails) {
+ MockDistillerFactory distiller_factory;
+ FakeDistiller* distiller = new FakeDistiller(false);
+ EXPECT_CALL(distiller_factory, CreateDistillerImpl())
+ .WillOnce(Return(distiller));
+
+ TestCancelCallback cancel_callback;
+ TaskTracker task_tracker(
+ GetDefaultEntry(), cancel_callback.GetCallback(), NULL);
+
+ FakeViewRequestDelegate viewer_delegate;
+ scoped_ptr<ViewerHandle> handle(task_tracker.AddViewer(&viewer_delegate));
+ base::RunLoop().RunUntilIdle();
+
+ EXPECT_CALL(viewer_delegate, OnArticleReady(_));
+
+ task_tracker.StartDistiller(&distiller_factory,
+ scoped_ptr<DistillerPage>().Pass());
+ distiller->RunDistillerCallback(
+ scoped_ptr<DistilledArticleProto>(new DistilledArticleProto));
+ base::RunLoop().RunUntilIdle();
+
+ EXPECT_FALSE(cancel_callback.Cancelled());
+}
+
TEST_F(DomDistillerTaskTrackerTest,
TestSaveCallbackCalledOnDistillationComplete) {
MockDistillerFactory distiller_factory;
« no previous file with comments | « components/dom_distiller/core/task_tracker.cc ('k') | components/dom_distiller/standalone/content_extractor.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698