E2E test setting and using isolate names (#23388)
Adds an integration devicelab test that runs an Android app with two custom named isolates. Tests that the isolate names are present and that it's possible to attach to just one of the isolates. Fixes flutter/flutter#22009
This commit is contained in:
committed by
GitHub
parent
b63ced55b4
commit
93573de216
@@ -0,0 +1,27 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.example.view">
|
||||
|
||||
<!-- The INTERNET permission is required for development. Specifically, flutter needs it to communicate with the running application
|
||||
to allow setting breakpoints, to provide hot reload, etc.
|
||||
-->
|
||||
<uses-permission android:name="android.permission.INTERNET"/>
|
||||
|
||||
<!-- io.flutter.app.FlutterApplication is an android.app.Application that
|
||||
calls FlutterMain.startInitialization(this); in its onCreate method.
|
||||
In most cases you can leave this as-is, but you if you want to provide
|
||||
additional functionality it is fine to subclass or reimplement
|
||||
FlutterApplication and put your custom class here. -->
|
||||
<application android:name="io.flutter.app.FlutterApplication" android:label="named_isolates">
|
||||
<activity android:name=".MainActivity"
|
||||
android:launchMode="singleTop"
|
||||
android:theme="@style/Theme.AppCompat"
|
||||
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection|fontScale|screenLayout|density"
|
||||
android:hardwareAccelerated="true"
|
||||
android:windowSoftInputMode="adjustResize">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN"/>
|
||||
<category android:name="android.intent.category.LAUNCHER"/>
|
||||
</intent-filter>
|
||||
</activity>
|
||||
</application>
|
||||
</manifest>
|
||||
@@ -0,0 +1,71 @@
|
||||
package com.example.view;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.support.design.widget.FloatingActionButton;
|
||||
import android.support.v7.app.ActionBar;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.view.View;
|
||||
import android.widget.TextView;
|
||||
import io.flutter.plugin.common.BasicMessageChannel;
|
||||
import io.flutter.plugin.common.BasicMessageChannel.MessageHandler;
|
||||
import io.flutter.plugin.common.BasicMessageChannel.Reply;
|
||||
import io.flutter.plugin.common.StringCodec;
|
||||
import io.flutter.view.FlutterMain;
|
||||
import io.flutter.view.FlutterRunArguments;
|
||||
import io.flutter.view.FlutterView;
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class MainActivity extends AppCompatActivity {
|
||||
private FlutterView firstFlutterView;
|
||||
private FlutterView secondFlutterView;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
FlutterMain.ensureInitializationComplete(getApplicationContext(), null);
|
||||
setContentView(R.layout.flutter_view_layout);
|
||||
ActionBar supportActionBar = getSupportActionBar();
|
||||
if (supportActionBar != null) {
|
||||
supportActionBar.hide();
|
||||
}
|
||||
|
||||
FlutterRunArguments firstRunArguments = new FlutterRunArguments();
|
||||
firstRunArguments.bundlePath = FlutterMain.findAppBundlePath(getApplicationContext());
|
||||
firstRunArguments.entrypoint = "first";
|
||||
firstFlutterView = findViewById(R.id.first);
|
||||
firstFlutterView.runFromBundle(firstRunArguments);
|
||||
|
||||
FlutterRunArguments secondRunArguments = new FlutterRunArguments();
|
||||
secondRunArguments.bundlePath = FlutterMain.findAppBundlePath(getApplicationContext());
|
||||
secondRunArguments.entrypoint = "second";
|
||||
secondFlutterView = findViewById(R.id.second);
|
||||
secondFlutterView.runFromBundle(secondRunArguments);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
if (firstFlutterView != null) {
|
||||
firstFlutterView.destroy();
|
||||
}
|
||||
if (secondFlutterView != null) {
|
||||
secondFlutterView.destroy();
|
||||
}
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPause() {
|
||||
super.onPause();
|
||||
firstFlutterView.onPause();
|
||||
secondFlutterView.onPause();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPostResume() {
|
||||
super.onPostResume();
|
||||
firstFlutterView.onPostResume();
|
||||
secondFlutterView.onPostResume();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
>
|
||||
|
||||
<io.flutter.view.FlutterView
|
||||
android:id="@+id/first"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
/>
|
||||
|
||||
<io.flutter.view.FlutterView
|
||||
android:id="@+id/second"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
/>
|
||||
|
||||
</LinearLayout>
|
||||
Reference in New Issue
Block a user