IncompatibilityTest.java revision 055157a7821fe8a24e14e619b1036bb2d6d4e2a8
1/* 2 * Copyright 2018 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17package androidx.webkit; 18 19import static org.junit.Assert.assertEquals; 20import static org.junit.Assert.assertFalse; 21 22import android.support.test.filters.MediumTest; 23import android.support.test.filters.SdkSuppress; 24import android.support.test.runner.AndroidJUnit4; 25 26import androidx.webkit.internal.WebViewFeatureInternal; 27 28import org.junit.Test; 29import org.junit.runner.RunWith; 30 31/** 32 * Tests ensuring that Android versions/setups that are incompatible with the WebView Support 33 * Library are handled gracefully. 34 * 35 * Only L+ Android versions are compatible with the WebView Support Library, so any tests in this 36 * class that guarantee certain behaviour for incompatible Android versions will only be run on 37 * pre-L devices. 38 */ 39@MediumTest 40@RunWith(AndroidJUnit4.class) 41public class IncompatibilityTest { 42 @Test 43 @SdkSuppress(maxSdkVersion = 20) 44 public void testPreLDeviceHasNoWebViewFeatures() { 45 assertEquals(0, WebViewFeatureInternal.getWebViewApkFeaturesForTesting().length); 46 } 47 48 @Test 49 @SdkSuppress(maxSdkVersion = 20) 50 public void testPreLDeviceDoesNotSupportVisualStateCallback() { 51 assertFalse(WebViewFeature.isFeatureSupported(WebViewFeature.VISUAL_STATE_CALLBACK)); 52 } 53} 54