1/* 2 * Copyright (C) 2017 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 */ 16package com.android.tv.tests.jank; 17 18import android.content.res.Resources; 19import android.support.test.jank.JankTestBase; 20import android.support.test.uiautomator.UiDevice; 21 22import com.android.tv.testing.uihelper.LiveChannelsUiDeviceHelper; 23 24/** 25 * Base test case for LiveChannel jank tests. 26 */ 27abstract class LiveChannelsTestCase extends JankTestBase { 28 protected UiDevice mDevice; 29 protected Resources mTargetResources; 30 protected LiveChannelsUiDeviceHelper mLiveChannelsHelper; 31 32 @Override 33 protected void setUp() throws Exception { 34 super.setUp(); 35 mDevice = UiDevice.getInstance(getInstrumentation()); 36 mTargetResources = getInstrumentation().getTargetContext().getResources(); 37 mLiveChannelsHelper = new LiveChannelsUiDeviceHelper(mDevice, mTargetResources, 38 getInstrumentation().getContext()); 39 mLiveChannelsHelper.assertAppStarted(); 40 } 41 42 @Override 43 protected void tearDown() throws Exception { 44 // Destroys the activity to make sure next test case's activity launch check works well. 45 mLiveChannelsHelper.assertAppStopped(); 46 super.tearDown(); 47 } 48} 49