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

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

Issue 146843010: Add support for multipage distillation. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 11 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/fake_distiller.h ('k') | components/dom_distiller/core/page_distiller.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 3f1f976f653f3818ecace3fa45a1447548a025c3..e6cc9797a254ec9e4faeaf03e20e8c7f086a461d 100644
--- a/components/dom_distiller/core/fake_distiller.cc
+++ b/components/dom_distiller/core/fake_distiller.cc
@@ -14,14 +14,26 @@ namespace test {
MockDistillerFactory::MockDistillerFactory() {}
MockDistillerFactory::~MockDistillerFactory() {}
-FakeDistiller::FakeDistiller(bool execute_callback) :
- execute_callback_(execute_callback) {
+FakeDistiller::FakeDistiller(bool execute_callback)
+ : execute_callback_(execute_callback) {
EXPECT_CALL(*this, Die()).Times(testing::AnyNumber());
}
FakeDistiller::~FakeDistiller() { Die(); }
-void FakeDistiller::RunDistillerCallback(scoped_ptr<DistilledPageProto> proto) {
+void FakeDistiller::DistillPage(const GURL& url,
+ const DistillerCallback& callback) {
+ url_ = url;
+ callback_ = callback;
+ if (execute_callback_) {
+ scoped_ptr<DistilledArticleProto> proto(new DistilledArticleProto);
+ proto->add_pages()->set_url(url_.spec());
+ RunDistillerCallback(proto.Pass());
+ }
+}
+
+void FakeDistiller::RunDistillerCallback(
+ scoped_ptr<DistilledArticleProto> proto) {
base::MessageLoop::current()->PostTask(
FROM_HERE,
base::Bind(&FakeDistiller::RunDistillerCallbackInternal,
@@ -30,7 +42,7 @@ void FakeDistiller::RunDistillerCallback(scoped_ptr<DistilledPageProto> proto) {
}
void FakeDistiller::RunDistillerCallbackInternal(
- scoped_ptr<DistilledPageProto> proto) {
+ scoped_ptr<DistilledArticleProto> proto) {
EXPECT_FALSE(callback_.is_null());
callback_.Run(proto.Pass());
callback_.Reset();
« no previous file with comments | « components/dom_distiller/core/fake_distiller.h ('k') | components/dom_distiller/core/page_distiller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698