| Index: chrome/test/android/javatests/src/org/chromium/chrome/test/ChromeInstrumentationTestRunner.java
|
| diff --git a/chrome/test/android/javatests/src/org/chromium/chrome/test/ChromeInstrumentationTestRunner.java b/chrome/test/android/javatests/src/org/chromium/chrome/test/ChromeInstrumentationTestRunner.java
|
| index 25fb441181fb564e6283a3789dce5c4d8b7c0e1f..5c71ab4d1fa2944308102a9ae0bc02932dc332c5 100644
|
| --- a/chrome/test/android/javatests/src/org/chromium/chrome/test/ChromeInstrumentationTestRunner.java
|
| +++ b/chrome/test/android/javatests/src/org/chromium/chrome/test/ChromeInstrumentationTestRunner.java
|
| @@ -10,13 +10,16 @@ import android.os.Environment;
|
| import android.text.TextUtils;
|
| import android.util.Log;
|
|
|
| +import com.google.android.gms.common.ConnectionResult;
|
| +import com.google.android.gms.common.GoogleApiAvailability;
|
| +
|
| import junit.framework.TestCase;
|
|
|
| import org.chromium.base.test.BaseInstrumentationTestRunner;
|
| import org.chromium.base.test.BaseTestResult;
|
| -import org.chromium.base.test.util.Restriction;
|
| import org.chromium.base.test.util.SkipCheck;
|
| import org.chromium.chrome.browser.util.FeatureUtilities;
|
| +import org.chromium.chrome.test.util.ChromeRestriction;
|
| import org.chromium.chrome.test.util.DisableInTabbedMode;
|
| import org.chromium.net.test.BaseHttpTestServer;
|
| import org.chromium.policy.test.annotations.Policies;
|
| @@ -219,17 +222,38 @@ public class ChromeInstrumentationTestRunner extends BaseInstrumentationTestRunn
|
| result.addPreTestHook(Policies.getRegistrationHook());
|
| }
|
|
|
| - private class ChromeRestrictionSkipCheck extends RestrictionSkipCheck {
|
| + private class ChromeRestrictionSkipCheck extends SkipCheck {
|
| @Override
|
| + public boolean shouldSkip(TestCase testCase) {
|
| + Method method = getTestMethod(testCase);
|
| + if (method == null) return true;
|
| +
|
| + ChromeRestriction restrictions = method.getAnnotation(ChromeRestriction.class);
|
| + if (restrictions != null) {
|
| + for (String restriction : restrictions.value()) {
|
| + if (restrictionApplies(restriction)) {
|
| + return true;
|
| + }
|
| + }
|
| + }
|
| + return false;
|
| + }
|
| +
|
| protected boolean restrictionApplies(String restriction) {
|
| - if (TextUtils.equals(restriction, Restriction.RESTRICTION_TYPE_PHONE)
|
| + if (TextUtils.equals(restriction, ChromeRestriction.RESTRICTION_TYPE_PHONE)
|
| && DeviceFormFactor.isTablet(getTargetContext())) {
|
| return true;
|
| }
|
| - if (TextUtils.equals(restriction, Restriction.RESTRICTION_TYPE_TABLET)
|
| + if (TextUtils.equals(restriction, ChromeRestriction.RESTRICTION_TYPE_TABLET)
|
| && !DeviceFormFactor.isTablet(getTargetContext())) {
|
| return true;
|
| }
|
| + if (TextUtils.equals(restriction,
|
| + ChromeRestriction.RESTRICTION_TYPE_GOOGLE_PLAY_SERVICES)
|
| + && (ConnectionResult.SUCCESS != GoogleApiAvailability.getInstance()
|
| + .isGooglePlayServicesAvailable(getTargetContext()))) {
|
| + return true;
|
| + }
|
| return false;
|
| }
|
| }
|
|
|