1# Copyright 2016 The Chromium Authors 2# Use of this source code is governed by a BSD-style license that can be 3# found in the LICENSE file. 4 5# This file is for proguard flags which are applied to the combined test and 6# tested code. Do not put any flags in this file which might affect the 7# correctness of the .apk we are testing, since it will apply to that .apk as 8# well. 9 10# Keep all junit3 classes and tests 11-keep class !cr_allowunused,junit.** { *; } 12-keep class !cr_allowunused,** extends junit.** { *; } 13 14# Keep all junit4 and hamcrest classes and tests 15-keep class !cr_allowunused,org.hamcrest.** { *; } 16-keep class !cr_allowunused,org.junit.** { *; } 17-keep class !cr_allowunused,* extends org.hamcrest.** { *; } 18-keep class !cr_allowunused,* extends org.junit.** { *; } 19-keep @**.RunWith class * { *; } 20 21# Keep classes implementing ParameterProvider -- these will be instantiated 22# via reflection. 23-keep class !cr_allowunused,** implements org.chromium.base.test.params.ParameterProvider { 24 *; 25} 26 27# Keep all classes that are in test packages. There is no benefit in testing 28# Proguarding of test classes, but this is as close as we can get to selecting 29# all classes from the test apk. 30-keep class !cr_allowunused,**.test.** { *; } 31 32# Keep all interfaces that are mocked by Mockito. Since Mockito generates these 33# mocks at runtime, R8 doesn't know to preserve them (without these rules). 34-if class ** { 35 @org.mockito.Mock ** *; 36} 37-keep class <2> { 38 <methods>; 39} 40 41-if class ** { 42 @org.mockito.Spy ** *; 43} 44-keep class <2> { 45 <methods>; 46} 47 48-if class ** { 49 @org.mockito.Captor ** *; 50} 51-keep class <2> { 52 <methods>; 53} 54 55# This is a workaround for b/147584922 - otherwise, R8 would generate a synthetic 56# abstract method for the subsclass FeedOfflineIndicator, which Mockito would not 57# mock. 58-keep,allowobfuscation @interface org.chromium.build.annotations.MockedInTests 59-keep @org.chromium.build.annotations.MockedInTests class ** { 60 <methods>; 61} 62 63# Keep all enum members since they might be reflectively called by JUnit4 runner 64-keepclassmembers enum !cr_allowunused,** { *; } 65 66# Keep any annotation used by tests for instrumentation runner to list out 67# test annotation information 68-keepattributes *Annotation* 69 70# These are Java classes which aren't part of the Android sdk. They are 71# referenced by some test-only libraries. 72-dontwarn java.lang.ClassValue 73-dontwarn java.lang.instrument.ClassFileTransformer 74 75# We have some "library class WebView depends on program class SslCertificate" 76# warnings, and they don't affect us. 77-dontwarn android.webkit.WebView* 78