OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 package org.chromium.chrome.browser.preferences; |
| 6 |
| 7 import android.test.suitebuilder.annotation.SmallTest; |
| 8 |
| 9 import org.chromium.base.ThreadUtils; |
| 10 import org.chromium.base.test.util.Feature; |
| 11 import org.chromium.chrome.shell.ChromeShellTestBase; |
| 12 |
| 13 /** |
| 14 * Test for PrefServiceBridge |
| 15 */ |
| 16 public class PrefServiceBridgeTest extends ChromeShellTestBase { |
| 17 /** |
| 18 * Test the x-auto-login setting. |
| 19 */ |
| 20 @SmallTest |
| 21 @Feature({"Preferences", "Main"}) |
| 22 public void testAutologinEnabled() { |
| 23 ThreadUtils.runOnUiThreadBlocking(new Runnable() { |
| 24 @Override |
| 25 public void run() { |
| 26 PrefServiceBridge prefs = PrefServiceBridge.getInstance(); |
| 27 |
| 28 boolean autologinEnabled = prefs.isAutologinEnabled(); |
| 29 |
| 30 // Make sure the value doesn't change |
| 31 prefs.setAutologinEnabled(autologinEnabled); |
| 32 assertEquals(autologinEnabled, prefs.isAutologinEnabled()); |
| 33 |
| 34 // Try flipping the value |
| 35 autologinEnabled = !autologinEnabled; |
| 36 prefs.setAutologinEnabled(autologinEnabled); |
| 37 assertEquals(autologinEnabled, prefs.isAutologinEnabled()); |
| 38 } |
| 39 }); |
| 40 } |
| 41 |
| 42 @Override |
| 43 protected void setUp() throws Exception { |
| 44 super.setUp(); |
| 45 launchChromeShellWithBlankPage(); |
| 46 } |
| 47 } |
OLD | NEW |