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

Side by Side Diff: components/dom_distiller/core/fake_distiller.cc

Issue 254483003: Start requiring DistillerPage for calls to DomDistillerService. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Indent fixes (full git cl format) Created 6 years, 7 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "components/dom_distiller/core/fake_distiller.h" 5 #include "components/dom_distiller/core/fake_distiller.h"
6 6
7 #include "base/auto_reset.h" 7 #include "base/auto_reset.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
(...skipping 10 matching lines...) Expand all
21 EXPECT_CALL(*this, Die()).Times(testing::AnyNumber()); 21 EXPECT_CALL(*this, Die()).Times(testing::AnyNumber());
22 } 22 }
23 23
24 FakeDistiller::~FakeDistiller() { 24 FakeDistiller::~FakeDistiller() {
25 EXPECT_TRUE(destruction_allowed_); 25 EXPECT_TRUE(destruction_allowed_);
26 Die(); 26 Die();
27 } 27 }
28 28
29 void FakeDistiller::DistillPage( 29 void FakeDistiller::DistillPage(
30 const GURL& url, 30 const GURL& url,
31 scoped_ptr<DistillerPage> distiller_page,
31 const DistillationFinishedCallback& article_callback, 32 const DistillationFinishedCallback& article_callback,
32 const DistillationUpdateCallback& page_callback) { 33 const DistillationUpdateCallback& page_callback) {
33 url_ = url; 34 url_ = url;
34 article_callback_ = article_callback; 35 article_callback_ = article_callback;
35 page_callback_ = page_callback; 36 page_callback_ = page_callback;
36 if (execute_callback_) { 37 if (execute_callback_) {
37 scoped_ptr<DistilledArticleProto> proto(new DistilledArticleProto); 38 scoped_ptr<DistilledArticleProto> proto(new DistilledArticleProto);
38 proto->add_pages()->set_url(url_.spec()); 39 proto->add_pages()->set_url(url_.spec());
39 PostDistillerCallback(proto.Pass()); 40 PostDistillerCallback(proto.Pass());
40 } 41 }
(...skipping 21 matching lines...) Expand all
62 EXPECT_FALSE(article_callback_.is_null()); 63 EXPECT_FALSE(article_callback_.is_null());
63 64
64 base::AutoReset<bool> dont_delete_this_in_callback(&destruction_allowed_, 65 base::AutoReset<bool> dont_delete_this_in_callback(&destruction_allowed_,
65 false); 66 false);
66 article_callback_.Run(proto.Pass()); 67 article_callback_.Run(proto.Pass());
67 article_callback_.Reset(); 68 article_callback_.Reset();
68 } 69 }
69 70
70 } // namespace test 71 } // namespace test
71 } // namespace dom_distiller 72 } // namespace dom_distiller
OLDNEW
« no previous file with comments | « components/dom_distiller/core/fake_distiller.h ('k') | components/dom_distiller/core/fake_distiller_page.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698