aboutsummaryrefslogtreecommitdiff
path: root/common/src/com/android/tv/common/feature/TestableFeature.java
diff options
context:
space:
mode:
Diffstat (limited to 'common/src/com/android/tv/common/feature/TestableFeature.java')
-rw-r--r--common/src/com/android/tv/common/feature/TestableFeature.java38
1 files changed, 17 insertions, 21 deletions
diff --git a/common/src/com/android/tv/common/feature/TestableFeature.java b/common/src/com/android/tv/common/feature/TestableFeature.java
index d7e707a1..1f18639d 100644
--- a/common/src/com/android/tv/common/feature/TestableFeature.java
+++ b/common/src/com/android/tv/common/feature/TestableFeature.java
@@ -19,33 +19,28 @@ package com.android.tv.common.feature;
import android.content.Context;
import android.support.annotation.VisibleForTesting;
import android.util.Log;
-
-import com.android.tv.common.TvCommonUtils;
+import com.android.tv.common.util.CommonUtils;
/**
* When run in a test harness this feature can be turned on or off, overriding the normal value.
*
- * <p><b>Warning</b> making a feature testable will cause the code to stay in the APK and
- * could leak unreleased features.
+ * <p><b>Warning</b> making a feature testable will cause the code to stay in the APK and could leak
+ * unreleased features.
*/
public class TestableFeature implements Feature {
- private final static String TAG = "TestableFeature";
- private final static String DETAIL_MESSAGE
- = "TestableFeatures should only be changed in tests.";
+ private static final String TAG = "TestableFeature";
+ private static final String DETAIL_MESSAGE =
+ "TestableFeatures should only be changed in tests.";
private final Feature mDelegate;
private Boolean mTestValue = null;
- /**
- * Creates testable feature.
- */
+ /** Creates testable feature. */
public static TestableFeature createTestableFeature(Feature delegate) {
return new TestableFeature(delegate);
}
- /**
- * Creates testable feature with initial value.
- */
+ /** Creates testable feature with initial value. */
public static TestableFeature createTestableFeature(Feature delegate, Boolean initialValue) {
return new TestableFeature(delegate, initialValue);
}
@@ -61,9 +56,8 @@ public class TestableFeature implements Feature {
@VisibleForTesting
public void enableForTest() {
- if (!TvCommonUtils.isRunningInTest()) {
- Log.e(TAG, "Not enabling for test:" + this,
- new IllegalStateException(DETAIL_MESSAGE));
+ if (!CommonUtils.isRunningInTest()) {
+ Log.e(TAG, "Not enabling for test:" + this, new IllegalStateException(DETAIL_MESSAGE));
} else {
mTestValue = true;
}
@@ -71,8 +65,10 @@ public class TestableFeature implements Feature {
@VisibleForTesting
public void disableForTests() {
- if (!TvCommonUtils.isRunningInTest()) {
- Log.e(TAG, "Not disabling for test: " + this,
+ if (!CommonUtils.isRunningInTest()) {
+ Log.e(
+ TAG,
+ "Not disabling for test: " + this,
new IllegalStateException(DETAIL_MESSAGE));
} else {
mTestValue = false;
@@ -81,7 +77,7 @@ public class TestableFeature implements Feature {
@VisibleForTesting
public void resetForTests() {
- if (!TvCommonUtils.isRunningInTest()) {
+ if (!CommonUtils.isRunningInTest()) {
Log.e(TAG, "Not resetting feature: " + this, new IllegalStateException(DETAIL_MESSAGE));
} else {
mTestValue = null;
@@ -90,7 +86,7 @@ public class TestableFeature implements Feature {
@Override
public boolean isEnabled(Context context) {
- if (TvCommonUtils.isRunningInTest() && mTestValue != null) {
+ if (CommonUtils.isRunningInTest() && mTestValue != null) {
return mTestValue;
}
return mDelegate.isEnabled(context);
@@ -99,7 +95,7 @@ public class TestableFeature implements Feature {
@Override
public String toString() {
String msg = mDelegate.toString();
- if (TvCommonUtils.isRunningInTest()) {
+ if (CommonUtils.isRunningInTest()) {
if (mTestValue == null) {
msg = "Testable Feature is unchanged: " + msg;
} else {