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 c446243a63d225087b01f88cb10423740923ed8b..5dbc96d606d80a558c4dafee99b5ed1f76dfa0b4 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 |
@@ -57,12 +57,14 @@ public class ChromeInstrumentationTestRunner extends BaseChromiumInstrumentation |
result.addPreTestHook(Policies.getRegistrationHook()); |
} |
- private class ChromeRestrictionSkipCheck extends RestrictionSkipCheck { |
+ static class ChromeRestrictionSkipCheck extends RestrictionSkipCheck { |
private VrDaydreamApi mDaydreamApi; |
private boolean mAttemptedToGetApi; |
+ private Context mTargetContext; |
public ChromeRestrictionSkipCheck(Context targetContext) { |
super(targetContext); |
+ mTargetContext = targetContext; |
jbudorick
2017/03/22 15:58:07
This should not store the target context. Restrict
the real yoland
2017/03/22 17:43:33
Done
|
} |
@SuppressWarnings("unchecked") |
@@ -77,7 +79,7 @@ public class ChromeInstrumentationTestRunner extends BaseChromiumInstrumentation |
vrClassesBuilderClass.getConstructor(); |
VrClassesWrapper vrClassesBuilder = |
(VrClassesWrapper) vrClassesBuilderConstructor.newInstance(); |
- mDaydreamApi = vrClassesBuilder.createVrDaydreamApi(getTargetContext()); |
+ mDaydreamApi = vrClassesBuilder.createVrDaydreamApi(mTargetContext); |
jbudorick
2017/03/22 15:58:07
Perhaps we should expose that context via a method
the real yoland
2017/03/22 17:43:33
Done
|
} catch (ClassNotFoundException | InstantiationException | IllegalAccessException |
| IllegalArgumentException | InvocationTargetException |
| NoSuchMethodException e) { |
@@ -121,17 +123,18 @@ public class ChromeInstrumentationTestRunner extends BaseChromiumInstrumentation |
@Override |
protected boolean restrictionApplies(String restriction) { |
if (TextUtils.equals(restriction, ChromeRestriction.RESTRICTION_TYPE_PHONE) |
- && DeviceFormFactor.isTablet(getTargetContext())) { |
+ && DeviceFormFactor.isTablet(mTargetContext)) { |
return true; |
} |
if (TextUtils.equals(restriction, ChromeRestriction.RESTRICTION_TYPE_TABLET) |
- && !DeviceFormFactor.isTablet(getTargetContext())) { |
+ && !DeviceFormFactor.isTablet(mTargetContext)) { |
return true; |
} |
- if (TextUtils.equals(restriction, |
- ChromeRestriction.RESTRICTION_TYPE_GOOGLE_PLAY_SERVICES) |
- && (ConnectionResult.SUCCESS != GoogleApiAvailability.getInstance() |
- .isGooglePlayServicesAvailable(getTargetContext()))) { |
+ if (TextUtils.equals( |
+ restriction, ChromeRestriction.RESTRICTION_TYPE_GOOGLE_PLAY_SERVICES) |
+ && (ConnectionResult.SUCCESS |
+ != GoogleApiAvailability.getInstance().isGooglePlayServicesAvailable( |
+ mTargetContext))) { |
return true; |
} |
if (TextUtils.equals(restriction, |
@@ -185,8 +188,7 @@ public class ChromeInstrumentationTestRunner extends BaseChromiumInstrumentation |
} |
} |
- private class ChromeDisableIfSkipCheck extends DisableIfSkipCheck { |
- |
+ static class ChromeDisableIfSkipCheck extends DisableIfSkipCheck { |
private final Context mTargetContext; |
public ChromeDisableIfSkipCheck(Context targetContext) { |
@@ -196,15 +198,15 @@ public class ChromeInstrumentationTestRunner extends BaseChromiumInstrumentation |
@Override |
protected boolean deviceTypeApplies(String type) { |
if (TextUtils.equals(type, ChromeDisableIf.PHONE) |
- && !DeviceFormFactor.isTablet(getTargetContext())) { |
+ && !DeviceFormFactor.isTablet(mTargetContext)) { |
return true; |
} |
if (TextUtils.equals(type, ChromeDisableIf.TABLET) |
- && DeviceFormFactor.isTablet(getTargetContext())) { |
+ && DeviceFormFactor.isTablet(mTargetContext)) { |
return true; |
} |
if (TextUtils.equals(type, ChromeDisableIf.LARGETABLET) |
- && DeviceFormFactor.isLargeTablet(getTargetContext())) { |
+ && DeviceFormFactor.isLargeTablet(mTargetContext)) { |
return true; |
} |
return false; |