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

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

Issue 146843010: Add support for multipage distillation. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 10 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 #ifndef COMPONENTS_DOM_DISTILLER_CORE_FAKE_DISTILLER_H_ 5 #ifndef COMPONENTS_DOM_DISTILLER_CORE_FAKE_DISTILLER_H_
6 #define COMPONENTS_DOM_DISTILLER_CORE_FAKE_DISTILLER_H_ 6 #define COMPONENTS_DOM_DISTILLER_CORE_FAKE_DISTILLER_H_
7 7
8 #include "components/dom_distiller/core/article_entry.h" 8 #include "components/dom_distiller/core/article_entry.h"
9 #include "components/dom_distiller/core/distiller.h" 9 #include "components/dom_distiller/core/distiller.h"
10 #include "testing/gmock/include/gmock/gmock.h" 10 #include "testing/gmock/include/gmock/gmock.h"
11 #include "url/gurl.h" 11 #include "url/gurl.h"
12 12
13 class GURL; 13 class GURL;
14 14
15 namespace dom_distiller { 15 namespace dom_distiller {
16 namespace test { 16 namespace test {
17 17
18 class MockDistillerFactory : public DistillerFactory { 18 class MockDistillerFactory : public DistillerFactory {
19 public: 19 public:
20 MockDistillerFactory(); 20 MockDistillerFactory();
21 virtual ~MockDistillerFactory(); 21 virtual ~MockDistillerFactory();
22 MOCK_METHOD0(CreateDistillerImpl, Distiller*()); 22 MOCK_METHOD0(CreateDistillerImpl, Distiller*());
23 virtual scoped_ptr<Distiller> CreateDistiller() OVERRIDE { 23 virtual scoped_ptr<Distiller> CreateDistiller() OVERRIDE {
24 return scoped_ptr<Distiller>(CreateDistillerImpl()); 24 return scoped_ptr<Distiller>(CreateDistillerImpl());
25 } 25 }
26 }; 26 };
27 27
28 class FakeDistiller : public Distiller { 28 class FakeDistiller : public Distiller {
29 public: 29 public:
30 FakeDistiller(bool execute_callback); 30 explicit FakeDistiller(bool execute_callback);
31 virtual ~FakeDistiller(); 31 virtual ~FakeDistiller();
32 MOCK_METHOD0(Die, void()); 32 MOCK_METHOD0(Die, void());
33 33
34 virtual void DistillPage(const GURL& url, 34 virtual void DistillPage(const GURL& url,
35 const DistillerCallback& callback) OVERRIDE { 35 const DistillerCallback& callback) OVERRIDE;
36 url_ = url;
37 callback_ = callback;
38 if (execute_callback_) {
39 RunDistillerCallback(make_scoped_ptr(new DistilledPageProto));
40 }
41 }
42 36
43 void RunDistillerCallback(scoped_ptr<DistilledPageProto> proto); 37 void RunDistillerCallback(scoped_ptr<DistilledArticleProto> proto);
44 38
45 GURL GetUrl() { return url_; } 39 GURL GetUrl() { return url_; }
46 40
47 DistillerCallback GetCallback() { return callback_; } 41 DistillerCallback GetCallback() { return callback_; }
48 42
49 private: 43 private:
50 void RunDistillerCallbackInternal(scoped_ptr<DistilledPageProto> proto); 44 void RunDistillerCallbackInternal(scoped_ptr<DistilledArticleProto> proto);
51 45
52 bool execute_callback_; 46 bool execute_callback_;
53 GURL url_; 47 GURL url_;
54 DistillerCallback callback_; 48 DistillerCallback callback_;
55 }; 49 };
56 50
57 } // namespace test 51 } // namespace test
58 } // namespace dom_distiller 52 } // namespace dom_distiller
59 53
60 #endif // COMPONENTS_DOM_DISTILLER_CORE_FAKE_DISTILLER_H_ 54 #endif // COMPONENTS_DOM_DISTILLER_CORE_FAKE_DISTILLER_H_
OLDNEW
« no previous file with comments | « components/dom_distiller/core/dom_distiller_service_unittest.cc ('k') | components/dom_distiller/core/fake_distiller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698