Chromium Code Reviews| Index: chrome/android/java/src/org/chromium/chrome/browser/webapps/ChromeWebApkHost.java |
| diff --git a/chrome/android/java/src/org/chromium/chrome/browser/webapps/ChromeWebApkHost.java b/chrome/android/java/src/org/chromium/chrome/browser/webapps/ChromeWebApkHost.java |
| index 3cb43b093749aabd8bc7540abade7d80faff7d31..77270c0faeb9a70ac8b247fe1411009aff042f2e 100644 |
| --- a/chrome/android/java/src/org/chromium/chrome/browser/webapps/ChromeWebApkHost.java |
| +++ b/chrome/android/java/src/org/chromium/chrome/browser/webapps/ChromeWebApkHost.java |
| @@ -27,23 +27,17 @@ public class ChromeWebApkHost { |
| /** Whether installing WebAPks from Google Play is possible. */ |
| private static Integer sGooglePlayInstallState; |
| - private static Boolean sEnabledForTesting; |
| + private static Boolean sInstallsEnabledForTesting; |
| public static void init() { |
| WebApkValidator.init( |
| ChromeWebApkHostSignature.EXPECTED_SIGNATURE, ChromeWebApkHostSignature.PUBLIC_KEY); |
| } |
| - public static void initForTesting(boolean enabled) { |
| - sEnabledForTesting = enabled; |
| - sGooglePlayInstallState = enabled ? GooglePlayInstallState.SUPPORTED |
| - : GooglePlayInstallState.NO_PLAY_SERVICES; |
| - } |
| - |
| - public static boolean isEnabled() { |
| - if (sEnabledForTesting != null) return sEnabledForTesting; |
| - |
| - return isEnabledInPrefs(); |
| + public static void initForTesting(boolean installsEnabled) { |
| + sInstallsEnabledForTesting = installsEnabled; |
| + sGooglePlayInstallState = installsEnabled ? GooglePlayInstallState.SUPPORTED |
| + : GooglePlayInstallState.NO_PLAY_SERVICES; |
| } |
| /** Computes the GooglePlayInstallState. */ |
| @@ -66,7 +60,10 @@ public class ChromeWebApkHost { |
| /** Returns whether installing WebAPKs is possible. */ |
| @CalledByNative |
| private static boolean canInstallWebApk() { |
|
Yaron
2017/07/06 17:09:15
I think you can go one step further. Remember we t
pkotwicz
2017/07/06 18:49:16
Changing the googleplayinstallstate call is your j
|
| - return isEnabled() && getGooglePlayInstallState() == GooglePlayInstallState.SUPPORTED; |
| + if (sInstallsEnabledForTesting != null) return sInstallsEnabledForTesting; |
| + |
| + return isEnabledInPrefs() |
| + && getGooglePlayInstallState() == GooglePlayInstallState.SUPPORTED; |
| } |
| @CalledByNative |
| @@ -79,8 +76,7 @@ public class ChromeWebApkHost { |
| /* Returns whether launching renderer in WebAPK process is enabled by Chrome. */ |
| public static boolean canLaunchRendererInWebApkProcess() { |
| - return isEnabled() && LibraryLoader.isInitialized() |
| - && nativeCanLaunchRendererInWebApkProcess(); |
| + return LibraryLoader.isInitialized() && nativeCanLaunchRendererInWebApkProcess(); |
| } |
| /** |