| 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..8211032fc9f08af8adfe55ab6d338e8c06a78f66 100644
|
| --- a/components/dom_distiller/core/fake_distiller.cc
|
| +++ b/components/dom_distiller/core/fake_distiller.cc
|
| @@ -6,6 +6,7 @@
|
|
|
| #include "base/auto_reset.h"
|
| #include "base/bind.h"
|
| +#include "base/callback_helpers.h"
|
| #include "base/message_loop/message_loop.h"
|
| #include "testing/gtest/include/gtest/gtest.h"
|
|
|
| @@ -21,6 +22,15 @@ FakeDistiller::FakeDistiller(bool execute_callback)
|
| EXPECT_CALL(*this, Die()).Times(testing::AnyNumber());
|
| }
|
|
|
| +FakeDistiller::FakeDistiller(
|
| + bool execute_callback,
|
| + const base::Closure& distillation_initiated_callback)
|
| + : execute_callback_(execute_callback),
|
| + destruction_allowed_(true),
|
| + distillation_initiated_callback_(distillation_initiated_callback) {
|
| + EXPECT_CALL(*this, Die()).Times(testing::AnyNumber());
|
| +}
|
| +
|
| FakeDistiller::~FakeDistiller() {
|
| EXPECT_TRUE(destruction_allowed_);
|
| Die();
|
| @@ -34,6 +44,9 @@ void FakeDistiller::DistillPage(
|
| url_ = url;
|
| article_callback_ = article_callback;
|
| page_callback_ = page_callback;
|
| + if (!distillation_initiated_callback_.is_null()) {
|
| + base::ResetAndReturn(&distillation_initiated_callback_).Run();
|
| + }
|
| if (execute_callback_) {
|
| scoped_ptr<DistilledArticleProto> proto(new DistilledArticleProto);
|
| proto->add_pages()->set_url(url_.spec());
|
| @@ -49,6 +62,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(
|
|
|