1 package android.cts.statsd.restricted;
2 
3 import static com.google.common.truth.Truth.assertThat;
4 
5 import android.cts.statsd.metric.MetricsUtils;
6 import android.cts.statsdatom.lib.DeviceUtils;
7 
8 import com.android.tradefed.build.IBuildInfo;
9 import com.android.tradefed.testtype.DeviceTestCase;
10 import com.android.tradefed.testtype.IBuildReceiver;
11 import com.android.tradefed.util.RunUtil;
12 
13 /**
14  * Tests Suite for restricted stats permissions.
15  */
16 public class ReadRestrictedStatsPermissionTest extends DeviceTestCase implements IBuildReceiver {
17 
18     private IBuildInfo mCtsBuild;
19 
20     @Override
setUp()21     protected void setUp() throws Exception {
22         super.setUp();
23         assertThat(mCtsBuild).isNotNull();
24         DeviceUtils.installTestApp(getDevice(), MetricsUtils.DEVICE_SIDE_TEST_APK,
25                 MetricsUtils.DEVICE_SIDE_TEST_PACKAGE, mCtsBuild);
26         RunUtil.getDefault().sleep(1000);
27     }
28 
29     @Override
tearDown()30     protected void tearDown() throws Exception {
31         DeviceUtils.uninstallTestApp(getDevice(), MetricsUtils.DEVICE_SIDE_TEST_PACKAGE);
32         super.tearDown();
33     }
34 
35     @Override
setBuild(IBuildInfo buildInfo)36     public void setBuild(IBuildInfo buildInfo) {
37         mCtsBuild = buildInfo;
38     }
39 
testReadRestrictedStatsPermission()40     public void testReadRestrictedStatsPermission() throws Exception {
41         DeviceUtils.runDeviceTests(getDevice(), MetricsUtils.DEVICE_SIDE_TEST_PACKAGE,
42                 ".RestrictedPermissionTests", "testReadRestrictedStatsPermission");
43     }
44 }
45