1 /* 2 * Copyright (C) 2023 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 17 package android.dynamicmime.cts; 18 19 import com.android.compatibility.common.util.ApiTest; 20 import com.android.tradefed.device.DeviceNotAvailableException; 21 import com.android.tradefed.testtype.DeviceJUnit4ClassRunner; 22 23 import org.junit.Test; 24 import org.junit.runner.RunWith; 25 26 /** 27 * Independent mime group reboot test cases 28 * 29 * Reuses existing test cases from {@link android.dynamicmime.testapp.SingleAppTest} 30 * by "inserting" device reboot between setup part (MIME group commands) and verification part 31 * (MIME group assertions) in each test case 32 * 33 * @see android.dynamicmime.testapp.reboot.PreRebootSingleAppTest 34 * @see android.dynamicmime.testapp.reboot.PostRebootSingleAppTest 35 * @see #runTestWithReboot(String, String) 36 */ 37 @ApiTest(apis = { 38 "android.content.pm.PackageManager#getMimeGroup", 39 "android.content.pm.PackageManager#setMimeGroup" 40 }) 41 @RunWith(DeviceJUnit4ClassRunner.class) 42 public class IndependentGroupRebootTestCases extends RebootTestCaseBase { 43 44 @Test testMimeGroupsIndependentAdd()45 public void testMimeGroupsIndependentAdd() throws DeviceNotAvailableException { 46 runTestWithReboot("SingleAppTest", "testMimeGroupsIndependentAdd"); 47 } 48 49 @Test testMimeGroupsIndependentAddToBoth()50 public void testMimeGroupsIndependentAddToBoth() throws DeviceNotAvailableException { 51 runTestWithReboot("SingleAppTest", "testMimeGroupsIndependentAddToBoth"); 52 } 53 54 @Test testMimeGroupsIndependentRemove()55 public void testMimeGroupsIndependentRemove() throws DeviceNotAvailableException { 56 runTestWithReboot("SingleAppTest", "testMimeGroupsIndependentRemove"); 57 } 58 59 @Test testMimeGroupsIndependentClear()60 public void testMimeGroupsIndependentClear() throws DeviceNotAvailableException { 61 runTestWithReboot("SingleAppTest", "testMimeGroupsIndependentClear"); 62 } 63 64 @Test testMimeGroupsIndependentClearBoth()65 public void testMimeGroupsIndependentClearBoth() throws DeviceNotAvailableException { 66 runTestWithReboot("SingleAppTest", "testMimeGroupsIndependentClearBoth"); 67 } 68 69 @Test testMimeGroupsIndependentSet()70 public void testMimeGroupsIndependentSet() throws DeviceNotAvailableException { 71 runTestWithReboot("SingleAppTest", "testMimeGroupsIndependentSet"); 72 } 73 74 @Test testMimeGroupsIndependentSetBoth()75 public void testMimeGroupsIndependentSetBoth() throws DeviceNotAvailableException { 76 runTestWithReboot("SingleAppTest", "testMimeGroupsIndependentSetBoth"); 77 } 78 } 79