Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 0b852a2

Browse files
committed
better
1 parent d2f54f0 commit 0b852a2

18 files changed

+29
-173
lines changed

testing/scenario_app/android/BUILD.gn

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,7 @@ import("//flutter/testing/rules/android.gni")
77
_android_sources = [
88
"app/build.gradle",
99
"app/src/androidTest/java/dev/flutter/TestRunner.java",
10-
"app/src/androidTest/java/dev/flutter/scenarios/EngineLaunchE2ETest.java",
1110
"app/src/androidTest/java/dev/flutter/scenarios/ExampleInstrumentedTest.java",
12-
"app/src/androidTest/java/dev/flutter/scenariosui/ArgumentAwareIntent.java",
1311
"app/src/androidTest/java/dev/flutter/scenariosui/DrawSolidBlueScreenTest.java",
1412
"app/src/androidTest/java/dev/flutter/scenariosui/ExternalTextureTests.java",
1513
"app/src/androidTest/java/dev/flutter/scenariosui/GetBitmapTests.java",

testing/scenario_app/android/app/src/androidTest/java/dev/flutter/TestRunner.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,21 @@
88
import androidx.annotation.Nullable;
99
import androidx.test.runner.AndroidJUnitRunner;
1010
import dev.flutter.scenariosui.ScreenshotUtil;
11+
import io.flutter.FlutterInjector;
1112

1213
public class TestRunner extends AndroidJUnitRunner {
1314
@Override
1415
public void onCreate(@Nullable Bundle arguments) {
16+
String[] engineArguments = null;
17+
if ("true".equals(arguments.getString("enable-impeller"))) {
18+
// Set up the global settings object so that Impeller is enabled for all tests.
19+
engineArguments = new String[] {"--enable-impeller=true"};
20+
}
21+
// For consistency, just always initilaize FlutterJNI etc.
22+
FlutterInjector.instance().flutterLoader().startInitialization(getTargetContext());
23+
FlutterInjector.instance()
24+
.flutterLoader()
25+
.ensureInitializationComplete(getTargetContext(), engineArguments);
1526
ScreenshotUtil.onCreate();
1627
super.onCreate(arguments);
1728
}

testing/scenario_app/android/app/src/androidTest/java/dev/flutter/scenarios/EngineLaunchE2ETest.java

Lines changed: 0 additions & 83 deletions
This file was deleted.

testing/scenario_app/android/app/src/androidTest/java/dev/flutter/scenariosui/ArgumentAwareIntent.java

Lines changed: 0 additions & 48 deletions
This file was deleted.

testing/scenario_app/android/app/src/androidTest/java/dev/flutter/scenariosui/DrawSolidBlueScreenTest.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,9 @@ public final class DrawSolidBlueScreenTest {
1818
new ActivityTestRule<>(
1919
PlatformViewsActivity.class, /*initialTouchMode=*/ false, /*launchActivity=*/ false);
2020

21-
@Rule @NonNull public ArgumentAwareIntent intentRule = new ArgumentAwareIntent();
22-
2321
@Test
2422
public void test() throws Exception {
25-
Intent intent = intentRule.getIntent();
23+
Intent intent = new Intent(Intent.ACTION_MAIN);
2624
intent.putExtra("scenario_name", "solid_blue");
2725
ScreenshotUtil.capture(activityRule.launchActivity(intent), "DrawSolidBlueScreenTest");
2826
}

testing/scenario_app/android/app/src/androidTest/java/dev/flutter/scenariosui/ExternalTextureTests.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,9 @@ public class ExternalTextureTests {
3333
/*initialTouchMode=*/ false,
3434
/*launchActivity=*/ false);
3535

36-
@Rule @NonNull public ArgumentAwareIntent intentRule = new ArgumentAwareIntent();
37-
3836
@Before
3937
public void setUp() {
40-
intent = intentRule.getIntent();
38+
intent = new Intent(Intent.ACTION_MAIN);
4139
}
4240

4341
@Test

testing/scenario_app/android/app/src/androidTest/java/dev/flutter/scenariosui/GetBitmapTests.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,9 @@ public class GetBitmapTests {
2525
new ActivityTestRule<>(
2626
GetBitmapActivity.class, /*initialTouchMode=*/ false, /*launchActivity=*/ false);
2727

28-
@Rule @NonNull public ArgumentAwareIntent intentRule = new ArgumentAwareIntent();
29-
3028
@Test
3129
public void getBitmap() throws Exception {
32-
Intent intent = intentRule.getIntent();
30+
Intent intent = new Intent(Intent.ACTION_MAIN);
3331
intent.putExtra("scenario_name", "get_bitmap");
3432
GetBitmapActivity activity = activityRule.launchActivity(intent);
3533
Bitmap bitmap = activity.getBitmap();

testing/scenario_app/android/app/src/androidTest/java/dev/flutter/scenariosui/MemoryLeakTests.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,10 @@ public class MemoryLeakTests {
2323
new ActivityTestRule<>(
2424
PlatformViewsActivity.class, /*initialTouchMode=*/ false, /*launchActivity=*/ false);
2525

26-
@Rule @NonNull public ArgumentAwareIntent intentRule = new ArgumentAwareIntent();
27-
2826
@Test
2927
@FailTestOnLeak
3028
public void platformViewHybridComposition_launchActivityFinishAndLaunchAgain() throws Exception {
31-
Intent intent = intentRule.getIntent();
29+
Intent intent = new Intent(Intent.ACTION_MAIN);
3230
intent.putExtra("scenario_name", "platform_view");
3331
intent.putExtra("use_android_view", true);
3432
intent.putExtra("view_type", PlatformViewsActivity.TEXT_VIEW_PV);

testing/scenario_app/android/app/src/androidTest/java/dev/flutter/scenariosui/PlatformTextureUiTests.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
@LargeTest
2121
public class PlatformTextureUiTests {
2222
Intent intent;
23-
@Rule @NonNull public ArgumentAwareIntent intentRule = new ArgumentAwareIntent();
2423

2524
@Rule @NonNull
2625
public ActivityTestRule<PlatformViewsActivity> activityRule =
@@ -33,7 +32,7 @@ private static String goldName(String suffix) {
3332

3433
@Before
3534
public void setUp() {
36-
intent = intentRule.getIntent();
35+
intent = new Intent(Intent.ACTION_MAIN);
3736
// Render a texture.
3837
intent.putExtra("use_android_view", false);
3938
intent.putExtra("view_type", PlatformViewsActivity.TEXT_VIEW_PV);

testing/scenario_app/android/app/src/androidTest/java/dev/flutter/scenariosui/PlatformViewUiTests.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
@LargeTest
2121
public class PlatformViewUiTests {
2222
Intent intent;
23-
@Rule @NonNull public ArgumentAwareIntent intentRule = new ArgumentAwareIntent();
2423

2524
@Rule @NonNull
2625
public ActivityTestRule<PlatformViewsActivity> activityRule =
@@ -33,7 +32,7 @@ private static String goldName(String suffix) {
3332

3433
@Before
3534
public void setUp() {
36-
intent = intentRule.getIntent();
35+
intent = new Intent(Intent.ACTION_MAIN);
3736
// Render a native android view.
3837
intent.putExtra("use_android_view", true);
3938
intent.putExtra("view_type", PlatformViewsActivity.TEXT_VIEW_PV);

0 commit comments

Comments
 (0)