aboutsummaryrefslogtreecommitdiff
path: root/tests/common/src
diff options
context:
space:
mode:
authorNick Chalko <nchalko@google.com>2015-09-01 09:05:04 -0700
committerNick Chalko <nchalko@google.com>2015-09-16 06:46:50 -0700
commit07b043dc3db83d6d20f0e8513b946830ab00e37b (patch)
tree705ade719e5c2853c070fe40b8518a56ac37f6d0 /tests/common/src
parentb5429e4406a580953bbdac5817e421cf0ab7aae3 (diff)
downloadTV-07b043dc3db83d6d20f0e8513b946830ab00e37b.tar.gz
Sync to ub-tv-friends at 1.06.202
git hash 3c1965f5dcc60243f1fe600cb35f19bd5f01fc27 Change-Id: I90b77790f9074677ecef72a23235d2b33eacb76a
Diffstat (limited to 'tests/common/src')
-rw-r--r--tests/common/src/com/android/tv/testing/ChannelInfo.java41
-rw-r--r--tests/common/src/com/android/tv/testing/ChannelUtils.java9
-rw-r--r--tests/common/src/com/android/tv/testing/ComparableTester.java8
-rw-r--r--tests/common/src/com/android/tv/testing/Constants.java2
-rw-r--r--tests/common/src/com/android/tv/testing/ProgramInfo.java31
-rw-r--r--tests/common/src/com/android/tv/testing/Utils.java9
-rw-r--r--tests/common/src/com/android/tv/testing/testinput/ChannelState.java10
-rw-r--r--tests/common/src/com/android/tv/testing/testinput/TvTestInputConstants.java2
-rw-r--r--tests/common/src/com/android/tv/testing/uihelper/Constants.java6
-rw-r--r--tests/common/src/com/android/tv/testing/uihelper/DialogHelper.java3
-rw-r--r--tests/common/src/com/android/tv/testing/uihelper/LiveChannelsUiDeviceHelper.java12
-rw-r--r--tests/common/src/com/android/tv/testing/uihelper/MenuHelper.java15
-rw-r--r--tests/common/src/com/android/tv/testing/uihelper/SidePanelHelper.java4
-rw-r--r--tests/common/src/com/android/tv/testing/uihelper/UiDeviceAsserts.java5
-rw-r--r--tests/common/src/com/android/tv/testing/uihelper/UiDeviceUtils.java14
-rw-r--r--tests/common/src/com/android/tv/testing/uihelper/UiObject2Asserts.java2
16 files changed, 118 insertions, 55 deletions
diff --git a/tests/common/src/com/android/tv/testing/ChannelInfo.java b/tests/common/src/com/android/tv/testing/ChannelInfo.java
index 5197630f..40a8bba8 100644
--- a/tests/common/src/com/android/tv/testing/ChannelInfo.java
+++ b/tests/common/src/com/android/tv/testing/ChannelInfo.java
@@ -22,6 +22,8 @@ import android.media.tv.TvContract;
import android.support.annotation.Nullable;
import android.util.SparseArray;
+import java.util.Objects;
+
/**
* Channel Information.
*/
@@ -78,8 +80,12 @@ public final class ChannelInfo {
.setName("Channel " + channelNumber)
.setOriginalNetworkId(channelNumber);
if (context != null) {
- builder.setLogoUrl(Utils.getUriStringForResource(
- context, LOGOS_RES[channelNumber % LOGOS_RES.length]));
+ // tests/input/tools/get_test_logos.sh only stores 1000 logos.
+ int logo_num = (channelNumber % 1000) + 1;
+ builder.setLogoUrl(
+ "android.resource://com.android.tv.testinput/drawable/ch_" + logo_num
+ + "_logo"
+ );
}
return builder.build();
}
@@ -146,6 +152,37 @@ public final class ChannelInfo {
+ ", appLinkIntentUri=" + appLinkIntentUri + "}";
}
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ ChannelInfo that = (ChannelInfo) o;
+ return Objects.equals(originalNetworkId, that.originalNetworkId) &&
+ Objects.equals(videoWidth, that.videoWidth) &&
+ Objects.equals(videoHeight, that.videoHeight) &&
+ Objects.equals(audioChannel, that.audioChannel) &&
+ Objects.equals(audioLanguageCount, that.audioLanguageCount) &&
+ Objects.equals(hasClosedCaption, that.hasClosedCaption) &&
+ Objects.equals(appLinkColor, that.appLinkColor) &&
+ Objects.equals(number, that.number) &&
+ Objects.equals(name, that.name) &&
+ Objects.equals(logoUrl, that.logoUrl) &&
+ Objects.equals(program, that.program) &&
+ Objects.equals(appLinkText, that.appLinkText) &&
+ Objects.equals(appLinkIconUri, that.appLinkIconUri) &&
+ Objects.equals(appLinkPosterArtUri, that.appLinkPosterArtUri) &&
+ Objects.equals(appLinkIntentUri, that.appLinkIntentUri);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(number, name, originalNetworkId);
+ }
+
/**
* Builder class for {@code ChannelInfo}.
*/
diff --git a/tests/common/src/com/android/tv/testing/ChannelUtils.java b/tests/common/src/com/android/tv/testing/ChannelUtils.java
index aadbf727..8d96cbed 100644
--- a/tests/common/src/com/android/tv/testing/ChannelUtils.java
+++ b/tests/common/src/com/android/tv/testing/ChannelUtils.java
@@ -15,7 +15,6 @@
*/
package com.android.tv.testing;
-import android.annotation.TargetApi;
import android.content.ContentResolver;
import android.content.ContentValues;
import android.content.Context;
@@ -30,8 +29,6 @@ import android.text.TextUtils;
import android.util.Log;
import android.util.SparseArray;
-import com.android.tv.common.TvCommonConstants;
-
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
@@ -57,9 +54,7 @@ public class ChannelUtils {
String[] projections = new String[ChannelInfo.PROJECTION.length + 1];
projections[0] = Channels._ID;
- for (int i = 0; i < ChannelInfo.PROJECTION.length; i++) {
- projections[i + 1] = ChannelInfo.PROJECTION[i];
- }
+ System.arraycopy(ChannelInfo.PROJECTION, 0, projections, 1, ChannelInfo.PROJECTION.length);
try (Cursor cursor = context.getContentResolver()
.query(uri, projections, null, null, null)) {
if (cursor != null) {
@@ -100,7 +95,7 @@ public class ChannelUtils {
} else {
values.putNull(Channels.COLUMN_VIDEO_FORMAT);
}
- if (TvCommonConstants.IS_MNC_OR_HIGHER) {
+ if (Build.VERSION.SDK_INT >= 23) {
if (!TextUtils.isEmpty(channel.appLinkText)) {
values.put(Channels.COLUMN_APP_LINK_TEXT, channel.appLinkText);
}
diff --git a/tests/common/src/com/android/tv/testing/ComparableTester.java b/tests/common/src/com/android/tv/testing/ComparableTester.java
index d82e25c8..fe6e72f5 100644
--- a/tests/common/src/com/android/tv/testing/ComparableTester.java
+++ b/tests/common/src/com/android/tv/testing/ComparableTester.java
@@ -35,9 +35,9 @@ import java.util.List;
*
* <pre>{@code
* new ComparableTester<String>()
- * .addEquivelentGroup("Hello", "HELLO")
- * .addEquivelentGroup("World", "wORLD")
- * .addEquivelentGroup("ZEBRA")
+ * .addEquivalentGroup("Hello", "HELLO")
+ * .addEquivalentGroup("World", "wORLD")
+ * .addEquivalentGroup("ZEBRA")
* .test();
* }
* </pre>
@@ -49,7 +49,7 @@ public class ComparableTester<T extends Comparable<T>> {
private final List<List<T>> listOfGroups = new ArrayList<>();
@SafeVarargs
- public final ComparableTester<T> addEquivelentGroup(T... items) {
+ public final ComparableTester<T> addEquivalentGroup(T... items) {
listOfGroups.add(Arrays.asList(items));
return this;
}
diff --git a/tests/common/src/com/android/tv/testing/Constants.java b/tests/common/src/com/android/tv/testing/Constants.java
index 6575fa9e..83d8d293 100644
--- a/tests/common/src/com/android/tv/testing/Constants.java
+++ b/tests/common/src/com/android/tv/testing/Constants.java
@@ -23,7 +23,7 @@ import android.media.tv.TvTrackInfo;
public final class Constants {
public static final int FUNC_TEST_CHANNEL_COUNT = 100;
public static final int UNIT_TEST_CHANNEL_COUNT = 4;
- public static final int JANK_TEST_CHANNEL_COUNT = 1000;
+ public static final int JANK_TEST_CHANNEL_COUNT = 500; // TODO: increase to 1000 see b/23526997
public static final TvTrackInfo EN_STEREO_AUDIO_TRACK = new TvTrackInfo.Builder(
TvTrackInfo.TYPE_AUDIO, "English Stereo Audio").setLanguage("en")
diff --git a/tests/common/src/com/android/tv/testing/ProgramInfo.java b/tests/common/src/com/android/tv/testing/ProgramInfo.java
index 5b47d104..3f1f30ce 100644
--- a/tests/common/src/com/android/tv/testing/ProgramInfo.java
+++ b/tests/common/src/com/android/tv/testing/ProgramInfo.java
@@ -21,6 +21,7 @@ import android.database.Cursor;
import android.media.tv.TvContentRating;
import android.media.tv.TvContract;
+import java.util.Objects;
import java.util.concurrent.TimeUnit;
public final class ProgramInfo {
@@ -70,8 +71,8 @@ public final class ProgramInfo {
private static long DURATIONS_SUM_MS;
static {
DURATIONS_SUM_MS = 0;
- for (int i = 0; i < DURATIONS_MS.length; i++) {
- DURATIONS_SUM_MS += DURATIONS_MS[i];
+ for (long duration : DURATIONS_MS) {
+ DURATIONS_SUM_MS += duration;
}
}
@@ -212,6 +213,32 @@ public final class ProgramInfo {
+ ", durationMs=" + durationMs + "}";
}
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ ProgramInfo that = (ProgramInfo) o;
+ return Objects.equals(seasonNumber, that.seasonNumber) &&
+ Objects.equals(episodeNumber, that.episodeNumber) &&
+ Objects.equals(durationMs, that.durationMs) &&
+ Objects.equals(title, that.title) &&
+ Objects.equals(episode, that.episode) &&
+ Objects.equals(posterArtUri, that.posterArtUri) &&
+ Objects.equals(description, that.description) &&
+ Objects.equals(genre, that.genre) &&
+ Objects.equals(contentRatings, that.contentRatings) &&
+ Objects.equals(resourceUri, that.resourceUri);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(title, episode, seasonNumber, episodeNumber);
+ }
+
public static class Builder {
private String mTitle = GEN_TITLE;
private String mEpisode = GEN_EPISODE;
diff --git a/tests/common/src/com/android/tv/testing/Utils.java b/tests/common/src/com/android/tv/testing/Utils.java
index af4dbd18..33fe4c54 100644
--- a/tests/common/src/com/android/tv/testing/Utils.java
+++ b/tests/common/src/com/android/tv/testing/Utils.java
@@ -16,7 +16,6 @@
package com.android.tv.testing;
-import android.annotation.TargetApi;
import android.content.ComponentName;
import android.content.ContentResolver;
import android.content.Context;
@@ -26,13 +25,19 @@ import android.media.tv.TvContentRating;
import android.media.tv.TvInputInfo;
import android.media.tv.TvInputManager;
import android.net.Uri;
-import android.os.Build;
import android.text.TextUtils;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
+/**
+ * An utility class for testing.
+ *
+ * <p>This class is also used to check whether TV app is running in tests or not.
+ *
+ * @see com.android.tv.util.Utils#isRunningInTest
+ */
public class Utils {
public static String getUriStringForResource(Context context, int resId) {
if (resId == 0) {
diff --git a/tests/common/src/com/android/tv/testing/testinput/ChannelState.java b/tests/common/src/com/android/tv/testing/testinput/ChannelState.java
index 3d234dac..1b8f63cd 100644
--- a/tests/common/src/com/android/tv/testing/testinput/ChannelState.java
+++ b/tests/common/src/com/android/tv/testing/testinput/ChannelState.java
@@ -30,19 +30,19 @@ public class ChannelState {
/**
* The video track a channel has by default.
*/
- public static TvTrackInfo DEFAULT_VIDEO_TRACK = Constants.FHD1080P50_VIDEO_TRACK;
+ public static final TvTrackInfo DEFAULT_VIDEO_TRACK = Constants.FHD1080P50_VIDEO_TRACK;
/**
* The video track a channel has by default.
*/
- public static TvTrackInfo DEFAULT_AUDIO_TRACK = Constants.EN_STEREO_AUDIO_TRACK;
+ public static final TvTrackInfo DEFAULT_AUDIO_TRACK = Constants.EN_STEREO_AUDIO_TRACK;
/**
- * The channel is "tuned" and video availale.
+ * The channel is "tuned" and video available.
*
* @see #getTuneStatus()
*/
- public static int TUNE_STATUS_VIDEO_AVAILABLE = -2;
+ public static final int TUNE_STATUS_VIDEO_AVAILABLE = -2;
- private static int CHANNEL_VERSION_DEFAULT = 1;
+ private static final int CHANNEL_VERSION_DEFAULT = 1;
/**
* Default ChannelState with version @{value #CHANNEL_VERSION_DEFAULT} and default {@link
* ChannelStateData}.
diff --git a/tests/common/src/com/android/tv/testing/testinput/TvTestInputConstants.java b/tests/common/src/com/android/tv/testing/testinput/TvTestInputConstants.java
index e7ff4f5d..498addfd 100644
--- a/tests/common/src/com/android/tv/testing/testinput/TvTestInputConstants.java
+++ b/tests/common/src/com/android/tv/testing/testinput/TvTestInputConstants.java
@@ -28,7 +28,7 @@ public final class TvTestInputConstants {
* <p> By convention Channel 1 should not be changed. Test often start by tuning to this
* channel.
*/
- public static final ChannelInfo CH_1 = ChannelInfo.create(null, 1);
+ public static final ChannelInfo CH_1_DEFAULT_DONT_MODIFY = ChannelInfo.create(null, 1);
/**
* Channel 2.
*
diff --git a/tests/common/src/com/android/tv/testing/uihelper/Constants.java b/tests/common/src/com/android/tv/testing/uihelper/Constants.java
index 0297f3db..8f607fbf 100644
--- a/tests/common/src/com/android/tv/testing/uihelper/Constants.java
+++ b/tests/common/src/com/android/tv/testing/uihelper/Constants.java
@@ -20,12 +20,14 @@ import android.support.test.uiautomator.BySelector;
public final class Constants {
- public static final double EXTRA_TIMEOUT_PRECENT = .05;
+ public static final double EXTRA_TIMEOUT_PERCENT = .05;
public static final int MIN_EXTRA_TIMEOUT = 10;
public static final long MAX_SHOW_DELAY_MILLIS = 200;
public static final String TV_APP_PACKAGE = "com.android.tv";
+ public static final BySelector TV_VIEW = By.res(TV_APP_PACKAGE, "main_tunable_tv_view");
public static final BySelector CHANNEL_BANNER = By.res(TV_APP_PACKAGE, "channel_banner_view");
- public static final BySelector MENU = By.res(TV_APP_PACKAGE, "menu_list");
+ public static final BySelector KEYPAD_CHANNEL_SWITCH = By.res(TV_APP_PACKAGE, "channel_number");
+ public static final BySelector MENU = By.res(TV_APP_PACKAGE, "menu");
public static final BySelector SIDE_PANEL = By.res(TV_APP_PACKAGE, "side_panel");
public static final BySelector PROGRAM_GUIDE = By.res(TV_APP_PACKAGE, "program_guide");
public static final BySelector FOCUSED_VIEW = By.focused(true);
diff --git a/tests/common/src/com/android/tv/testing/uihelper/DialogHelper.java b/tests/common/src/com/android/tv/testing/uihelper/DialogHelper.java
index a2476a68..9e4040a8 100644
--- a/tests/common/src/com/android/tv/testing/uihelper/DialogHelper.java
+++ b/tests/common/src/com/android/tv/testing/uihelper/DialogHelper.java
@@ -26,9 +26,6 @@ import android.support.test.uiautomator.UiDevice;
import android.support.test.uiautomator.Until;
import com.android.tv.R;
-import com.android.tv.testing.uihelper.BaseUiDeviceHelper;
-import com.android.tv.testing.uihelper.ByResource;
-import com.android.tv.testing.uihelper.Constants;
/**
* Helper for testing {@link DialogFragment}s.
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 ffa45b35..31204410 100644
--- a/tests/common/src/com/android/tv/testing/uihelper/LiveChannelsUiDeviceHelper.java
+++ b/tests/common/src/com/android/tv/testing/uihelper/LiveChannelsUiDeviceHelper.java
@@ -1,5 +1,7 @@
package com.android.tv.testing.uihelper;
+import static com.android.tv.testing.uihelper.UiDeviceAsserts.waitForCondition;
+
import android.content.Context;
import android.content.Intent;
import android.content.res.Resources;
@@ -7,6 +9,7 @@ import android.support.test.uiautomator.By;
import android.support.test.uiautomator.BySelector;
import android.support.test.uiautomator.UiDevice;
import android.support.test.uiautomator.Until;
+import android.util.Log;
import junit.framework.Assert;
@@ -14,7 +17,8 @@ import junit.framework.Assert;
* Helper for testing the Live TV Application.
*/
public class LiveChannelsUiDeviceHelper extends BaseUiDeviceHelper {
- private static final int APPLICATION_START_TIMEOUT_MSEC = 500;
+ private static final String TAG = "LiveChannelsUiDevice";
+ private static final int APPLICATION_START_TIMEOUT_MSEC = 5000;
private final Context mContext;
@@ -29,14 +33,18 @@ public class LiveChannelsUiDeviceHelper extends BaseUiDeviceHelper {
.getLaunchIntentForPackage(Constants.TV_APP_PACKAGE);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK); // Clear out any previous instances
mContext.startActivity(intent);
+ // Wait for idle state before checking the channel banner because waitForCondition() has
+ // timeout.
mUiDevice.waitForIdle();
+ // Make sure that the activity is resumed.
+ waitForCondition(mUiDevice, Until.hasObject(Constants.TV_VIEW));
Assert.assertTrue(Constants.TV_APP_PACKAGE + " did not start", mUiDevice
.wait(Until.hasObject(By.pkg(Constants.TV_APP_PACKAGE).depth(0)),
APPLICATION_START_TIMEOUT_MSEC));
-
BySelector welcome = ByResource.id(mTargetResources, com.android.tv.R.id.intro);
if (mUiDevice.hasObject(welcome)) {
+ Log.i(TAG, "Welcome screen shown. Clearing dialog by pressing back");
mUiDevice.pressBack();
}
}
diff --git a/tests/common/src/com/android/tv/testing/uihelper/MenuHelper.java b/tests/common/src/com/android/tv/testing/uihelper/MenuHelper.java
index fe16ec27..cb403a61 100644
--- a/tests/common/src/com/android/tv/testing/uihelper/MenuHelper.java
+++ b/tests/common/src/com/android/tv/testing/uihelper/MenuHelper.java
@@ -27,13 +27,11 @@ import android.support.test.uiautomator.UiObject2;
import android.support.test.uiautomator.Until;
import com.android.tv.R;
-import com.android.tv.common.TvCommonConstants;
-import com.android.tv.menu.MenuView;
import junit.framework.Assert;
/**
- * Helper for testing {@link MenuView}.
+ * Helper for testing {@link com.android.tv.menu.Menu}.
*/
public class MenuHelper extends BaseUiDeviceHelper {
private final BySelector byChannels;
@@ -41,12 +39,7 @@ public class MenuHelper extends BaseUiDeviceHelper {
public MenuHelper(UiDevice uiDevice, Resources targetResources) {
super(uiDevice, targetResources);
byChannels = ByResource.id(mTargetResources, R.id.item_list)
- .hasDescendant(ByResource.text(mTargetResources, getMenuTitleChannelsResId()));
- }
-
- public int getMenuTitleChannelsResId() {
- return TvCommonConstants.IS_MNC_OR_HIGHER ? R.string.menu_title_channels
- : R.string.menu_title_channels_legacy;
+ .hasDescendant(ByResource.text(mTargetResources, R.string.menu_title_channels));
}
public BySelector getByChannels() {
@@ -104,7 +97,7 @@ public class MenuHelper extends BaseUiDeviceHelper {
UiDeviceAsserts.assertHas(mUiDevice, MENU, true);
// The play controls row doesn't have title when selected, so can't use
// MenuHelper.assertNavigateToRow().
- assertNavigateToRow(getMenuTitleChannelsResId());
+ assertNavigateToRow(R.string.menu_title_channels);
mUiDevice.pressDPadUp();
}
@@ -148,7 +141,7 @@ public class MenuHelper extends BaseUiDeviceHelper {
}
public UiObject2 assertPressProgramGuide() {
- return assertPressMenuItem(getMenuTitleChannelsResId(),
+ return assertPressMenuItem(R.string.menu_title_channels,
R.string.channels_item_program_guide);
}
diff --git a/tests/common/src/com/android/tv/testing/uihelper/SidePanelHelper.java b/tests/common/src/com/android/tv/testing/uihelper/SidePanelHelper.java
index d342723d..66edd4bb 100644
--- a/tests/common/src/com/android/tv/testing/uihelper/SidePanelHelper.java
+++ b/tests/common/src/com/android/tv/testing/uihelper/SidePanelHelper.java
@@ -24,10 +24,6 @@ import android.support.test.uiautomator.UiDevice;
import android.support.test.uiautomator.UiObject2;
import com.android.tv.R;
-import com.android.tv.testing.uihelper.BaseUiDeviceHelper;
-import com.android.tv.testing.uihelper.ByResource;
-import com.android.tv.testing.uihelper.Constants;
-import com.android.tv.testing.uihelper.UiDeviceAsserts;
import com.android.tv.ui.sidepanel.SideFragment;
import junit.framework.Assert;
diff --git a/tests/common/src/com/android/tv/testing/uihelper/UiDeviceAsserts.java b/tests/common/src/com/android/tv/testing/uihelper/UiDeviceAsserts.java
index 90d5a297..ea9b5460 100644
--- a/tests/common/src/com/android/tv/testing/uihelper/UiDeviceAsserts.java
+++ b/tests/common/src/com/android/tv/testing/uihelper/UiDeviceAsserts.java
@@ -16,7 +16,6 @@
package com.android.tv.testing.uihelper;
import static com.android.tv.testing.uihelper.Constants.FOCUSED_VIEW;
-
import static junit.framework.Assert.assertEquals;
import static junit.framework.Assert.assertTrue;
@@ -68,7 +67,7 @@ public final class UiDeviceAsserts {
*
* @param uiDevice The device under test.
* @param searchCondition The condition to wait for.
- * @return {@true} if the condition is met, otherwise {@code false}.
+ * @return {@code true} if the condition is met, otherwise {@code false}.
*/
public static boolean waitForCondition(UiDevice uiDevice,
SearchCondition<Boolean> searchCondition) {
@@ -78,7 +77,7 @@ public final class UiDeviceAsserts {
private static boolean waitForCondition(UiDevice uiDevice,
SearchCondition<Boolean> searchCondition, long timeout) {
long adjustedTimeout = timeout + Math.max(Constants.MIN_EXTRA_TIMEOUT,
- (long) (timeout * Constants.EXTRA_TIMEOUT_PRECENT));
+ (long) (timeout * Constants.EXTRA_TIMEOUT_PERCENT));
return uiDevice.wait(searchCondition, adjustedTimeout);
}
diff --git a/tests/common/src/com/android/tv/testing/uihelper/UiDeviceUtils.java b/tests/common/src/com/android/tv/testing/uihelper/UiDeviceUtils.java
index 420e0824..577559c2 100644
--- a/tests/common/src/com/android/tv/testing/uihelper/UiDeviceUtils.java
+++ b/tests/common/src/com/android/tv/testing/uihelper/UiDeviceUtils.java
@@ -24,16 +24,20 @@ import android.view.KeyEvent;
*/
public final class UiDeviceUtils {
- public static boolean pressDpad(UiDevice uiDevice, Direction direction) {
+ public static void pressDpad(UiDevice uiDevice, Direction direction) {
switch (direction) {
case UP:
- return uiDevice.pressDPadUp();
+ uiDevice.pressDPadUp();
+ break;
case DOWN:
- return uiDevice.pressDPadDown();
+ uiDevice.pressDPadDown();
+ break;
case LEFT:
- return uiDevice.pressDPadLeft();
+ uiDevice.pressDPadLeft();
+ break;
case RIGHT:
- return uiDevice.pressDPadRight();
+ uiDevice.pressDPadRight();
+ break;
default:
throw new IllegalArgumentException(direction.toString());
}
diff --git a/tests/common/src/com/android/tv/testing/uihelper/UiObject2Asserts.java b/tests/common/src/com/android/tv/testing/uihelper/UiObject2Asserts.java
index 9db70930..aba29f0e 100644
--- a/tests/common/src/com/android/tv/testing/uihelper/UiObject2Asserts.java
+++ b/tests/common/src/com/android/tv/testing/uihelper/UiObject2Asserts.java
@@ -52,7 +52,7 @@ public final class UiObject2Asserts {
public static long getAdjustedTimeout(long timeout) {
return timeout + Math.max(
- Constants.MIN_EXTRA_TIMEOUT, (long) (timeout * Constants.EXTRA_TIMEOUT_PRECENT));
+ Constants.MIN_EXTRA_TIMEOUT, (long) (timeout * Constants.EXTRA_TIMEOUT_PERCENT));
}
private UiObject2Asserts() {