| 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_entry.h" | 9 #include "components/dom_distiller/core/article_entry.h" |
| 9 #include "components/dom_distiller/core/distiller.h" | 10 #include "components/dom_distiller/core/distiller.h" |
| 10 #include "testing/gmock/include/gmock/gmock.h" | 11 #include "testing/gmock/include/gmock/gmock.h" |
| 11 #include "url/gurl.h" | 12 #include "url/gurl.h" |
| 12 | 13 |
| 13 class GURL; | 14 class GURL; |
| 14 | 15 |
| 15 namespace dom_distiller { | 16 namespace dom_distiller { |
| 16 namespace test { | 17 namespace test { |
| 17 | 18 |
| 18 class MockDistillerFactory : public DistillerFactory { | 19 class MockDistillerFactory : public DistillerFactory { |
| 19 public: | 20 public: |
| 20 MockDistillerFactory(); | 21 MockDistillerFactory(); |
| 21 virtual ~MockDistillerFactory(); | 22 virtual ~MockDistillerFactory(); |
| 22 MOCK_METHOD0(CreateDistillerImpl, Distiller*()); | 23 MOCK_METHOD0(CreateDistillerImpl, Distiller*()); |
| 23 virtual scoped_ptr<Distiller> CreateDistiller() OVERRIDE { | 24 virtual scoped_ptr<Distiller> CreateDistiller() OVERRIDE { |
| 24 return scoped_ptr<Distiller>(CreateDistillerImpl()); | 25 return scoped_ptr<Distiller>(CreateDistillerImpl()); |
| 25 } | 26 } |
| 26 }; | 27 }; |
| 27 | 28 |
| 28 class FakeDistiller : public Distiller { | 29 class FakeDistiller : public Distiller { |
| 29 public: | 30 public: |
| 30 explicit FakeDistiller(bool execute_callback); | 31 explicit FakeDistiller(bool execute_callback); |
| 31 virtual ~FakeDistiller(); | 32 virtual ~FakeDistiller(); |
| 32 MOCK_METHOD0(Die, void()); | 33 MOCK_METHOD0(Die, void()); |
| 33 | 34 |
| 34 virtual void DistillPage(const GURL& url, | 35 virtual void DistillPage(const GURL& url, |
| 35 const DistillerCallback& callback) OVERRIDE; | 36 const DistillationFinishedCallback& article_callback, |
| 37 const DistillationUpdateCallback& page_callback) |
| 38 OVERRIDE; |
| 36 | 39 |
| 37 void RunDistillerCallback(scoped_ptr<DistilledArticleProto> proto); | 40 void RunDistillerCallback(scoped_ptr<DistilledArticleProto> proto); |
| 38 | 41 |
| 39 GURL GetUrl() { return url_; } | 42 GURL GetUrl() { return url_; } |
| 40 | 43 |
| 41 DistillerCallback GetCallback() { return callback_; } | 44 DistillationFinishedCallback GetArticleCallback() { |
| 45 return article_callback_; |
| 46 } |
| 42 | 47 |
| 43 private: | 48 private: |
| 44 void RunDistillerCallbackInternal(scoped_ptr<DistilledArticleProto> proto); | 49 void RunDistillerCallbackInternal(scoped_ptr<DistilledArticleProto> proto); |
| 45 | 50 |
| 46 bool execute_callback_; | 51 bool execute_callback_; |
| 47 GURL url_; | 52 GURL url_; |
| 48 DistillerCallback callback_; | 53 DistillationFinishedCallback article_callback_; |
| 54 DistillationUpdateCallback page_callback_; |
| 49 }; | 55 }; |
| 50 | 56 |
| 51 } // namespace test | 57 } // namespace test |
| 52 } // namespace dom_distiller | 58 } // namespace dom_distiller |
| 53 | 59 |
| 54 #endif // COMPONENTS_DOM_DISTILLER_CORE_FAKE_DISTILLER_H_ | 60 #endif // COMPONENTS_DOM_DISTILLER_CORE_FAKE_DISTILLER_H_ |
| OLD | NEW |