1 /*
2  * Copyright (C) 2017 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 package com.android.server.cts;
17 
18 /**
19  * Tests error reporting.
20  */
21 public class ErrorsTest extends ProtoDumpTestCase {
22     private static final String TAG = "ErrorsTest";
23 
24     private static final String DEVICE_SIDE_TEST_APK = "CtsErrorsApp.apk";
25     private static final String DEVICE_SIDE_TEST_PACKAGE
26             = "com.android.server.cts.errors";
27 
28     @Override
tearDown()29     protected void tearDown() throws Exception {
30         getDevice().uninstallPackage(DEVICE_SIDE_TEST_PACKAGE);
31 
32         super.tearDown();
33     }
34 
testThrowException()35     public void testThrowException() throws Exception {
36         installPackage(DEVICE_SIDE_TEST_APK, /* grantPermissions= */ true);
37 
38         runDeviceTests(DEVICE_SIDE_TEST_PACKAGE, ".ErrorsTests",
39                 "testException");
40     }
41 
testANR()42     public void testANR() throws Exception {
43         installPackage(DEVICE_SIDE_TEST_APK, /* grantPermissions= */ true);
44 
45         runDeviceTests(DEVICE_SIDE_TEST_PACKAGE, ".ErrorsTests",
46                 "testANR");
47     }
48 
testNativeCrash()49     public void testNativeCrash() throws Exception {
50         installPackage(DEVICE_SIDE_TEST_APK, /* grantPermissions= */ true);
51 
52         runDeviceTests(DEVICE_SIDE_TEST_PACKAGE, ".ErrorsTests",
53                 "testNativeCrash");
54     }
55 
testTombstone()56     public void testTombstone() throws Exception {
57         installPackage(DEVICE_SIDE_TEST_APK, /* grantPermissions= */ true);
58 
59         runDeviceTests(DEVICE_SIDE_TEST_PACKAGE, ".ErrorsTests",
60                 "testTombstone");
61     }
62 }
63