| # Copyright 2016 The Chromium Authors | |
| # Use of this source code is governed by a BSD-style license that can be | |
| # found in the LICENSE file. | |
| # This file is for proguard flags which are applied to the combined test and | |
| # tested code. Do not put any flags in this file which might affect the | |
| # correctness of the .apk we are testing, since it will apply to that .apk as | |
| # well. | |
| # Keep all junit3 classes and tests | |
| -keep class junit.** { *; } | |
| -keep class * extends junit.** { *; } | |
| # Keep all junit4 and hamcrest classes and tests | |
| -keep class org.hamcrest.** { *; } | |
| -keep class org.junit.** { *; } | |
| -keep class * extends org.hamcrest.** { *; } | |
| -keep class * extends org.junit.** { *; } | |
| -keep @**.RunWith class * { *; } | |
| # Keep classes implementing ParameterProvider -- these will be instantiated | |
| # via reflection. | |
| -keep class * implements org.chromium.base.test.params.ParameterProvider { | |
| *; | |
| } | |
| # This matches how we keep @CalledByNative. | |
| -keep @interface org.chromium.base.annotations.CalledByNativeForTesting | |
| -keepclasseswithmembers,includedescriptorclasses,allowaccessmodification class ** { | |
| @org.chromium.base.annotations.CalledByNativeForTesting <methods>; | |
| } | |
| # Keep all classes that are in test packages. There is no benefit in testing | |
| # Proguarding of test classes, but this is as close as we can get to selecting | |
| # all classes from the test apk. | |
| -keep class **.test.** { *; } | |
| # Keep all interfaces that are mocked by Mockito. Since Mockito generates these | |
| # mocks at runtime, R8 doesn't know to preserve them (without these rules). | |
| -if class * { | |
| @org.mockito.Mock ** *; | |
| } | |
| -keep class <2> { | |
| <methods>; | |
| } | |
| -if class * { | |
| @org.mockito.Spy ** *; | |
| } | |
| -keep class <2> { | |
| <methods>; | |
| } | |
| -if class * { | |
| @org.mockito.Captor ** *; | |
| } | |
| -keep class <2> { | |
| <methods>; | |
| } | |
| # This is a workaround for b/147584922 - otherwise, R8 would generate a synthetic | |
| # abstract method for the subsclass FeedOfflineIndicator, which Mockito would not | |
| # mock. | |
| -keep,allowobfuscation @interface org.chromium.build.annotations.MockedInTests | |
| -keep @org.chromium.build.annotations.MockedInTests class * { | |
| <methods>; | |
| } | |
| # Keep all enum members since they might be reflectively called by JUnit4 runner | |
| -keepclassmembers enum * { *; } | |
| # Keep any annotation used by tests for instrumentation runner to list out | |
| # test annotation information | |
| -keepattributes *Annotation* | |
| # These are Java classes which aren't part of the Android sdk. They are | |
| # referenced by some test-only libraries. | |
| -dontwarn java.lang.ClassValue | |
| -dontwarn java.lang.instrument.ClassFileTransformer | |
| # We have some "library class WebView depends on program class SslCertificate" | |
| # warnings, and they don't affect us. | |
| -dontwarn android.webkit.WebView* |