Chromium Code Reviews| Index: chrome/android/javatests/src/org/chromium/chrome/browser/blimp/BlimpPreferencesTest.java |
| diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/blimp/BlimpPreferencesTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/blimp/BlimpPreferencesTest.java |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..e930d681089d0d8827dee4e6412777ac7f6560b4 |
| --- /dev/null |
| +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/blimp/BlimpPreferencesTest.java |
| @@ -0,0 +1,56 @@ |
| +// Copyright 2016 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.blimp; |
| + |
| +import android.preference.Preference; |
| +import android.test.suitebuilder.annotation.SmallTest; |
| + |
| +import org.chromium.base.ThreadUtils; |
| +import org.chromium.base.test.util.Feature; |
| +import org.chromium.blimp_public.BlimpClientContext; |
| +import org.chromium.chrome.browser.preferences.MainPreferences; |
| +import org.chromium.chrome.browser.preferences.Preferences; |
| +import org.chromium.chrome.browser.preferences.PreferencesTest; |
| +import org.chromium.chrome.browser.profiles.Profile; |
| +import org.chromium.chrome.test.ChromeTabbedActivityTestBase; |
| + |
| +/** |
| + * Test blimp settings preferences. |
| + */ |
| +public class BlimpPreferencesTest extends ChromeTabbedActivityTestBase { |
|
David Trainor- moved to gerrit
2016/07/22 16:51:43
Can we just test that the fragment loads and that
xingliu
2016/07/23 23:50:36
Done. Moved the test code to blimp also.
|
| + public static final String PREF_BLIMP_SWITCH = "blimp_switch"; |
|
David Trainor- moved to gerrit
2016/07/22 16:51:43
private?
xingliu
2016/07/23 23:50:36
Done. Removed this and use const string in another
|
| + |
| + @SmallTest |
| + @Feature({"Blimp"}) |
| + public void testBlimpPreference() { |
| + // Start Chrome preferences. |
| + final Preferences prefActivity = PreferencesTest.startPreferences(getInstrumentation(), |
| + MainPreferences.class.getName()); |
| + |
| + final MainPreferences mainPreferences = (MainPreferences) prefActivity.getFragmentForTest(); |
| + |
| + ThreadUtils.runOnUiThread(new Runnable() { |
| + @Override |
| + public void run() { |
| + // Check if blimp settings preference is attached correctly. |
| + Preference pref = mainPreferences.findPreference(PREF_BLIMP_SWITCH); |
| + BlimpClientContext blimpClientContext = BlimpClientContextFactory |
| + .getBlimpClientContextForProfile( |
| + Profile.getLastUsedProfile().getOriginalProfile()); |
| + if (blimpClientContext.isBlimpSupported()) { |
| + assertNotNull(pref); |
| + } else { |
| + assertNull(pref); |
| + } |
| + } |
| + }); |
| + prefActivity.finish(); |
| + } |
| + |
| + @Override |
| + public void startMainActivity() throws InterruptedException { |
| + startMainActivityOnBlankPage(); |
| + } |
| +} |