• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2015 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 com.android.messaging.ui;
18 
19 import android.app.Activity;
20 
21 import com.android.messaging.BugleTestCase;
22 import com.android.messaging.TestUtil;
23 
24 /**
25  * Helper class that extends ActivityInstrumentationTestCase2 to provide some extra common
26  * initialization (eg. Mockito boilerplate).
27  */
28 public class BugleActivityInstrumentationTestCase<T extends Activity>
29     extends android.test.ActivityInstrumentationTestCase2<T> {
30 
31     static {
32         // Set flag during loading of test cases to prevent application initialization starting
BugleTestCase.setTestsRunning()33         BugleTestCase.setTestsRunning();
34     }
35 
BugleActivityInstrumentationTestCase(final Class<T> activityClass)36     public BugleActivityInstrumentationTestCase(final Class<T> activityClass) {
37         super(activityClass);
38     }
39 
40     @Override
setUp()41     protected void setUp() throws Exception {
42       super.setUp();
43       setActivityInitialTouchMode(false);
44       TestUtil.testSetup(getInstrumentation().getTargetContext(), this);
45     }
46 
47     @Override
tearDown()48     protected void tearDown() throws Exception {
49         super.tearDown();
50         TestUtil.testTeardown(this);
51     }
52 }