A separate entry for work profile CA cert

We mixed both primary and work profile CA certs into single entry
previously which is not aligned with the CTS requirement.
Separate them from now.

Test: m -j RoboSettingsTest
Test: Run related manual test in CtsVerifier

Bug: 64567417

Change-Id: Iaff2d9f25ef15b96c11727e7075bdae8e90ec8ce
This commit is contained in:
Tony Mak
2017-08-18 11:08:20 +01:00
parent 6c9a1262be
commit c74bbcd3b2
14 changed files with 401 additions and 81 deletions

View File

@@ -8878,8 +8878,12 @@
<string name="enterprise_privacy_always_on_vpn_work">Always-on VPN turned on in your work profile</string>
<!-- Label explaining that a global HTTP proxy was set by the admin. [CHAR LIMIT=NONE] -->
<string name="enterprise_privacy_global_http_proxy">Global HTTP proxy set</string>
<!-- Label explaining that the admin installed trusted CA certificates. [CHAR LIMIT=NONE] -->
<string name="enterprise_privacy_ca_certs">Trusted credentials</string>
<!-- Label explaining that the admin installed trusted CA certificates for the entire device. [CHAR LIMIT=NONE] -->
<string name="enterprise_privacy_ca_certs_device">Trusted credentials</string>
<!-- Label explaining that the admin installed trusted CA certificates in personal profile. [CHAR LIMIT=NONE] -->
<string name="enterprise_privacy_ca_certs_personal">Trusted credentials in your personal profile</string>
<!-- Label explaining that the admin installed trusted CA certificates in work profile. [CHAR LIMIT=NONE] -->
<string name="enterprise_privacy_ca_certs_work">Trusted credentials in your work profile</string>
<!-- Summary indicating the number of trusted CA certificates installed by the admin. The number shown is a minimum as there may be additional CA certificates we do not know about. [CHAR LIMIT=NONE] -->
<plurals name="enterprise_privacy_number_ca_certs">
<item quantity="one">Minimum <xliff:g id="count">%d</xliff:g> CA certificate</item>

View File

@@ -77,8 +77,11 @@
<Preference android:key="global_http_proxy"
android:title="@string/enterprise_privacy_global_http_proxy"
android:selectable="false"/>
<Preference android:key="ca_certs"
android:title="@string/enterprise_privacy_ca_certs"
<Preference android:key="ca_certs_current_user"
android:title="@string/enterprise_privacy_ca_certs_personal"
android:selectable="false"/>
<Preference android:key="ca_certs_managed_profile"
android:title="@string/enterprise_privacy_ca_certs_work"
android:selectable="false"/>
</PreferenceCategory>

View File

@@ -0,0 +1,52 @@
/*
* Copyright (C) 2017 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the
* License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
package com.android.settings.enterprise;
import android.content.Context;
import android.support.annotation.VisibleForTesting;
import android.support.v7.preference.Preference;
import com.android.settings.R;
import com.android.settingslib.core.lifecycle.Lifecycle;
public class CaCertsCurrentUserPreferenceController extends CaCertsPreferenceControllerBase {
@VisibleForTesting
static final String CA_CERTS_CURRENT_USER = "ca_certs_current_user";
public CaCertsCurrentUserPreferenceController(Context context,
Lifecycle lifecycle) {
super(context, lifecycle);
}
@Override
public String getPreferenceKey() {
return CA_CERTS_CURRENT_USER;
}
@Override
public void updateState(Preference preference) {
super.updateState(preference);
preference.setTitle(mFeatureProvider.isInCompMode()
? R.string.enterprise_privacy_ca_certs_personal
: R.string.enterprise_privacy_ca_certs_device);
}
@Override
protected int getNumberOfCaCerts() {
return mFeatureProvider.getNumberOfOwnerInstalledCaCertsForCurrentUser();
}
}

View File

@@ -0,0 +1,41 @@
/*
* Copyright (C) 2017 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the
* License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
package com.android.settings.enterprise;
import android.content.Context;
import android.support.annotation.VisibleForTesting;
import com.android.settingslib.core.lifecycle.Lifecycle;
public class CaCertsManagedProfilePreferenceController extends CaCertsPreferenceControllerBase {
@VisibleForTesting
static final String CA_CERTS_MANAGED_PROFILE = "ca_certs_managed_profile";
public CaCertsManagedProfilePreferenceController(Context context,
Lifecycle lifecycle) {
super(context, lifecycle);
}
@Override
public String getPreferenceKey() {
return CA_CERTS_MANAGED_PROFILE;
}
@Override
protected int getNumberOfCaCerts() {
return mFeatureProvider.getNumberOfOwnerInstalledCaCertsForManagedProfile();
}
}

View File

@@ -15,7 +15,6 @@
package com.android.settings.enterprise;
import android.content.Context;
import android.content.res.Resources;
import android.support.v7.preference.Preference;
import com.android.settings.R;
@@ -23,12 +22,12 @@ import com.android.settings.core.DynamicAvailabilityPreferenceController;
import com.android.settings.overlay.FeatureFactory;
import com.android.settingslib.core.lifecycle.Lifecycle;
public class CaCertsPreferenceController extends DynamicAvailabilityPreferenceController {
public abstract class CaCertsPreferenceControllerBase
extends DynamicAvailabilityPreferenceController {
private static final String CA_CERTS = "ca_certs";
private final EnterprisePrivacyFeatureProvider mFeatureProvider;
protected final EnterprisePrivacyFeatureProvider mFeatureProvider;
public CaCertsPreferenceController(Context context, Lifecycle lifecycle) {
public CaCertsPreferenceControllerBase(Context context, Lifecycle lifecycle) {
super(context, lifecycle);
mFeatureProvider = FeatureFactory.getFactory(context)
.getEnterprisePrivacyFeatureProvider(context);
@@ -36,23 +35,17 @@ public class CaCertsPreferenceController extends DynamicAvailabilityPreferenceCo
@Override
public void updateState(Preference preference) {
final int certs =
mFeatureProvider.getNumberOfOwnerInstalledCaCertsForCurrentUserAndManagedProfile();
final int certs = getNumberOfCaCerts();
preference.setSummary(mContext.getResources().getQuantityString(
R.plurals.enterprise_privacy_number_ca_certs, certs, certs));
}
@Override
public boolean isAvailable() {
final boolean available =
mFeatureProvider.getNumberOfOwnerInstalledCaCertsForCurrentUserAndManagedProfile()
> 0;
final boolean available = getNumberOfCaCerts() > 0;
notifyOnAvailabilityUpdate(available);
return available;
}
@Override
public String getPreferenceKey() {
return CA_CERTS;
}
protected abstract int getNumberOfCaCerts();
}

View File

@@ -109,9 +109,15 @@ public interface EnterprisePrivacyFeatureProvider {
/**
* Returns the number of CA certificates that the Device Owner or Profile Owner installed in
* the current user and the user's managed profile (if any).
* current user.
*/
int getNumberOfOwnerInstalledCaCertsForCurrentUserAndManagedProfile();
int getNumberOfOwnerInstalledCaCertsForCurrentUser();
/**
* Returns the number of CA certificates that the Device Owner or Profile Owner installed in
* the current user's managed profile (if any).
*/
int getNumberOfOwnerInstalledCaCertsForManagedProfile();
/**
* Returns the number of Device Admin apps active in the current user and the user's managed

View File

@@ -200,20 +200,25 @@ public class EnterprisePrivacyFeatureProviderImpl implements EnterprisePrivacyFe
}
@Override
public int getNumberOfOwnerInstalledCaCertsForCurrentUserAndManagedProfile() {
int num = 0;
List<String> certs = mDpm.getOwnerInstalledCaCerts(new UserHandle(MY_USER_ID));
if (certs != null) {
num += certs.size();
public int getNumberOfOwnerInstalledCaCertsForCurrentUser() {
final List<String> certs = mDpm.getOwnerInstalledCaCerts(new UserHandle(MY_USER_ID));
if (certs == null) {
return 0;
}
return certs.size();
}
@Override
public int getNumberOfOwnerInstalledCaCertsForManagedProfile() {
final int userId = getManagedProfileUserId();
if (userId != UserHandle.USER_NULL) {
certs = mDpm.getOwnerInstalledCaCerts(new UserHandle(userId));
if (certs != null) {
num += certs.size();
}
if (userId == UserHandle.USER_NULL) {
return 0;
}
return num;
final List<String> certs = mDpm.getOwnerInstalledCaCerts(new UserHandle(userId));
if (certs == null) {
return 0;
}
return certs.size();
}
@Override

View File

@@ -82,7 +82,10 @@ public class EnterprisePrivacySettings extends DashboardFragment {
exposureChangesCategoryControllers.add(new ImePreferenceController(context, lifecycle));
exposureChangesCategoryControllers.add(new GlobalHttpProxyPreferenceController(context,
lifecycle));
exposureChangesCategoryControllers.add(new CaCertsPreferenceController(context, lifecycle));
exposureChangesCategoryControllers.add(new CaCertsCurrentUserPreferenceController(
context, lifecycle));
exposureChangesCategoryControllers.add(new CaCertsManagedProfilePreferenceController(
context, lifecycle));
controllers.addAll(exposureChangesCategoryControllers);
controllers.add(new ExposureChangesCategoryPreferenceController(context, lifecycle,
exposureChangesCategoryControllers, async));

View File

@@ -0,0 +1,88 @@
/*
* Copyright (C) 2017 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.settings.enterprise;
import static com.google.common.truth.Truth.assertThat;
import static org.mockito.Mockito.when;
import android.support.v7.preference.Preference;
import com.android.settings.R;
import com.android.settings.TestConfig;
import com.android.settings.testutils.SettingsRobolectricTestRunner;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.robolectric.annotation.Config;
/**
* Tests for {@link CaCertsCurrentUserPreferenceController}.
*/
@RunWith(SettingsRobolectricTestRunner.class)
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
public final class CaCertsCurrentUserPreferenceControllerTest extends
CaCertsPreferenceControllerTestBase {
private static final String CA_CERT_DEVICE = "CA certs";
private static final String CA_CERT_PERSONAL = "CA certs in personal profile";
@Before
public void mockGetString() {
when(mContext.getString(R.string.enterprise_privacy_ca_certs_device))
.thenReturn(CA_CERT_DEVICE);
when(mContext.getString(R.string.enterprise_privacy_ca_certs_personal))
.thenReturn(CA_CERT_PERSONAL);
}
@Test
public void testUpdateState_nonCompMode() {
assertUpdateState(false /* isCompMode */, CA_CERT_DEVICE);
}
@Test
public void testUpdateState_compMode() {
assertUpdateState(true /* isCompMode */, CA_CERT_PERSONAL);
}
@Override
void mockGetNumberOfCaCerts(int numOfCaCerts) {
when(mFeatureFactory.enterprisePrivacyFeatureProvider
.getNumberOfOwnerInstalledCaCertsForCurrentUser()).thenReturn(numOfCaCerts);
}
@Override
String getPreferenceKey() {
return CaCertsCurrentUserPreferenceController.CA_CERTS_CURRENT_USER;
}
@Override
CaCertsPreferenceControllerBase createController() {
return new CaCertsCurrentUserPreferenceController(mContext, null /* lifecycle */);
}
private void assertUpdateState(boolean isCompMode, String expectedTitle) {
final Preference preference = new Preference(mContext, null, 0, 0);
mockGetNumberOfCaCerts(2);
when(mFeatureFactory.enterprisePrivacyFeatureProvider.isInCompMode())
.thenReturn(isCompMode);
mController.updateState(preference);
assertThat(preference.getTitle()).isEqualTo(expectedTitle);
}
}

View File

@@ -0,0 +1,50 @@
/*
* Copyright (C) 2017 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.settings.enterprise;
import static org.mockito.Mockito.when;
import com.android.settings.TestConfig;
import com.android.settings.testutils.SettingsRobolectricTestRunner;
import org.junit.runner.RunWith;
import org.robolectric.annotation.Config;
/**
* Tests for {@link CaCertsManagedProfilePreferenceController}.
*/
@RunWith(SettingsRobolectricTestRunner.class)
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
public final class CaCertsManagedProfilePreferenceControllerTest extends
CaCertsPreferenceControllerTestBase {
@Override
void mockGetNumberOfCaCerts(int numOfCaCerts) {
when(mFeatureFactory.enterprisePrivacyFeatureProvider
.getNumberOfOwnerInstalledCaCertsForManagedProfile()).thenReturn(numOfCaCerts);
}
@Override
String getPreferenceKey() {
return CaCertsManagedProfilePreferenceController.CA_CERTS_MANAGED_PROFILE;
}
@Override
CaCertsPreferenceControllerBase createController() {
return new CaCertsManagedProfilePreferenceController(mContext, null /* lifecycle */);
}
}

View File

@@ -0,0 +1,66 @@
/*
* Copyright (C) 2017 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.settings.enterprise;
import android.content.Context;
import com.android.settings.TestConfig;
import com.android.settings.testutils.SettingsRobolectricTestRunner;
import org.junit.runner.RunWith;
import org.robolectric.annotation.Config;
/**
* Tests for {@link CaCertsPreferenceControllerBase}.
*/
@RunWith(SettingsRobolectricTestRunner.class)
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
public class CaCertsPreferenceControllerBaseTest extends CaCertsPreferenceControllerTestBase {
private static final String PREF_KEY = "pref";
private int mNumOfCaCerts;
void mockGetNumberOfCaCerts(int numOfCaCerts) {
mNumOfCaCerts = numOfCaCerts;
}
String getPreferenceKey() {
return PREF_KEY;
}
CaCertsPreferenceControllerBase createController() {
return new CaCertsPreferenceControllerBaseTestable(mContext);
}
private class CaCertsPreferenceControllerBaseTestable extends
CaCertsPreferenceControllerBase {
public CaCertsPreferenceControllerBaseTestable(Context context) {
super(context, null);
}
@Override
public String getPreferenceKey() {
return PREF_KEY;
}
@Override
protected int getNumberOfCaCerts() {
return mNumOfCaCerts;
}
}
}

View File

@@ -16,50 +16,42 @@
package com.android.settings.enterprise;
import android.content.Context;
import static com.google.common.truth.Truth.assertThat;
import com.android.settings.R;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import android.content.Context;
import android.support.v7.preference.Preference;
import com.android.settings.testutils.SettingsRobolectricTestRunner;
import com.android.settings.TestConfig;
import com.android.settings.R;
import com.android.settings.core.PreferenceAvailabilityObserver;
import com.android.settings.testutils.FakeFeatureFactory;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Answers;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import org.robolectric.annotation.Config;
import static com.google.common.truth.Truth.assertThat;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
/**
* Tests for {@link CaCertsPreferenceController}.
* Base test class for testing {@link CaCertsPreferenceControllerBase}'s subclass.
*/
@RunWith(SettingsRobolectricTestRunner.class)
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
public final class CaCertsPreferenceControllerTest {
private static final String KEY_CA_CERTS = "ca_certs";
public abstract class CaCertsPreferenceControllerTestBase {
@Mock(answer = Answers.RETURNS_DEEP_STUBS)
private Context mContext;
private FakeFeatureFactory mFeatureFactory;
@Mock private PreferenceAvailabilityObserver mObserver;
private CaCertsPreferenceController mController;
protected Context mContext;
protected FakeFeatureFactory mFeatureFactory;
protected CaCertsPreferenceControllerBase mController;
@Mock
private PreferenceAvailabilityObserver mObserver;
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
FakeFeatureFactory.setupForTest(mContext);
mFeatureFactory = (FakeFeatureFactory) FakeFeatureFactory.getFactory(mContext);
mController = new CaCertsPreferenceController(mContext, null /* lifecycle */);
mController = createController();
mController.setAvailabilityObserver(mObserver);
}
@@ -74,23 +66,20 @@ public final class CaCertsPreferenceControllerTest {
when(mContext.getResources().getQuantityString(R.plurals.enterprise_privacy_number_ca_certs,
10, 10)).thenReturn("10 certs");
when(mFeatureFactory.enterprisePrivacyFeatureProvider
.getNumberOfOwnerInstalledCaCertsForCurrentUserAndManagedProfile()).thenReturn(10);
mockGetNumberOfCaCerts(10);
mController.updateState(preference);
assertThat(preference.getSummary()).isEqualTo("10 certs");
}
@Test
public void testIsAvailable() {
when(mFeatureFactory.enterprisePrivacyFeatureProvider
.getNumberOfOwnerInstalledCaCertsForCurrentUserAndManagedProfile()).thenReturn(0);
mockGetNumberOfCaCerts(0);
assertThat(mController.isAvailable()).isFalse();
verify(mObserver).onPreferenceAvailabilityUpdated(KEY_CA_CERTS, false);
verify(mObserver).onPreferenceAvailabilityUpdated(getPreferenceKey(), false);
when(mFeatureFactory.enterprisePrivacyFeatureProvider
.getNumberOfOwnerInstalledCaCertsForCurrentUserAndManagedProfile()).thenReturn(10);
mockGetNumberOfCaCerts(10);
assertThat(mController.isAvailable()).isTrue();
verify(mObserver).onPreferenceAvailabilityUpdated(KEY_CA_CERTS, true);
verify(mObserver).onPreferenceAvailabilityUpdated(getPreferenceKey(), true);
}
@Test
@@ -101,6 +90,13 @@ public final class CaCertsPreferenceControllerTest {
@Test
public void testGetPreferenceKey() {
assertThat(mController.getPreferenceKey()).isEqualTo(KEY_CA_CERTS);
assertThat(mController.getPreferenceKey()).isEqualTo(getPreferenceKey());
}
abstract void mockGetNumberOfCaCerts(int numOfCaCerts);
abstract String getPreferenceKey();
abstract CaCertsPreferenceControllerBase createController();
}

View File

@@ -288,7 +288,7 @@ public final class EnterprisePrivacyFeatureProviderImplTest {
}
@Test
public void testGetNumberOfOwnerInstalledCaCertsForCurrentUserAndManagedProfile() {
public void testGetNumberOfOwnerInstalledCaCertsForCurrent() {
final UserHandle userHandle = new UserHandle(UserHandle.USER_SYSTEM);
final UserHandle managedProfileUserHandle = new UserHandle(MANAGED_PROFILE_USER_ID);
final UserInfo managedProfile =
@@ -299,33 +299,44 @@ public final class EnterprisePrivacyFeatureProviderImplTest {
when(mDevicePolicyManager.getOwnerInstalledCaCerts(userHandle))
.thenReturn(null);
assertThat(mProvider.getNumberOfOwnerInstalledCaCertsForCurrentUserAndManagedProfile())
assertThat(mProvider.getNumberOfOwnerInstalledCaCertsForCurrentUser())
.isEqualTo(0);
when(mDevicePolicyManager.getOwnerInstalledCaCerts(userHandle))
.thenReturn(new ArrayList<String>());
assertThat(mProvider.getNumberOfOwnerInstalledCaCertsForCurrentUserAndManagedProfile())
.thenReturn(new ArrayList<>());
assertThat(mProvider.getNumberOfOwnerInstalledCaCertsForCurrentUser())
.isEqualTo(0);
when(mDevicePolicyManager.getOwnerInstalledCaCerts(userHandle))
.thenReturn(Arrays.asList(new String[] {"ca1", "ca2"}));
assertThat(mProvider.getNumberOfOwnerInstalledCaCertsForCurrentUserAndManagedProfile())
assertThat(mProvider.getNumberOfOwnerInstalledCaCertsForCurrentUser())
.isEqualTo(2);
}
@Test
public void testGetNumberOfOwnerInstalledCaCertsForManagedProfile() {
final UserHandle userHandle = new UserHandle(UserHandle.USER_SYSTEM);
final UserHandle managedProfileUserHandle = new UserHandle(MANAGED_PROFILE_USER_ID);
final UserInfo managedProfile =
new UserInfo(MANAGED_PROFILE_USER_ID, "", "", UserInfo.FLAG_MANAGED_PROFILE);
// Without a profile
when(mDevicePolicyManager.getOwnerInstalledCaCerts(managedProfileUserHandle))
.thenReturn(Arrays.asList(new String[] {"ca1", "ca2"}));
assertThat(mProvider.getNumberOfOwnerInstalledCaCertsForManagedProfile())
.isEqualTo(0);
// With a profile
mProfiles.add(managedProfile);
when(mDevicePolicyManager.getOwnerInstalledCaCerts(managedProfileUserHandle))
.thenReturn(null);
assertThat(mProvider.getNumberOfOwnerInstalledCaCertsForCurrentUserAndManagedProfile())
.isEqualTo(2);
when(mDevicePolicyManager.getOwnerInstalledCaCerts(managedProfileUserHandle))
.thenReturn(new ArrayList<String>());
assertThat(mProvider.getNumberOfOwnerInstalledCaCertsForCurrentUserAndManagedProfile())
.isEqualTo(2);
assertThat(mProvider.getNumberOfOwnerInstalledCaCertsForManagedProfile())
.isEqualTo(0);
when(mDevicePolicyManager.getOwnerInstalledCaCerts(userHandle))
.thenReturn(new ArrayList<>());
assertThat(mProvider.getNumberOfOwnerInstalledCaCertsForManagedProfile())
.isEqualTo(0);
when(mDevicePolicyManager.getOwnerInstalledCaCerts(managedProfileUserHandle))
.thenReturn(Arrays.asList(new String[] {"ca1", "ca2"}));
assertThat(mProvider.getNumberOfOwnerInstalledCaCertsForCurrentUserAndManagedProfile())
.isEqualTo(4);
mProfiles.remove(managedProfile);
assertThat(mProvider.getNumberOfOwnerInstalledCaCertsForCurrentUserAndManagedProfile())
assertThat(mProvider.getNumberOfOwnerInstalledCaCertsForManagedProfile())
.isEqualTo(2);
}

View File

@@ -128,7 +128,7 @@ public final class EnterprisePrivacySettingsTest {
private void verifyPreferenceControllers(List<AbstractPreferenceController> controllers)
throws Exception {
assertThat(controllers).isNotNull();
assertThat(controllers.size()).isEqualTo(16);
assertThat(controllers.size()).isEqualTo(17);
int position = 0;
assertThat(controllers.get(position++)).isInstanceOf(NetworkLogsPreferenceController.class);
assertThat(controllers.get(position++)).isInstanceOf(BugReportsPreferenceController.class);
@@ -152,7 +152,9 @@ public final class EnterprisePrivacySettingsTest {
assertThat(controllers.get(position++)).isInstanceOf(
GlobalHttpProxyPreferenceController.class);
assertThat(controllers.get(position++)).isInstanceOf(
CaCertsPreferenceController.class);
CaCertsCurrentUserPreferenceController.class);
assertThat(controllers.get(position++)).isInstanceOf(
CaCertsManagedProfilePreferenceController.class);
final AbstractPreferenceController exposureChangesCategoryController =
controllers.get(position);
final int exposureChangesCategoryControllerIndex = position;