1 package android.cts.statsd.validation; 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 directories used by Statsd. 15 */ 16 public class DirectoryValidationTest 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 testStatsActiveMetricDirectoryExists()40 public void testStatsActiveMetricDirectoryExists() throws Exception { 41 DeviceUtils.runDeviceTests(getDevice(), MetricsUtils.DEVICE_SIDE_TEST_PACKAGE, 42 ".DirectoryTests", "testStatsActiveMetricDirectoryExists"); 43 } 44 testStatsDataDirectoryExists()45 public void testStatsDataDirectoryExists() throws Exception { 46 DeviceUtils.runDeviceTests(getDevice(), MetricsUtils.DEVICE_SIDE_TEST_PACKAGE, 47 ".DirectoryTests", "testStatsDataDirectoryExists"); 48 } 49 testStatsMetadataDirectoryExists()50 public void testStatsMetadataDirectoryExists() throws Exception { 51 DeviceUtils.runDeviceTests(getDevice(), MetricsUtils.DEVICE_SIDE_TEST_PACKAGE, 52 ".DirectoryTests", "testStatsMetadataDirectoryExists"); 53 } 54 testStatsServiceDirectoryExists()55 public void testStatsServiceDirectoryExists() throws Exception { 56 DeviceUtils.runDeviceTests(getDevice(), MetricsUtils.DEVICE_SIDE_TEST_PACKAGE, 57 ".DirectoryTests", "testStatsServiceDirectoryExists"); 58 } 59 testTrainInfoDirectoryExists()60 public void testTrainInfoDirectoryExists() throws Exception { 61 DeviceUtils.runDeviceTests(getDevice(), MetricsUtils.DEVICE_SIDE_TEST_PACKAGE, 62 ".DirectoryTests", "testTrainInfoDirectoryExists"); 63 } 64 } 65