| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 package org.chromium.chrome.test; | 5 package org.chromium.chrome.test; |
| 6 | 6 |
| 7 import android.content.Context; | 7 import android.content.Context; |
| 8 import android.os.Build; | 8 import android.os.Build; |
| 9 import android.os.Bundle; | 9 import android.os.Bundle; |
| 10 import android.text.TextUtils; | 10 import android.text.TextUtils; |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 } | 110 } |
| 111 | 111 |
| 112 private boolean supportsWebVr() { | 112 private boolean supportsWebVr() { |
| 113 // WebVR support is tied to VR Services support, which is only on K+ | 113 // WebVR support is tied to VR Services support, which is only on K+ |
| 114 return Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT; | 114 return Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT; |
| 115 } | 115 } |
| 116 | 116 |
| 117 @Override | 117 @Override |
| 118 protected boolean restrictionApplies(String restriction) { | 118 protected boolean restrictionApplies(String restriction) { |
| 119 if (TextUtils.equals(restriction, ChromeRestriction.RESTRICTION_TYPE
_PHONE) | 119 if (TextUtils.equals(restriction, ChromeRestriction.RESTRICTION_TYPE
_PHONE) |
| 120 && DeviceFormFactor.isTablet(getTargetContext())) { | 120 && DeviceFormFactor.isTablet()) { |
| 121 return true; | 121 return true; |
| 122 } | 122 } |
| 123 if (TextUtils.equals(restriction, ChromeRestriction.RESTRICTION_TYPE
_TABLET) | 123 if (TextUtils.equals(restriction, ChromeRestriction.RESTRICTION_TYPE
_TABLET) |
| 124 && !DeviceFormFactor.isTablet(getTargetContext())) { | 124 && !DeviceFormFactor.isTablet()) { |
| 125 return true; | 125 return true; |
| 126 } | 126 } |
| 127 if (TextUtils.equals( | 127 if (TextUtils.equals( |
| 128 restriction, ChromeRestriction.RESTRICTION_TYPE_GOOGLE_P
LAY_SERVICES) | 128 restriction, ChromeRestriction.RESTRICTION_TYPE_GOOGLE_P
LAY_SERVICES) |
| 129 && (ConnectionResult.SUCCESS | 129 && (ConnectionResult.SUCCESS |
| 130 != GoogleApiAvailability.getInstance().isGooglePl
ayServicesAvailable( | 130 != GoogleApiAvailability.getInstance().isGooglePl
ayServicesAvailable( |
| 131 getTargetContext()))) { | 131 getTargetContext()))) { |
| 132 return true; | 132 return true; |
| 133 } | 133 } |
| 134 if (TextUtils.equals(restriction, | 134 if (TextUtils.equals(restriction, |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 | 184 |
| 185 static class ChromeDisableIfSkipCheck extends DisableIfSkipCheck { | 185 static class ChromeDisableIfSkipCheck extends DisableIfSkipCheck { |
| 186 private final Context mTargetContext; | 186 private final Context mTargetContext; |
| 187 | 187 |
| 188 public ChromeDisableIfSkipCheck(Context targetContext) { | 188 public ChromeDisableIfSkipCheck(Context targetContext) { |
| 189 mTargetContext = targetContext; | 189 mTargetContext = targetContext; |
| 190 } | 190 } |
| 191 | 191 |
| 192 @Override | 192 @Override |
| 193 protected boolean deviceTypeApplies(String type) { | 193 protected boolean deviceTypeApplies(String type) { |
| 194 if (TextUtils.equals(type, ChromeDisableIf.PHONE) | 194 if (TextUtils.equals(type, ChromeDisableIf.PHONE) && !DeviceFormFact
or.isTablet()) { |
| 195 && !DeviceFormFactor.isTablet(mTargetContext)) { | |
| 196 return true; | 195 return true; |
| 197 } | 196 } |
| 198 if (TextUtils.equals(type, ChromeDisableIf.TABLET) | 197 if (TextUtils.equals(type, ChromeDisableIf.TABLET) && DeviceFormFact
or.isTablet()) { |
| 199 && DeviceFormFactor.isTablet(mTargetContext)) { | |
| 200 return true; | 198 return true; |
| 201 } | 199 } |
| 202 if (TextUtils.equals(type, ChromeDisableIf.LARGETABLET) | 200 if (TextUtils.equals(type, ChromeDisableIf.LARGETABLET) |
| 203 && DeviceFormFactor.isLargeTablet(mTargetContext)) { | 201 && DeviceFormFactor.isLargeTablet(mTargetContext)) { |
| 204 return true; | 202 return true; |
| 205 } | 203 } |
| 206 return false; | 204 return false; |
| 207 } | 205 } |
| 208 } | 206 } |
| 209 } | 207 } |
| OLD | NEW |