diff options
Diffstat (limited to 'tests/common/src/com/android/tv/testing/uihelper/LiveChannelsUiDeviceHelper.java')
-rw-r--r-- | tests/common/src/com/android/tv/testing/uihelper/LiveChannelsUiDeviceHelper.java | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/common/src/com/android/tv/testing/uihelper/LiveChannelsUiDeviceHelper.java b/tests/common/src/com/android/tv/testing/uihelper/LiveChannelsUiDeviceHelper.java index 6757cf01..1dc0f020 100644 --- a/tests/common/src/com/android/tv/testing/uihelper/LiveChannelsUiDeviceHelper.java +++ b/tests/common/src/com/android/tv/testing/uihelper/LiveChannelsUiDeviceHelper.java @@ -1,6 +1,7 @@ package com.android.tv.testing.uihelper; import static com.android.tv.testing.uihelper.UiDeviceAsserts.waitForCondition; +import static junit.framework.TestCase.assertTrue; import android.content.Context; import android.content.Intent; @@ -11,6 +12,8 @@ import android.support.test.uiautomator.UiDevice; import android.support.test.uiautomator.Until; import android.util.Log; +import com.android.tv.testing.Utils; + import junit.framework.Assert; /** @@ -29,6 +32,7 @@ public class LiveChannelsUiDeviceHelper extends BaseUiDeviceHelper { } public void assertAppStarted() { + assertTrue("TvActivity should be enabled.", Utils.isTvActivityEnabled(mContext)); Intent intent = mContext.getPackageManager() .getLaunchIntentForPackage(Constants.TV_APP_PACKAGE); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK); // Clear out any previous instances @@ -48,4 +52,11 @@ public class LiveChannelsUiDeviceHelper extends BaseUiDeviceHelper { mUiDevice.pressBack(); } } + + public void assertAppStopped() { + while(mUiDevice.hasObject(By.pkg(Constants.TV_APP_PACKAGE).depth(0))) { + mUiDevice.pressBack(); + mUiDevice.waitForIdle(); + } + } }
\ No newline at end of file |