OLD | NEW |
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/distilled_page_prefs.h" | 7 #include "components/dom_distiller/core/distilled_page_prefs.h" |
8 #include "components/dom_distiller/core/dom_distiller_service.h" | 8 #include "components/dom_distiller/core/dom_distiller_service.h" |
9 #include "components/dom_distiller/core/dom_distiller_test_util.h" | 9 #include "components/dom_distiller/core/dom_distiller_test_util.h" |
10 #include "components/dom_distiller/core/task_tracker.h" | 10 #include "components/dom_distiller/core/task_tracker.h" |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 virtual scoped_ptr<ViewerHandle> ViewEntry( | 53 virtual scoped_ptr<ViewerHandle> ViewEntry( |
54 ViewRequestDelegate*, | 54 ViewRequestDelegate*, |
55 scoped_ptr<DistillerPage> distiller_page, | 55 scoped_ptr<DistillerPage> distiller_page, |
56 const std::string&) { | 56 const std::string&) { |
57 return scoped_ptr<ViewerHandle>(ViewEntryImpl()); | 57 return scoped_ptr<ViewerHandle>(ViewEntryImpl()); |
58 } | 58 } |
59 MOCK_METHOD0(RemoveEntryImpl, ArticleEntry*()); | 59 MOCK_METHOD0(RemoveEntryImpl, ArticleEntry*()); |
60 virtual scoped_ptr<ArticleEntry> RemoveEntry(const std::string&) { | 60 virtual scoped_ptr<ArticleEntry> RemoveEntry(const std::string&) { |
61 return scoped_ptr<ArticleEntry>(RemoveEntryImpl()); | 61 return scoped_ptr<ArticleEntry>(RemoveEntryImpl()); |
62 } | 62 } |
63 virtual scoped_ptr<DistillerPage> CreateDefaultDistillerPage() { | 63 virtual scoped_ptr<DistillerPage> CreateDefaultDistillerPage( |
| 64 const gfx::Size& render_view_size) { |
64 return scoped_ptr<DistillerPage>(); | 65 return scoped_ptr<DistillerPage>(); |
65 } | 66 } |
66 virtual scoped_ptr<DistillerPage> CreateDefaultDistillerPageWithHandle( | 67 virtual scoped_ptr<DistillerPage> CreateDefaultDistillerPageWithHandle( |
67 scoped_ptr<SourcePageHandle> handle) { | 68 scoped_ptr<SourcePageHandle> handle) { |
68 return scoped_ptr<DistillerPage>(); | 69 return scoped_ptr<DistillerPage>(); |
69 } | 70 } |
70 virtual DistilledPagePrefs* GetDistilledPagePrefs() OVERRIDE; | 71 virtual DistilledPagePrefs* GetDistilledPagePrefs() OVERRIDE; |
71 }; | 72 }; |
72 | 73 |
73 class DomDistillerViewerTest : public testing::Test { | 74 class DomDistillerViewerTest : public testing::Test { |
74 public: | 75 public: |
75 virtual void SetUp() OVERRIDE { | 76 virtual void SetUp() OVERRIDE { |
76 service_.reset(new TestDomDistillerService()); | 77 service_.reset(new TestDomDistillerService()); |
77 } | 78 } |
78 | 79 |
79 protected: | 80 protected: |
80 scoped_ptr<ViewerHandle> CreateViewRequest( | 81 scoped_ptr<ViewerHandle> CreateViewRequest( |
81 const std::string& path, | 82 const std::string& path, |
82 ViewRequestDelegate* view_request_delegate) { | 83 ViewRequestDelegate* view_request_delegate) { |
83 return viewer::CreateViewRequest( | 84 return viewer::CreateViewRequest( |
84 service_.get(), path, view_request_delegate); | 85 service_.get(), path, view_request_delegate, gfx::Size()); |
85 } | 86 } |
86 | 87 |
87 scoped_ptr<TestDomDistillerService> service_; | 88 scoped_ptr<TestDomDistillerService> service_; |
88 }; | 89 }; |
89 | 90 |
90 TEST_F(DomDistillerViewerTest, TestCreatingViewUrlRequest) { | 91 TEST_F(DomDistillerViewerTest, TestCreatingViewUrlRequest) { |
91 scoped_ptr<FakeViewRequestDelegate> view_request_delegate( | 92 scoped_ptr<FakeViewRequestDelegate> view_request_delegate( |
92 new FakeViewRequestDelegate()); | 93 new FakeViewRequestDelegate()); |
93 ViewerHandle* viewer_handle(new ViewerHandle(ViewerHandle::CancelCallback())); | 94 ViewerHandle* viewer_handle(new ViewerHandle(ViewerHandle::CancelCallback())); |
94 EXPECT_CALL(*service_.get(), ViewUrlImpl()) | 95 EXPECT_CALL(*service_.get(), ViewUrlImpl()) |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 0); | 145 0); |
145 EXPECT_EQ(kLightJs.compare(viewer::GetDistilledPageThemeJs( | 146 EXPECT_EQ(kLightJs.compare(viewer::GetDistilledPageThemeJs( |
146 DistilledPagePrefs::LIGHT)), | 147 DistilledPagePrefs::LIGHT)), |
147 0); | 148 0); |
148 EXPECT_EQ(kSepiaJs.compare(viewer::GetDistilledPageThemeJs( | 149 EXPECT_EQ(kSepiaJs.compare(viewer::GetDistilledPageThemeJs( |
149 DistilledPagePrefs::SEPIA)), | 150 DistilledPagePrefs::SEPIA)), |
150 0); | 151 0); |
151 } | 152 } |
152 | 153 |
153 } // namespace dom_distiller | 154 } // namespace dom_distiller |
OLD | NEW |