blob: 03133af732b565bed2e576e6330d96e764072c91 [file] [log] [blame]
# 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 !cr_allowunused,junit.** { *; }
-keep class !cr_allowunused,** extends junit.** { *; }
# Keep all junit4 and hamcrest classes and tests
-keep class !cr_allowunused,org.hamcrest.** { *; }
-keep class !cr_allowunused,org.junit.** { *; }
-keep class !cr_allowunused,* extends org.hamcrest.** { *; }
-keep class !cr_allowunused,* extends org.junit.** { *; }
-keep @**.RunWith class * { *; }
# Keep classes implementing ParameterProvider -- these will be instantiated
# via reflection.
-keep class !cr_allowunused,** implements org.chromium.base.test.params.ParameterProvider {
*;
}
# 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 !cr_allowunused,**.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 !cr_allowunused,** { *; }
# 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*