| OLD | NEW |
| 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_distillation_update.h" | 8 #include "components/dom_distiller/core/article_distillation_update.h" |
| 9 #include "components/dom_distiller/core/article_entry.h" | 9 #include "components/dom_distiller/core/article_entry.h" |
| 10 #include "components/dom_distiller/core/distiller.h" | 10 #include "components/dom_distiller/core/distiller.h" |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 | 28 |
| 29 class FakeDistiller : public Distiller { | 29 class FakeDistiller : public Distiller { |
| 30 public: | 30 public: |
| 31 // If execute_callback is true, when DistillPage is called, a task will | 31 // If execute_callback is true, when DistillPage is called, a task will |
| 32 // immediately be posted to execute the callback with a simple | 32 // immediately be posted to execute the callback with a simple |
| 33 // DistilledArticleProto. | 33 // DistilledArticleProto. |
| 34 explicit FakeDistiller(bool execute_callback); | 34 explicit FakeDistiller(bool execute_callback); |
| 35 virtual ~FakeDistiller(); | 35 virtual ~FakeDistiller(); |
| 36 MOCK_METHOD0(Die, void()); | 36 MOCK_METHOD0(Die, void()); |
| 37 | 37 |
| 38 virtual void DistillPage(const GURL& url, | 38 virtual void DistillPage( |
| 39 const DistillationFinishedCallback& article_callback, | 39 const GURL& url, |
| 40 const DistillationUpdateCallback& page_callback) | 40 scoped_ptr<DistillerPage> distiller_page, |
| 41 OVERRIDE; | 41 const DistillationFinishedCallback& article_callback, |
| 42 const DistillationUpdateCallback& page_callback) OVERRIDE; |
| 42 | 43 |
| 43 void RunDistillerCallback(scoped_ptr<DistilledArticleProto> proto); | 44 void RunDistillerCallback(scoped_ptr<DistilledArticleProto> proto); |
| 44 | 45 |
| 45 GURL GetUrl() { return url_; } | 46 GURL GetUrl() { return url_; } |
| 46 | 47 |
| 47 DistillationFinishedCallback GetArticleCallback() { | 48 DistillationFinishedCallback GetArticleCallback() { |
| 48 return article_callback_; | 49 return article_callback_; |
| 49 } | 50 } |
| 50 | 51 |
| 51 private: | 52 private: |
| 52 void PostDistillerCallback(scoped_ptr<DistilledArticleProto> proto); | 53 void PostDistillerCallback(scoped_ptr<DistilledArticleProto> proto); |
| 53 void RunDistillerCallbackInternal(scoped_ptr<DistilledArticleProto> proto); | 54 void RunDistillerCallbackInternal(scoped_ptr<DistilledArticleProto> proto); |
| 54 | 55 |
| 55 bool execute_callback_; | 56 bool execute_callback_; |
| 56 GURL url_; | 57 GURL url_; |
| 57 DistillationFinishedCallback article_callback_; | 58 DistillationFinishedCallback article_callback_; |
| 58 DistillationUpdateCallback page_callback_; | 59 DistillationUpdateCallback page_callback_; |
| 59 | 60 |
| 60 bool destruction_allowed_; | 61 bool destruction_allowed_; |
| 61 }; | 62 }; |
| 62 | 63 |
| 63 } // namespace test | 64 } // namespace test |
| 64 } // namespace dom_distiller | 65 } // namespace dom_distiller |
| 65 | 66 |
| 66 #endif // COMPONENTS_DOM_DISTILLER_CORE_FAKE_DISTILLER_H_ | 67 #endif // COMPONENTS_DOM_DISTILLER_CORE_FAKE_DISTILLER_H_ |
| OLD | NEW |