Search in sources :

Example 1 with BaseSearchIndexProvider

use of com.android.settings.search.BaseSearchIndexProvider in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class MobileNetworkSettingsTest method isPageSearchEnabled_adminUser_shouldReturnTrue.

@Test
public void isPageSearchEnabled_adminUser_shouldReturnTrue() {
    final UserManager userManager = mock(UserManager.class);
    when(mContext.getSystemService(UserManager.class)).thenReturn(userManager);
    when(userManager.isAdminUser()).thenReturn(true);
    final BaseSearchIndexProvider provider = (BaseSearchIndexProvider) mFragment.SEARCH_INDEX_DATA_PROVIDER;
    final Object obj = ReflectionHelpers.callInstanceMethod(provider, "isPageSearchEnabled", ReflectionHelpers.ClassParameter.from(Context.class, mContext));
    final boolean isEnabled = (Boolean) obj;
    assertThat(isEnabled).isTrue();
}
Also used : BaseSearchIndexProvider(com.android.settings.search.BaseSearchIndexProvider) Context(android.content.Context) UserManager(android.os.UserManager) Test(org.junit.Test)

Example 2 with BaseSearchIndexProvider

use of com.android.settings.search.BaseSearchIndexProvider in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class MobileNetworkSettingsTest method isPageSearchEnabled_nonAdminUser_shouldReturnFalse.

@Test
public void isPageSearchEnabled_nonAdminUser_shouldReturnFalse() {
    final UserManager userManager = mock(UserManager.class);
    when(mContext.getSystemService(UserManager.class)).thenReturn(userManager);
    when(userManager.isAdminUser()).thenReturn(false);
    final BaseSearchIndexProvider provider = (BaseSearchIndexProvider) mFragment.SEARCH_INDEX_DATA_PROVIDER;
    final Object obj = ReflectionHelpers.callInstanceMethod(provider, "isPageSearchEnabled", ReflectionHelpers.ClassParameter.from(Context.class, mContext));
    final boolean isEnabled = (Boolean) obj;
    assertThat(isEnabled).isFalse();
}
Also used : BaseSearchIndexProvider(com.android.settings.search.BaseSearchIndexProvider) Context(android.content.Context) UserManager(android.os.UserManager) Test(org.junit.Test)

Example 3 with BaseSearchIndexProvider

use of com.android.settings.search.BaseSearchIndexProvider in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class MobileNetworkListFragmentTest method isPageSearchEnabled_adminUser_shouldReturnTrue.

@Test
public void isPageSearchEnabled_adminUser_shouldReturnTrue() {
    when(mContext.getSystemService(UserManager.class)).thenReturn(mUserManager);
    when(mUserManager.isAdminUser()).thenReturn(true);
    final BaseSearchIndexProvider provider = (BaseSearchIndexProvider) mFragment.SEARCH_INDEX_DATA_PROVIDER;
    final Object obj = ReflectionHelpers.callInstanceMethod(provider, "isPageSearchEnabled", ReflectionHelpers.ClassParameter.from(Context.class, mContext));
    final boolean isEnabled = (Boolean) obj;
    assertThat(isEnabled).isTrue();
}
Also used : BaseSearchIndexProvider(com.android.settings.search.BaseSearchIndexProvider) Context(android.content.Context) Test(org.junit.Test)

Example 4 with BaseSearchIndexProvider

use of com.android.settings.search.BaseSearchIndexProvider in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class MobileNetworkListFragmentTest method isPageSearchEnabled_nonAdminUser_shouldReturnFalse.

@Test
public void isPageSearchEnabled_nonAdminUser_shouldReturnFalse() {
    when(mContext.getSystemService(UserManager.class)).thenReturn(mUserManager);
    when(mUserManager.isAdminUser()).thenReturn(false);
    final BaseSearchIndexProvider provider = (BaseSearchIndexProvider) mFragment.SEARCH_INDEX_DATA_PROVIDER;
    final Object obj = ReflectionHelpers.callInstanceMethod(provider, "isPageSearchEnabled", ReflectionHelpers.ClassParameter.from(Context.class, mContext));
    final boolean isEnabled = (Boolean) obj;
    assertThat(isEnabled).isFalse();
}
Also used : BaseSearchIndexProvider(com.android.settings.search.BaseSearchIndexProvider) Context(android.content.Context) Test(org.junit.Test)

Aggregations

Context (android.content.Context)4 BaseSearchIndexProvider (com.android.settings.search.BaseSearchIndexProvider)4 Test (org.junit.Test)4 UserManager (android.os.UserManager)2