• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2018 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.cts.backup;
18 
19 import static org.junit.Assert.assertNull;
20 
21 import android.platform.test.annotations.AppModeFull;
22 
23 import com.android.tradefed.device.DeviceNotAvailableException;
24 import com.android.tradefed.log.LogUtil;
25 import com.android.tradefed.testtype.DeviceJUnit4ClassRunner;
26 
27 import org.junit.After;
28 import org.junit.Before;
29 import org.junit.Test;
30 import org.junit.runner.RunWith;
31 
32 /**
33  * Tests for checking other sounds settings value backup and restore works correctly.
34  * The tests use "bmgr backupnow com.android.providers.settings" for backup
35  *
36  * Invokes device side tests provided by
37  * {@link android.cts.backup.othersoundssettingsapp.OtherSoundsSettingsTest}.
38  */
39 @RunWith(DeviceJUnit4ClassRunner.class)
40 @AppModeFull
41 public class OtherSoundsSettingsHostSideTest extends BaseBackupHostSideTest {
42 
43     /** The name of the APK that a other sounds settings test will be run for */
44     private static final String APP_APK = "CtsBackupOtherSoundsSettingsApp.apk";
45 
46     /** The name of the package of the app under test */
47     private static final String APP_PACKAGE = "android.cts.backup.othersoundssettingsapp";
48 
49     /** The name of the device side test class */
50     private static final String TEST_CLASS = APP_PACKAGE + ".OtherSoundsSettingsTest";
51 
52     @Before
53     @Override
setUp()54     public void setUp() throws Exception {
55         super.setUp();
56         installPackage(APP_APK);
57     }
58 
59     @After
tearDown()60     public void tearDown() throws Exception {
61         // Clear backup data and uninstall the package (in that order!)
62         clearBackupDataInLocalTransport(APP_PACKAGE);
63         assertNull(uninstallPackage(APP_PACKAGE));
64     }
65 
66     /**
67      * Test backup and restore of Dial pad tones
68      */
69     @Test
testOtherSoundsSettings_dialPadTones()70     public void testOtherSoundsSettings_dialPadTones() throws Exception {
71         checkDeviceTest("testOtherSoundsSettings_dialPadTones");
72     }
73 
74     /**
75      * Test backup and restore of Touch sounds
76      */
77     @Test
testOtherSoundsSettings_touchSounds()78     public void testOtherSoundsSettings_touchSounds() throws Exception {
79         checkDeviceTest("testOtherSoundsSettings_touchSounds");
80     }
81 
82     /**
83      * Test backup and restore of Touch vibration
84      */
85     @Test
testOtherSoundsSettings_touchVibration()86     public void testOtherSoundsSettings_touchVibration() throws Exception {
87         checkDeviceTest("testOtherSoundsSettings_touchVibration");
88     }
89 
checkDeviceTest(String methodName)90     private void checkDeviceTest(String methodName) throws DeviceNotAvailableException {
91         checkDeviceTest(APP_PACKAGE, TEST_CLASS, methodName);
92     }
93 }
94