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

Commit f084a7a4 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Switch to inline mockito for a bunch of tests"

parents b331d1f1 1fc931a3
Loading
Loading
Loading
Loading
+7 −1
Original line number Original line Diff line number Diff line
@@ -35,12 +35,18 @@ LOCAL_SRC_FILES := $(call all-java-files-under, src) \
LOCAL_STATIC_JAVA_LIBRARIES := \
LOCAL_STATIC_JAVA_LIBRARIES := \
    metrics-helper-lib \
    metrics-helper-lib \
    android-support-test \
    android-support-test \
    mockito-target-minus-junit4 \
    mockito-target-inline-minus-junit4 \
    SystemUI-proto \
    SystemUI-proto \
    SystemUI-tags \
    SystemUI-tags \
    testables \
    testables \
    truth-prebuilt \
    truth-prebuilt \


LOCAL_MULTILIB := both

LOCAL_JNI_SHARED_LIBRARIES := \
    libdexmakerjvmtiagent \
    libmultiplejvmtiagentsinterferenceagent

LOCAL_JAVA_LIBRARIES := android.test.runner telephony-common
LOCAL_JAVA_LIBRARIES := android.test.runner telephony-common


# sign this with platform cert, so this test is allowed to inject key events into
# sign this with platform cert, so this test is allowed to inject key events into
+1 −1
Original line number Original line Diff line number Diff line
@@ -19,7 +19,7 @@


    <uses-permission android:name="android.permission.READ_FRAME_BUFFER" />
    <uses-permission android:name="android.permission.READ_FRAME_BUFFER" />


    <application>
    <application android:debuggable="true">
        <uses-library android:name="android.test.runner" />
        <uses-library android:name="android.test.runner" />
    </application>
    </application>


+8 −1
Original line number Original line Diff line number Diff line
@@ -56,12 +56,19 @@ LOCAL_STATIC_ANDROID_LIBRARIES := \
LOCAL_STATIC_JAVA_LIBRARIES := \
LOCAL_STATIC_JAVA_LIBRARIES := \
    metrics-helper-lib \
    metrics-helper-lib \
    android-support-test \
    android-support-test \
    mockito-target-minus-junit4 \
    mockito-target-inline-minus-junit4 \
    SystemUI-proto \
    SystemUI-proto \
    SystemUI-tags \
    SystemUI-tags \
    testables \
    testables \
    truth-prebuilt \
    truth-prebuilt \


LOCAL_MULTILIB := both

LOCAL_JNI_SHARED_LIBRARIES := \
    libdexmakerjvmtiagent \
    libmultiplejvmtiagentsinterferenceagent


LOCAL_JAVA_LIBRARIES := \
LOCAL_JAVA_LIBRARIES := \
    android.test.runner \
    android.test.runner \
    telephony-common \
    telephony-common \
+2 −1
Original line number Original line Diff line number Diff line
@@ -48,8 +48,9 @@
    <uses-permission android:name="android.permission.REAL_GET_TASKS" />
    <uses-permission android:name="android.permission.REAL_GET_TASKS" />
    <uses-permission android:name="android.permission.INTERNAL_SYSTEM_WINDOW" />
    <uses-permission android:name="android.permission.INTERNAL_SYSTEM_WINDOW" />
    <uses-permission android:name="android.permission.NETWORK_SETTINGS" />
    <uses-permission android:name="android.permission.NETWORK_SETTINGS" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />


    <application>
    <application android:debuggable="true">
        <uses-library android:name="android.test.runner" />
        <uses-library android:name="android.test.runner" />
        <activity android:name="com.android.systemui.screenshot.ScreenshotStubActivity" />
        <activity android:name="com.android.systemui.screenshot.ScreenshotStubActivity" />


+8 −3
Original line number Original line Diff line number Diff line
@@ -27,8 +27,14 @@ import com.android.systemui.qs.tileimpl.SlashImageView;
import org.junit.Test;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runner.RunWith;


import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.assertTrue;
import static org.mockito.ArgumentMatchers.anyInt;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;




@SmallTest
@SmallTest
@@ -80,13 +86,12 @@ public class SlashImageViewTest extends SysuiTestCase {
    public void testSetImageDrawableUsesDrawableLevel() {
    public void testSetImageDrawableUsesDrawableLevel() {
        SlashImageView iv = new SlashImageView(mContext);
        SlashImageView iv = new SlashImageView(mContext);
        Drawable mockDrawable = mock(Drawable.class);
        Drawable mockDrawable = mock(Drawable.class);
        mockDrawable.setLevel(2);
        when(mockDrawable.getLevel()).thenReturn(2);
        assertTrue(mockDrawable.getLevel() == 2);


        iv.setImageDrawable(mockDrawable);
        iv.setImageDrawable(mockDrawable);


        // Make sure setting the drawable didn't reset its level to 0
        // Make sure setting the drawable didn't reset its level to 0
        assertTrue(mockDrawable.getLevel() == 2);
        verify(mockDrawable).setLevel(eq(2));
    }
    }


    // Expose getSlashDrawable
    // Expose getSlashDrawable
Loading