Populate Enterprise Privacy Settings page - batch 2

This CL adds the second batch of items to the Privacy Settings page.

These are all the remaining items that fall into the "What types of
information can your organization see?" category.

Test: make RunSettingsRoboTests
Bug: 32692748
Change-Id: I08569646ed6bb6f5d9d6d65ed2718be8456f50ae
This commit is contained in:
Bartosz Fabianowski
2016-11-28 21:13:30 +01:00
parent 51ecc5eced
commit 2e0b608495
20 changed files with 650 additions and 16 deletions

View File

@@ -23,6 +23,7 @@ import android.content.pm.PackageManager;
import com.android.settings.SettingsRobolectricTestRunner;
import com.android.settings.TestConfig;
import com.android.settings.applications.PackageManagerWrapper;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -30,6 +31,8 @@ import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import org.robolectric.annotation.Config;
import java.util.Date;
import static com.google.common.truth.Truth.assertThat;
import static org.mockito.Mockito.when;
@@ -41,6 +44,7 @@ import static org.mockito.Mockito.when;
public final class EnterprisePrivacyFeatureProviderImplTest {
private final ComponentName DEVICE_OWNER = new ComponentName("dummy", "component");
private final Date TIMESTAMP = new Date(2011, 11, 11);
private @Mock DevicePolicyManagerWrapper mDevicePolicyManager;
private @Mock PackageManagerWrapper mPackageManager;
@@ -65,4 +69,32 @@ public final class EnterprisePrivacyFeatureProviderImplTest {
when(mDevicePolicyManager.getDeviceOwnerComponentOnAnyUser()).thenReturn(DEVICE_OWNER);
assertThat(mProvider.hasDeviceOwner()).isTrue();
}
@Test
public void testGetLastSecurityLogRetrievalTime() {
when(mDevicePolicyManager.getLastSecurityLogRetrievalTime()).thenReturn(-1L);
assertThat(mProvider.getLastSecurityLogRetrievalTime()).isNull();
when(mDevicePolicyManager.getLastSecurityLogRetrievalTime())
.thenReturn(TIMESTAMP.getTime());
assertThat(mProvider.getLastSecurityLogRetrievalTime()).isEqualTo(TIMESTAMP);
}
@Test
public void testGetLastBugReportRequestTime() {
when(mDevicePolicyManager.getLastBugReportRequestTime()).thenReturn(-1L);
assertThat(mProvider.getLastBugReportRequestTime()).isNull();
when(mDevicePolicyManager.getLastBugReportRequestTime()).thenReturn(TIMESTAMP.getTime());
assertThat(mProvider.getLastBugReportRequestTime()).isEqualTo(TIMESTAMP);
}
@Test
public void testGetLastNetworkLogRetrievalTime() {
when(mDevicePolicyManager.getLastNetworkLogRetrievalTime()).thenReturn(-1L);
assertThat(mProvider.getLastNetworkLogRetrievalTime()).isNull();
when(mDevicePolicyManager.getLastNetworkLogRetrievalTime()).thenReturn(TIMESTAMP.getTime());
assertThat(mProvider.getLastNetworkLogRetrievalTime()).isEqualTo(TIMESTAMP);
}
}