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

Unified 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: Changed names and added tests 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 side-by-side diff with in-line comments
Download patch
Index: components/dom_distiller/core/viewer_unittest.cc
diff --git a/components/dom_distiller/core/viewer_unittest.cc b/components/dom_distiller/core/viewer_unittest.cc
index 7c1b0752849aebde6b3869573a164f2c7be3936a..2806dac68c4d6d790816120507e0f2a222b5ce65 100644
--- a/components/dom_distiller/core/viewer_unittest.cc
+++ b/components/dom_distiller/core/viewer_unittest.cc
@@ -4,6 +4,7 @@
#include "components/dom_distiller/core/viewer.h"
+#include "components/dom_distiller/core/distilled_page_prefs.h"
#include "components/dom_distiller/core/dom_distiller_service.h"
#include "components/dom_distiller/core/dom_distiller_test_util.h"
#include "components/dom_distiller/core/task_tracker.h"
@@ -66,6 +67,7 @@ class TestDomDistillerService : public DomDistillerServiceInterface {
scoped_ptr<SourcePageHandle> handle) {
return scoped_ptr<DistillerPage>();
}
+ virtual DistilledPagePrefs* GetDistilledPagePrefs() OVERRIDE;
};
class DomDistillerViewerTest : public testing::Test {
@@ -129,4 +131,20 @@ TEST_F(DomDistillerViewerTest, TestCreatingInvalidViewRequest) {
view_request_delegate.get());
}
+DistilledPagePrefs* TestDomDistillerService::GetDistilledPagePrefs() {
+ return NULL;
+}
+
+TEST_F(DomDistillerViewerTest, TestGetDistilledPageThemeJsOutput) {
+ std::string kDarkJs = "document.body.className='dark';";
nyquist 2014/07/07 19:12:49 Nit: These needs to be updated once you call the J
smaslo 2014/07/08 19:58:11 Done.
+ std::string kSepiaJs = "document.body.className='sepia';";
+ std::string kLightJs = "document.body.className='light';";
+ ASSERT_EQ(kDarkJs.compare(viewer::GetDistilledPageThemeJs(
+ DistilledPagePrefs::Theme::kDark)), 0);
+ ASSERT_EQ(kLightJs.compare(viewer::GetDistilledPageThemeJs(
+ DistilledPagePrefs::Theme::kLight)), 0);
+ ASSERT_EQ(kSepiaJs.compare(viewer::GetDistilledPageThemeJs(
+ DistilledPagePrefs::Theme::kSepia)), 0);
+}
+
} // namespace dom_distiller
« 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