Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit de344710 authored by Jeff Sharkey's avatar Jeff Sharkey
Browse files

Verify `android.test.mock` under Ravenwood.

Even though developers are encouraged to use Mockito, existing tests
may still be using this old library for their mocking.

We'll circle back later to consider support for components such as
ContentProvider, Service, etc.

Clean up OWNERS.

Bug: 310268946
Test: atest android.test.mock.ravenwood.tests
Change-Id: Ie3f4ccea9cf6719d61cff277a627825868edc992
parent 3c941e1a
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -80,7 +80,7 @@ android_ravenwood_libgroup {
        "junit",
        "truth",
        "ravenwood-junit-impl",
        "android.test.mock",
        "android.test.mock.ravenwood",
    ],
}

+3 −0
Original line number Diff line number Diff line
@@ -71,6 +71,7 @@ import java.util.function.IntConsumer;
 * another Context.  Can be subclassed to modify behavior without changing
 * the original Context.
 */
@android.ravenwood.annotation.RavenwoodKeepWholeClass
public class ContextWrapper extends Context {
    @UnsupportedAppUsage
    Context mBase;
@@ -1430,6 +1431,7 @@ public class ContextWrapper extends Context {
     * @throws IllegalStateException if this method calls before {@link #attachBaseContext(Context)}
     */
    @Override
    @android.ravenwood.annotation.RavenwoodThrow
    public void registerComponentCallbacks(ComponentCallbacks callback) {
        if (mBase != null) {
            mBase.registerComponentCallbacks(callback);
@@ -1464,6 +1466,7 @@ public class ContextWrapper extends Context {
     * @throws IllegalStateException if this method calls before {@link #attachBaseContext(Context)}
     */
    @Override
    @android.ravenwood.annotation.RavenwoodThrow
    public void unregisterComponentCallbacks(ComponentCallbacks callback) {
        // It usually means the ComponentCallbacks is registered before this ContextWrapper attaches
        // to a base Context and Application is targeting prior to S-v2. We should unregister the
+2 −0
Original line number Diff line number Diff line
set noparent

jsharkey@google.com
omakoto@google.com
jaggies@google.com
+3 −1
Original line number Diff line number Diff line
@@ -134,6 +134,8 @@ class com.android.modules.utils.TypedXmlSerializer stubclass
class android.net.Uri stubclass
class android.net.UriCodec stubclass

# Context: just enough to support wrapper, no further functionality
# Just enough to support mocking, no further functionality
class android.content.Context stub
    method <init> ()V stub
class android.content.pm.PackageManager stub
    method <init> ()V stub
+1 −0
Original line number Diff line number Diff line
@@ -30,6 +30,7 @@ android.content.ClipDescription
android.content.ComponentName
android.content.ContentUris
android.content.ContentValues
android.content.ContextWrapper
android.content.Intent
android.content.IntentFilter
android.content.UriMatcher
Loading