Index: components/dom_distiller/core/fake_distiller.cc |
diff --git a/components/dom_distiller/core/fake_distiller.cc b/components/dom_distiller/core/fake_distiller.cc |
index bb5ef92b37bbb1dc4efd365dcd8fdfd03fa3114f..7bd649e7ce128eeae990c5f51a3ccf439aa19a0b 100644 |
--- a/components/dom_distiller/core/fake_distiller.cc |
+++ b/components/dom_distiller/core/fake_distiller.cc |
@@ -7,6 +7,7 @@ |
#include "base/auto_reset.h" |
#include "base/bind.h" |
#include "base/message_loop/message_loop.h" |
+#include "content/public/test/test_utils.h" |
#include "testing/gtest/include/gtest/gtest.h" |
namespace dom_distiller { |
@@ -17,7 +18,16 @@ MockDistillerFactory::~MockDistillerFactory() {} |
FakeDistiller::FakeDistiller(bool execute_callback) |
: execute_callback_(execute_callback), |
- destruction_allowed_(true) { |
+ destruction_allowed_(true), |
+ runner_(NULL) { |
+ EXPECT_CALL(*this, Die()).Times(testing::AnyNumber()); |
+} |
+ |
+FakeDistiller::FakeDistiller(bool execute_callback, |
+ content::MessageLoopRunner* runner) |
+ : execute_callback_(execute_callback), |
+ destruction_allowed_(true), |
+ runner_(runner) { |
EXPECT_CALL(*this, Die()).Times(testing::AnyNumber()); |
} |
@@ -34,6 +44,11 @@ void FakeDistiller::DistillPage( |
url_ = url; |
article_callback_ = article_callback; |
page_callback_ = page_callback; |
+ if (runner_) { |
+ base::MessageLoop::current()->PostTask( |
+ FROM_HERE, |
+ runner_->QuitClosure()); |
+ } |
if (execute_callback_) { |
scoped_ptr<DistilledArticleProto> proto(new DistilledArticleProto); |
proto->add_pages()->set_url(url_.spec()); |
@@ -49,6 +64,12 @@ void FakeDistiller::RunDistillerCallback( |
PostDistillerCallback(proto.Pass()); |
} |
+void FakeDistiller::RunDistillerUpdateCallback( |
+ const ArticleDistillationUpdate& update) { |
+ page_callback_.Run(update); |
+} |
+ |
+ |
void FakeDistiller::PostDistillerCallback( |
scoped_ptr<DistilledArticleProto> proto) { |
base::MessageLoop::current()->PostTask( |