1 /*
2  * Copyright (C) 2020 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.testapp.update;
18 
19 import static android.dynamicmime.common.Constants.PACKAGE_UPDATE_APP;
20 
21 import android.dynamicmime.testapp.BaseDynamicMimeTest;
22 import android.dynamicmime.testapp.assertions.MimeGroupAssertions;
23 import android.dynamicmime.testapp.commands.MimeGroupCommands;
24 import android.dynamicmime.testapp.util.Utils;
25 
26 import org.junit.After;
27 import org.junit.Before;
28 
29 import java.io.IOException;
30 
31 abstract class BaseUpdateTest extends BaseDynamicMimeTest {
BaseUpdateTest()32     BaseUpdateTest() {
33         super(MimeGroupCommands.appWithUpdates(context()),
34                 MimeGroupAssertions.appWithUpdates(context()));
35     }
36 
37     @Before
setUp()38     public void setUp() throws IOException {
39         Utils.installApk(installApkPath());
40     }
41 
42     @After
43     @Override
tearDown()44     public void tearDown() {
45         super.tearDown();
46         Utils.uninstallApp(PACKAGE_UPDATE_APP);
47     }
48 
updateApp()49     void updateApp() {
50         Utils.updateApp(updateApkPath());
51     }
52 
installApkPath()53     abstract String installApkPath();
updateApkPath()54     abstract String updateApkPath();
55 }
56