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

Side by Side Diff: components/dom_distiller/core/viewer_unittest.cc

Issue 341563002: Theme Preferences for Distilled Pages (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Comments from Patch 15 Created 6 years, 5 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/reader_mode_preferences.h"
9 #include "components/dom_distiller/core/task_tracker.h" 10 #include "components/dom_distiller/core/task_tracker.h"
10 #include "components/dom_distiller/core/url_constants.h" 11 #include "components/dom_distiller/core/url_constants.h"
11 #include "testing/gtest/include/gtest/gtest.h" 12 #include "testing/gtest/include/gtest/gtest.h"
12 13
13 namespace dom_distiller { 14 namespace dom_distiller {
14 15
15 const char kTestScheme[] = "myscheme"; 16 const char kTestScheme[] = "myscheme";
16 17
17 class FakeViewRequestDelegate : public ViewRequestDelegate { 18 class FakeViewRequestDelegate : public ViewRequestDelegate {
18 public: 19 public:
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 virtual scoped_ptr<ArticleEntry> RemoveEntry(const std::string&) { 60 virtual scoped_ptr<ArticleEntry> RemoveEntry(const std::string&) {
60 return scoped_ptr<ArticleEntry>(RemoveEntryImpl()); 61 return scoped_ptr<ArticleEntry>(RemoveEntryImpl());
61 } 62 }
62 virtual scoped_ptr<DistillerPage> CreateDefaultDistillerPage() { 63 virtual scoped_ptr<DistillerPage> CreateDefaultDistillerPage() {
63 return scoped_ptr<DistillerPage>(); 64 return scoped_ptr<DistillerPage>();
64 } 65 }
65 virtual scoped_ptr<DistillerPage> CreateDefaultDistillerPageWithHandle( 66 virtual scoped_ptr<DistillerPage> CreateDefaultDistillerPageWithHandle(
66 scoped_ptr<SourcePageHandle> handle) { 67 scoped_ptr<SourcePageHandle> handle) {
67 return scoped_ptr<DistillerPage>(); 68 return scoped_ptr<DistillerPage>();
68 } 69 }
70 virtual ReaderModePrefs* GetReaderModePrefs() OVERRIDE;
69 }; 71 };
70 72
71 class DomDistillerViewerTest : public testing::Test { 73 class DomDistillerViewerTest : public testing::Test {
72 public: 74 public:
73 virtual void SetUp() OVERRIDE { 75 virtual void SetUp() OVERRIDE {
74 service_.reset(new TestDomDistillerService()); 76 service_.reset(new TestDomDistillerService());
75 } 77 }
76 78
77 protected: 79 protected:
78 scoped_ptr<ViewerHandle> CreateViewRequest( 80 scoped_ptr<ViewerHandle> CreateViewRequest(
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 view_request_delegate.get()); 124 view_request_delegate.get());
123 // Specify an internal Chrome page. 125 // Specify an internal Chrome page.
124 CreateViewRequest("?" + std::string(kUrlKey) + "=chrome%3A%2F%2Fsettings%2F", 126 CreateViewRequest("?" + std::string(kUrlKey) + "=chrome%3A%2F%2Fsettings%2F",
125 view_request_delegate.get()); 127 view_request_delegate.get());
126 // Specify a recursive URL. 128 // Specify a recursive URL.
127 CreateViewRequest("?" + std::string(kUrlKey) + "=" + 129 CreateViewRequest("?" + std::string(kUrlKey) + "=" +
128 std::string(kTestScheme) + "%3A%2F%2Fabc-def%2F", 130 std::string(kTestScheme) + "%3A%2F%2Fabc-def%2F",
129 view_request_delegate.get()); 131 view_request_delegate.get());
130 } 132 }
131 133
134 ReaderModePrefs* TestDomDistillerService::GetReaderModePrefs() {
135 return NULL;
136 }
137
138 TEST_F(DomDistillerViewerTest, TestGetBodyCssClassOutput) {
139 std::string kDark = "dark";
140 std::string kSepia = "sepia";
141 std::string kLight = "light";
142 ASSERT_EQ(kDark.compare(viewer::GetBodyCssClass(
143 ReaderModePrefs::Theme::kDark)), 0);
144 ASSERT_EQ(kLight.compare(viewer::GetBodyCssClass(
145 ReaderModePrefs::Theme::kLight)), 0);
146 ASSERT_EQ(kSepia.compare(viewer::GetBodyCssClass(
147 ReaderModePrefs::Theme::kSepia)), 0);
148 }
149
132 } // namespace dom_distiller 150 } // namespace dom_distiller
OLDNEW
« components/dom_distiller/core/viewer.cc ('K') | « components/dom_distiller/core/viewer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698