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

Side by Side Diff: components/dom_distiller/core/viewer_unittest.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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/viewer.h" 5 #include "components/dom_distiller/core/viewer.h"
6 6
7 #include "components/dom_distiller/core/dom_distiller_service.h" 7 #include "components/dom_distiller/core/dom_distiller_service.h"
8 #include "components/dom_distiller/core/dom_distiller_test_util.h" 8 #include "components/dom_distiller/core/dom_distiller_test_util.h"
9 #include "components/dom_distiller/core/task_tracker.h" 9 #include "components/dom_distiller/core/task_tracker.h"
10 #include "components/dom_distiller/core/url_constants.h" 10 #include "components/dom_distiller/core/url_constants.h"
(...skipping 10 matching lines...) Expand all
21 MOCK_METHOD1(OnArticleUpdated, 21 MOCK_METHOD1(OnArticleUpdated,
22 void(ArticleDistillationUpdate article_update)); 22 void(ArticleDistillationUpdate article_update));
23 }; 23 };
24 24
25 class TestDomDistillerService : public DomDistillerServiceInterface { 25 class TestDomDistillerService : public DomDistillerServiceInterface {
26 public: 26 public:
27 TestDomDistillerService() {} 27 TestDomDistillerService() {}
28 virtual ~TestDomDistillerService() {} 28 virtual ~TestDomDistillerService() {}
29 29
30 MOCK_CONST_METHOD0(GetSyncableService, syncer::SyncableService*()); 30 MOCK_CONST_METHOD0(GetSyncableService, syncer::SyncableService*());
31 MOCK_METHOD2(AddToList, 31 MOCK_METHOD3(AddToList,
32 const std::string(const GURL&, const ArticleAvailableCallback&)); 32 const std::string(const GURL&,
33 DistillerPage*,
34 const ArticleAvailableCallback&));
35 virtual const std::string AddToList(
36 const GURL& url,
37 scoped_ptr<DistillerPage> distiller_page,
38 const ArticleAvailableCallback& article_cb) {
39 return AddToList(url, distiller_page.get(), article_cb);
40 }
33 MOCK_CONST_METHOD0(GetEntries, std::vector<ArticleEntry>()); 41 MOCK_CONST_METHOD0(GetEntries, std::vector<ArticleEntry>());
34 MOCK_METHOD1(AddObserver, void(DomDistillerObserver*)); 42 MOCK_METHOD1(AddObserver, void(DomDistillerObserver*));
35 MOCK_METHOD1(RemoveObserver, void(DomDistillerObserver*)); 43 MOCK_METHOD1(RemoveObserver, void(DomDistillerObserver*));
36 MOCK_METHOD0(ViewUrlImpl, ViewerHandle*()); 44 MOCK_METHOD0(ViewUrlImpl, ViewerHandle*());
37 virtual scoped_ptr<ViewerHandle> ViewUrl(ViewRequestDelegate*, const GURL&) { 45 virtual scoped_ptr<ViewerHandle> ViewUrl(
46 ViewRequestDelegate*,
47 scoped_ptr<DistillerPage> distiller_page,
48 const GURL&) {
38 return scoped_ptr<ViewerHandle>(ViewUrlImpl()); 49 return scoped_ptr<ViewerHandle>(ViewUrlImpl());
39 } 50 }
40 MOCK_METHOD0(ViewEntryImpl, ViewerHandle*()); 51 MOCK_METHOD0(ViewEntryImpl, ViewerHandle*());
41 virtual scoped_ptr<ViewerHandle> ViewEntry(ViewRequestDelegate*, 52 virtual scoped_ptr<ViewerHandle> ViewEntry(
42 const std::string&) { 53 ViewRequestDelegate*,
54 scoped_ptr<DistillerPage> distiller_page,
55 const std::string&) {
43 return scoped_ptr<ViewerHandle>(ViewEntryImpl()); 56 return scoped_ptr<ViewerHandle>(ViewEntryImpl());
44 } 57 }
45 MOCK_METHOD0(RemoveEntryImpl, ArticleEntry*()); 58 MOCK_METHOD0(RemoveEntryImpl, ArticleEntry*());
46 virtual scoped_ptr<ArticleEntry> RemoveEntry(const std::string&) { 59 virtual scoped_ptr<ArticleEntry> RemoveEntry(const std::string&) {
47 return scoped_ptr<ArticleEntry>(RemoveEntryImpl()); 60 return scoped_ptr<ArticleEntry>(RemoveEntryImpl());
48 } 61 }
62 virtual scoped_ptr<DistillerPage> CreateDefaultDistillerPage() {
63 return scoped_ptr<DistillerPage>();
64 }
49 }; 65 };
50 66
51 class DomDistillerViewerTest : public testing::Test { 67 class DomDistillerViewerTest : public testing::Test {
52 public: 68 public:
53 virtual void SetUp() OVERRIDE { 69 virtual void SetUp() OVERRIDE {
54 service_.reset(new TestDomDistillerService()); 70 service_.reset(new TestDomDistillerService());
55 } 71 }
56 72
57 protected: 73 protected:
58 scoped_ptr<ViewerHandle> CreateViewRequest( 74 scoped_ptr<ViewerHandle> CreateViewRequest(
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 // Specify an internal Chrome page. 119 // Specify an internal Chrome page.
104 CreateViewRequest("?" + std::string(kUrlKey) + "=chrome%3A%2F%2Fsettings%2F", 120 CreateViewRequest("?" + std::string(kUrlKey) + "=chrome%3A%2F%2Fsettings%2F",
105 view_request_delegate.get()); 121 view_request_delegate.get());
106 // Specify a recursive URL. 122 // Specify a recursive URL.
107 CreateViewRequest("?" + std::string(kUrlKey) + "=" + 123 CreateViewRequest("?" + std::string(kUrlKey) + "=" +
108 std::string(kTestScheme) + "%3A%2F%2Fabc-def%2F", 124 std::string(kTestScheme) + "%3A%2F%2Fabc-def%2F",
109 view_request_delegate.get()); 125 view_request_delegate.get());
110 } 126 }
111 127
112 } // namespace dom_distiller 128 } // namespace dom_distiller
OLDNEW
« no previous file with comments | « components/dom_distiller/core/viewer.cc ('k') | components/dom_distiller/standalone/content_extractor.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698