1 /*
2  * Copyright (C) 2021 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.cts.delegate;
17 
18 import android.app.admin.DevicePolicyManager;
19 import android.content.Context;
20 import android.support.test.uiautomator.UiDevice;
21 import android.test.InstrumentationTestCase;
22 import android.util.Log;
23 
24 import androidx.test.InstrumentationRegistry;
25 
26 /**
27  * Superclass for {@code JUnit 3} based tests in this package.
28  */
29 // TODO(b/30839080): remove this class once tests are refactored to use JUnit4
30 abstract class BaseJUnit3TestCase extends InstrumentationTestCase {
31 
32     private static final String TAG = BaseJUnit3TestCase.class.getSimpleName();
33 
34     protected UiDevice mDevice;
35     protected DevicePolicyManager mDpm;
36     protected Context mContext;
37 
38     @Override
setUp()39     protected void setUp() throws Exception {
40         super.setUp();
41 
42         mDevice = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation());
43         mContext = getInstrumentation().getContext();
44         mDpm = BaseTestCase.getDpm(mContext);
45         Log.d(TAG, getClass().getName() + ".setup(): dpm=" + mDpm);
46     }
47 }
48