-
Notifications
You must be signed in to change notification settings - Fork 6k
Eliminate android test log spam #44982
Changes from all commits
69dfefb
5925883
b3ada37
1f2bc15
0d3b2b0
9f2b588
86eb955
8a482fc
fb7272d
90f6ce0
d32d874
7c65622
3ba9a98
488c707
78d6b79
0c14a63
7eb6b01
e58f957
fb86f96
e987bc2
86d08f5
81cd095
6142bf2
1ea2739
e281c25
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -283,6 +283,9 @@ public void itReturnsExclusiveAppComponent() { | |
| assertEquals(fragment.getExclusiveAppComponent(), delegate); | ||
| } | ||
|
|
||
| @SuppressWarnings("deprecation") | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same. |
||
| // Robolectric.setupActivity | ||
| // TODO(reidbaker): https://github.com/flutter/flutter/issues/133151 | ||
| @Test | ||
| public void itDelegatesOnBackPressedAutomaticallyWhenEnabled() { | ||
| // We need to mock FlutterJNI to avoid triggering native code. | ||
|
|
@@ -317,6 +320,9 @@ public void itDelegatesOnBackPressedAutomaticallyWhenEnabled() { | |
| verify(mockDelegate, times(1)).onBackPressed(); | ||
| } | ||
|
|
||
| @SuppressWarnings("deprecation") | ||
| // Robolectric.setupActivity | ||
| // TODO(reidbaker): https://github.com/flutter/flutter/issues/133151 | ||
| @Test | ||
| public void itHandlesPopSystemNavigationAutomaticallyWhenEnabled() { | ||
| // We need to mock FlutterJNI to avoid triggering native code. | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,7 @@ | ||
| package io.flutter.embedding.android; | ||
|
|
||
| import static org.robolectric.util.reflector.Reflector.reflector; | ||
|
|
||
| import android.content.res.Resources; | ||
| import android.graphics.Color; | ||
| import android.graphics.drawable.ColorDrawable; | ||
|
|
@@ -8,22 +10,34 @@ | |
| import org.robolectric.annotation.Implementation; | ||
| import org.robolectric.annotation.Implements; | ||
| import org.robolectric.annotation.RealObject; | ||
| import org.robolectric.shadow.api.Shadow; | ||
| import org.robolectric.shadows.ShadowResources; | ||
| import org.robolectric.util.reflector.Direct; | ||
| import org.robolectric.util.reflector.ForType; | ||
|
|
||
| @SuppressWarnings("deprecation") | ||
| // getDrawableInt | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do you mean |
||
| @Implements(Resources.class) | ||
| public class SplashShadowResources extends ShadowResources { | ||
| @RealObject private Resources resources; | ||
|
|
||
| public static final int SPLASH_DRAWABLE_ID = 191919; | ||
| public static final int THEMED_SPLASH_DRAWABLE_ID = 212121; | ||
|
|
||
| @ForType(Resources.class) | ||
| interface ResourcesReflector { | ||
| @Direct | ||
| Drawable getDrawable(int id, Resources.Theme theme); | ||
|
|
||
| @Direct | ||
| Drawable getDrawable(int id); | ||
| } | ||
|
|
||
| @Implementation | ||
| protected Drawable getDrawable(int id) { | ||
| if (id == SPLASH_DRAWABLE_ID) { | ||
| return new ColorDrawable(Color.BLUE); | ||
| } | ||
| return Shadow.directlyOn(resources, Resources.class).getDrawable(id); | ||
| return reflector(Resources.class, resources).getDrawable(id); | ||
| } | ||
|
|
||
| @Implementation | ||
|
|
@@ -37,6 +51,6 @@ protected Drawable getDrawable(int id, @Nullable Resources.Theme theme) { | |
| } | ||
| return new ColorDrawable(Color.GRAY); | ||
| } | ||
| return Shadow.directlyOn(resources, Resources.class).getDrawable(id, theme); | ||
| return reflector(Resources.class, resources).getDrawable(id, theme); | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -32,6 +32,8 @@ private static BinaryMessenger.BinaryReply sendToBinaryMessageHandler( | |
| return reply; | ||
| } | ||
|
|
||
| @SuppressWarnings("deprecation") | ||
| // setMessageHandler is deprecated. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is there an issue we can reference for this? If we have a test verifying that our own code is calling our own deprecated method, it seems like there's a problem somewhere. |
||
| @Test | ||
| public void respondsToGetKeyboardStateChannelMessage() { | ||
| ArgumentCaptor<BinaryMessenger.BinaryMessageHandler> binaryMessageHandlerCaptor = | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -23,6 +23,8 @@ public class SettingsChannelTest { | |
| @Test | ||
| @TargetApi(33) | ||
| @Config(sdk = 33) | ||
| @SuppressWarnings("deprecation") | ||
| // DartExecutor.send is deprecated. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we reference an issue for all of these deprecated send calls (here and in other files)? |
||
| public void setDisplayMetricsDoesNothingOnAPILevel33() { | ||
| final DartExecutor executor = mock(DartExecutor.class); | ||
| executor.onAttachedToJNI(); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider extracting a
Activity GetMockActivity()or similar that returnsRobolectric.setupActivity(Activity.class)so you aren't suppressing the entire method.