aboutsummaryrefslogtreecommitdiff
path: root/tests/jank/src/com/android
diff options
context:
space:
mode:
Diffstat (limited to 'tests/jank/src/com/android')
-rw-r--r--tests/jank/src/com/android/tv/tests/jank/ChannelZappingJankTest.java21
-rw-r--r--tests/jank/src/com/android/tv/tests/jank/LiveChannelsTestCase.java10
-rw-r--r--tests/jank/src/com/android/tv/tests/jank/MenuJankTest.java16
-rw-r--r--tests/jank/src/com/android/tv/tests/jank/ProgramGuideJankTest.java39
-rw-r--r--tests/jank/src/com/android/tv/tests/jank/Utils.java9
5 files changed, 44 insertions, 51 deletions
diff --git a/tests/jank/src/com/android/tv/tests/jank/ChannelZappingJankTest.java b/tests/jank/src/com/android/tv/tests/jank/ChannelZappingJankTest.java
index ef936e32..eee2328b 100644
--- a/tests/jank/src/com/android/tv/tests/jank/ChannelZappingJankTest.java
+++ b/tests/jank/src/com/android/tv/tests/jank/ChannelZappingJankTest.java
@@ -19,9 +19,7 @@ import android.support.test.filters.MediumTest;
import android.support.test.jank.GfxMonitor;
import android.support.test.jank.JankTest;
-/**
- * Jank tests for channel zapping.
- */
+/** Jank tests for channel zapping. */
@MediumTest
public class ChannelZappingJankTest extends LiveChannelsTestCase {
private static final String TAG = "ChannelZappingJankTest";
@@ -29,15 +27,17 @@ public class ChannelZappingJankTest extends LiveChannelsTestCase {
private static final String STARTING_CHANNEL = "13";
/**
- * The minimum number of frames expected during each jank test.
- * If there is less the test will fail. To be safe we loop the action in each test to create
- * twice this many frames under normal conditions.
- * <p>At least 100 frams should be chosen so there will be enough frame
- * for the 90th, 95th, and 98th percentile measurements are significant.
+ * The minimum number of frames expected during each jank test. If there is less the test will
+ * fail. To be safe we loop the action in each test to create twice this many frames under
+ * normal conditions.
+ *
+ * <p>At least 100 frams should be chosen so there will be enough frame for the 90th, 95th, and
+ * 98th percentile measurements are significant.
*
* @see <a href="http://go/janktesthelper-best-practices">Jank Test Helper Best Practices</a>
*/
private static final int EXPECTED_FRAMES = 100;
+
private static final int WARM_UP_CHANNEL_ZAPPING_COUNT = 2;
@Override
@@ -46,11 +46,10 @@ public class ChannelZappingJankTest extends LiveChannelsTestCase {
Utils.pressKeysForChannelNumber(STARTING_CHANNEL, mDevice);
}
- @JankTest(expectedFrames = EXPECTED_FRAMES,
- beforeTest = "warmChannelZapping")
+ @JankTest(expectedFrames = EXPECTED_FRAMES, beforeTest = "warmChannelZapping")
@GfxMonitor(processName = Utils.LIVE_CHANNELS_PROCESS_NAME)
public void testChannelZapping() {
- int frameCountForOneChannelZapping = 40; // measured by hand
+ int frameCountForOneChannelZapping = 40; // measured by hand
int repeat = EXPECTED_FRAMES * 2 / frameCountForOneChannelZapping;
for (int i = 0; i < repeat; i++) {
mDevice.pressDPadUp();
diff --git a/tests/jank/src/com/android/tv/tests/jank/LiveChannelsTestCase.java b/tests/jank/src/com/android/tv/tests/jank/LiveChannelsTestCase.java
index 6de01036..507e9dd5 100644
--- a/tests/jank/src/com/android/tv/tests/jank/LiveChannelsTestCase.java
+++ b/tests/jank/src/com/android/tv/tests/jank/LiveChannelsTestCase.java
@@ -18,12 +18,9 @@ package com.android.tv.tests.jank;
import android.content.res.Resources;
import android.support.test.jank.JankTestBase;
import android.support.test.uiautomator.UiDevice;
-
import com.android.tv.testing.uihelper.LiveChannelsUiDeviceHelper;
-/**
- * Base test case for LiveChannel jank tests.
- */
+/** Base test case for LiveChannel jank tests. */
abstract class LiveChannelsTestCase extends JankTestBase {
protected UiDevice mDevice;
protected Resources mTargetResources;
@@ -34,8 +31,9 @@ abstract class LiveChannelsTestCase extends JankTestBase {
super.setUp();
mDevice = UiDevice.getInstance(getInstrumentation());
mTargetResources = getInstrumentation().getTargetContext().getResources();
- mLiveChannelsHelper = new LiveChannelsUiDeviceHelper(mDevice, mTargetResources,
- getInstrumentation().getContext());
+ mLiveChannelsHelper =
+ new LiveChannelsUiDeviceHelper(
+ mDevice, mTargetResources, getInstrumentation().getContext());
mLiveChannelsHelper.assertAppStarted();
}
diff --git a/tests/jank/src/com/android/tv/tests/jank/MenuJankTest.java b/tests/jank/src/com/android/tv/tests/jank/MenuJankTest.java
index 411a0bb9..ea80eb3d 100644
--- a/tests/jank/src/com/android/tv/tests/jank/MenuJankTest.java
+++ b/tests/jank/src/com/android/tv/tests/jank/MenuJankTest.java
@@ -18,26 +18,25 @@ package com.android.tv.tests.jank;
import android.support.test.filters.MediumTest;
import android.support.test.jank.GfxMonitor;
import android.support.test.jank.JankTest;
-
import com.android.tv.testing.uihelper.MenuHelper;
-/**
- * Jank tests for the program guide.
- */
+/** Jank tests for the program guide. */
@MediumTest
public class MenuJankTest extends LiveChannelsTestCase {
private static final String STARTING_CHANNEL = "1";
/**
- * The minimum number of frames expected during each jank test.
- * If there is less the test will fail. To be safe we loop the action in each test to create
- * twice this many frames under normal conditions.
+ * The minimum number of frames expected during each jank test. If there is less the test will
+ * fail. To be safe we loop the action in each test to create twice this many frames under
+ * normal conditions.
+ *
* <p>200 is chosen so there will be enough frame for the 90th, 95th, and 98th percentile
* measurements are significant.
*
* @see <a href="http://go/janktesthelper-best-practices">Jank Test Helper Best Practices</a>
*/
private static final int EXPECTED_FRAMES = 200;
+
protected MenuHelper mMenuHelper;
@Override
@@ -47,8 +46,7 @@ public class MenuJankTest extends LiveChannelsTestCase {
Utils.pressKeysForChannelNumber(STARTING_CHANNEL, mDevice);
}
- @JankTest(expectedFrames = EXPECTED_FRAMES,
- beforeTest = "fillTheMenuRowWithPreviousChannels")
+ @JankTest(expectedFrames = EXPECTED_FRAMES, beforeTest = "fillTheMenuRowWithPreviousChannels")
@GfxMonitor(processName = Utils.LIVE_CHANNELS_PROCESS_NAME)
public void testShowMenu() {
int frames = 40; // measured by hand.
diff --git a/tests/jank/src/com/android/tv/tests/jank/ProgramGuideJankTest.java b/tests/jank/src/com/android/tv/tests/jank/ProgramGuideJankTest.java
index d8860dd7..57d38ba9 100644
--- a/tests/jank/src/com/android/tv/tests/jank/ProgramGuideJankTest.java
+++ b/tests/jank/src/com/android/tv/tests/jank/ProgramGuideJankTest.java
@@ -21,23 +21,21 @@ import android.support.test.filters.MediumTest;
import android.support.test.jank.GfxMonitor;
import android.support.test.jank.JankTest;
import android.support.test.uiautomator.Until;
-
import com.android.tv.R;
import com.android.tv.testing.uihelper.ByResource;
import com.android.tv.testing.uihelper.Constants;
import com.android.tv.testing.uihelper.MenuHelper;
-/**
- * Jank tests for the program guide.
- */
+/** Jank tests for the program guide. */
@MediumTest
public class ProgramGuideJankTest extends LiveChannelsTestCase {
private static final String STARTING_CHANNEL = "13";
/**
- * The minimum number of frames expected during each jank test.
- * If there is less the test will fail. To be safe we loop the action in each test to create
- * twice this many frames under normal conditions.
+ * The minimum number of frames expected during each jank test. If there is less the test will
+ * fail. To be safe we loop the action in each test to create twice this many frames under
+ * normal conditions.
+ *
* <p>200 is chosen so there will be enough frame for the 90th, 95th, and 98th percentile
* measurements are significant.
*
@@ -54,8 +52,7 @@ public class ProgramGuideJankTest extends LiveChannelsTestCase {
Utils.pressKeysForChannelNumber(STARTING_CHANNEL, mDevice);
}
- @JankTest(expectedFrames = EXPECTED_FRAMES,
- beforeTest = "warmProgramGuide")
+ @JankTest(expectedFrames = EXPECTED_FRAMES, beforeTest = "warmProgramGuide")
@GfxMonitor(processName = Utils.LIVE_CHANNELS_PROCESS_NAME)
public void testShowClearProgramGuide() {
int frames = 53; // measured by hand
@@ -66,24 +63,28 @@ public class ProgramGuideJankTest extends LiveChannelsTestCase {
}
}
- @JankTest(expectedFrames = EXPECTED_FRAMES,
- beforeLoop = "showAndFocusProgramGuide",
- afterLoop = "clearProgramGuide")
+ @JankTest(
+ expectedFrames = EXPECTED_FRAMES,
+ beforeLoop = "showAndFocusProgramGuide",
+ afterLoop = "clearProgramGuide"
+ )
@GfxMonitor(processName = Utils.LIVE_CHANNELS_PROCESS_NAME)
public void testScrollDown() {
- int frames = 20; // measured by hand
+ int frames = 20; // measured by hand
int repeat = EXPECTED_FRAMES * 2 / frames;
for (int i = 0; i < repeat; i++) {
mDevice.pressDPadDown();
}
}
- @JankTest(expectedFrames = EXPECTED_FRAMES,
- beforeLoop = "showAndFocusProgramGuide",
- afterLoop = "clearProgramGuide")
+ @JankTest(
+ expectedFrames = EXPECTED_FRAMES,
+ beforeLoop = "showAndFocusProgramGuide",
+ afterLoop = "clearProgramGuide"
+ )
@GfxMonitor(processName = Utils.LIVE_CHANNELS_PROCESS_NAME)
public void testScrollRight() {
- int frames = 30; // measured by hand
+ int frames = 30; // measured by hand
int repeat = EXPECTED_FRAMES * 2 / frames;
for (int i = 0; i < repeat; i++) {
mDevice.pressDPadRight();
@@ -92,8 +93,8 @@ public class ProgramGuideJankTest extends LiveChannelsTestCase {
private void selectProgramGuideMenuItem() {
mMenuHelper.showMenu();
- mMenuHelper.assertNavigateToMenuItem(R.string.menu_title_channels,
- R.string.channels_item_program_guide);
+ mMenuHelper.assertNavigateToMenuItem(
+ R.string.menu_title_channels, R.string.channels_item_program_guide);
mDevice.waitForIdle();
}
diff --git a/tests/jank/src/com/android/tv/tests/jank/Utils.java b/tests/jank/src/com/android/tv/tests/jank/Utils.java
index cd1f7eff..4ad0f643 100644
--- a/tests/jank/src/com/android/tv/tests/jank/Utils.java
+++ b/tests/jank/src/com/android/tv/tests/jank/Utils.java
@@ -15,19 +15,16 @@
*/
package com.android.tv.tests.jank;
-import com.android.tv.testing.uihelper.UiDeviceUtils;
-
import android.support.test.uiautomator.UiDevice;
+import com.android.tv.testing.uihelper.UiDeviceUtils;
public final class Utils {
/** Live TV process name */
public static final String LIVE_CHANNELS_PROCESS_NAME = "com.android.tv";
- private Utils() { }
+ private Utils() {}
- /**
- * Presses channel number to tune to {@code channel}.
- */
+ /** Presses channel number to tune to {@code channel}. */
public static void pressKeysForChannelNumber(String channel, UiDevice uiDevice) {
UiDeviceUtils.pressKeys(uiDevice, channel);
uiDevice.pressDPadCenter();