Chromium Code Reviews| Index: chrome/android/javatests/src/org/chromium/chrome/browser/dom_distiller/DistilledPagePrefsTest.java |
| diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/dom_distiller/DistilledPagePrefsTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/dom_distiller/DistilledPagePrefsTest.java |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..2a25c65472ba47a681209d09f0880ee8b2f4d794 |
| --- /dev/null |
| +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/dom_distiller/DistilledPagePrefsTest.java |
| @@ -0,0 +1,42 @@ |
| +// Copyright 2014 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +package org.chromium.chrome.browser.dom_distiller; |
| + |
| +import android.test.suitebuilder.annotation.SmallTest; |
| +import android.test.UiThreadTest; |
| + |
| +import org.chromium.base.test.util.Feature; |
| +import org.chromium.chrome.browser.profiles.Profile; |
| +import org.chromium.chrome.shell.ChromeShellTestBase; |
| +import org.chromium.components.dom_distiller.core.DistilledPagePrefs; |
| +import org.chromium.components.dom_distiller.core.DomDistillerService; |
| +import org.chromium.components.dom_distiller.core.Theme; |
| + |
| +/** |
| + * Test class for {@link DistilledPagePrefs}. |
| + */ |
| +public class DistilledPagePrefsTest extends ChromeShellTestBase { |
| + |
| + @SmallTest |
| + @UiThreadTest |
| + @Feature({"DomDistiller"}) |
| + public void testGetAndSetPrefs() throws InterruptedException { |
| + startChromeBrowserProcessSync(getInstrumentation().getTargetContext()); |
| + DomDistillerService service = DomDistillerServiceFactory. |
| + getForProfile(Profile.getLastUsedProfile()); |
| + assertNotNull(service); |
| + DistilledPagePrefs distilledPagePrefs = service.getDistilledPagePrefs(); |
| + assertNotNull(distilledPagePrefs); |
| + // Check default theme. |
| + assertEquals(distilledPagePrefs.getTheme(), Theme.LIGHT); |
|
nyquist
2014/07/10 15:59:58
(Expected, Actual) across these asserts
sunangel
2014/07/10 20:19:55
Done.
|
| + // Check that theme can be correctly set. |
| + distilledPagePrefs.setTheme(Theme.DARK); |
| + assertEquals(distilledPagePrefs.getTheme(), Theme.DARK); |
| + distilledPagePrefs.setTheme(Theme.LIGHT); |
| + assertEquals(distilledPagePrefs.getTheme(), Theme.LIGHT); |
| + distilledPagePrefs.setTheme(Theme.SEPIA); |
| + assertEquals(distilledPagePrefs.getTheme(), Theme.SEPIA); |
| + } |
| +} |