Upstream version 5.34.104.0
[platform/framework/web/crosswalk.git] / src / components / dom_distiller / core / fake_distiller.h
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
3 // found in the LICENSE file.
4
5 #ifndef COMPONENTS_DOM_DISTILLER_CORE_FAKE_DISTILLER_H_
6 #define COMPONENTS_DOM_DISTILLER_CORE_FAKE_DISTILLER_H_
7
8 #include "components/dom_distiller/core/article_entry.h"
9 #include "components/dom_distiller/core/distiller.h"
10 #include "testing/gmock/include/gmock/gmock.h"
11 #include "url/gurl.h"
12
13 class GURL;
14
15 namespace dom_distiller {
16 namespace test {
17
18 class MockDistillerFactory : public DistillerFactory {
19  public:
20   MockDistillerFactory();
21   virtual ~MockDistillerFactory();
22   MOCK_METHOD0(CreateDistillerImpl, Distiller*());
23   virtual scoped_ptr<Distiller> CreateDistiller() OVERRIDE {
24     return scoped_ptr<Distiller>(CreateDistillerImpl());
25   }
26 };
27
28 class FakeDistiller : public Distiller {
29  public:
30   explicit FakeDistiller(bool execute_callback);
31   virtual ~FakeDistiller();
32   MOCK_METHOD0(Die, void());
33
34   virtual void DistillPage(const GURL& url,
35                            const DistillerCallback& callback) OVERRIDE;
36
37   void RunDistillerCallback(scoped_ptr<DistilledArticleProto> proto);
38
39   GURL GetUrl() { return url_; }
40
41   DistillerCallback GetCallback() { return callback_; }
42
43  private:
44   void RunDistillerCallbackInternal(scoped_ptr<DistilledArticleProto> proto);
45
46   bool execute_callback_;
47   GURL url_;
48   DistillerCallback callback_;
49 };
50
51 }  // namespace test
52 }  // namespace dom_distiller
53
54 #endif  // COMPONENTS_DOM_DISTILLER_CORE_FAKE_DISTILLER_H_