Unverified Commit 6d18d31b authored by Michael Klimushyn's avatar Michael Klimushyn Committed by GitHub

Fix abstract_method_smoke_test flakiness (#42454)

The flake appears to be coming from the Google Maps plugin. This test
just needs a platform view plugin without the interface method
implemented in general, not Maps specifically. Update it here to avoid
the issue in Maps until that's fixed.

Create a very simple platform view implementation that exercises this
potential bug in order to create a minimal test case with less risk of
causing second order issues like depending on any kind of full package
would cause.
parent eede7929
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.abstract_method_smoke_test">
<!-- TODO(https://github.com/flutter/flutter/issues/42349): Remove this permission once this issue is fixed. -->
<uses-permission android:name="android.permission.WAKE_LOCK"/>
<!-- 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
......@@ -10,9 +8,6 @@
<application
android:name="io.flutter.app.FlutterApplication"
android:label="abstract_method_smoke_test">
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="YOUR KEY HERE"/>
<activity
android:name=".MainActivity"
android:launchMode="singleTop"
......
package com.example.abstract_method_smoke_test
import android.content.Context
import android.graphics.Color
import android.os.Bundle
import android.view.View
import android.view.inputmethod.InputMethodManager
import io.flutter.app.FlutterActivity
import io.flutter.plugin.common.MethodChannel;
import io.flutter.plugin.common.MethodChannel.MethodCallHandler;
import io.flutter.plugin.common.MethodChannel
import io.flutter.plugin.common.StandardMessageCodec
import io.flutter.plugin.platform.PlatformView
import io.flutter.plugin.platform.PlatformViewFactory
import io.flutter.plugins.GeneratedPluginRegistrant
class MainActivity: FlutterActivity() {
class MainActivity : FlutterActivity() {
class SimplePlatformView(context: Context) : PlatformView {
private val view: View = View(context)
init {
view.setBackgroundColor(Color.CYAN)
}
override fun dispose() {}
override fun getView(): View {
return view
}
}
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
GeneratedPluginRegistrant.registerWith(this)
registrarFor("com.example.abstract_method_smoke_test")
.platformViewRegistry()
.registerViewFactory("simple", object : PlatformViewFactory(StandardMessageCodec.INSTANCE) {
override fun create(context: Context?, viewId: Int, args: Any?): PlatformView {
return SimplePlatformView(this@MainActivity)
}
})
// Triggers the Android keyboard, which causes the resize of the Flutter view.
// We need to wait for the app to complete.
MethodChannel(getFlutterView(), "com.example.abstract_method_smoke_test")
.setMethodCallHandler({ call, result ->
MethodChannel(flutterView, "com.example.abstract_method_smoke_test")
.setMethodCallHandler { _, result ->
toggleInput()
result.success(null)
})
}
}
override fun onPause() {
......@@ -28,7 +54,7 @@ class MainActivity: FlutterActivity() {
super.onPause()
}
fun toggleInput() {
private fun toggleInput() {
val imm = getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager
imm.toggleSoftInput(InputMethodManager.SHOW_IMPLICIT, 0)
}
......
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:google_maps_flutter/google_maps_flutter.dart';
Future<void> main() async {
WidgetsFlutterBinding.ensureInitialized();
......@@ -54,11 +53,7 @@ class SecondPage extends StatelessWidget {
body: Column(
children: const <Widget>[
Expanded(
child: GoogleMap(
initialCameraPosition: CameraPosition(
target: LatLng(0, 0)
),
),
child: AndroidView(viewType: 'simple')
),
],
),
......
......@@ -9,39 +9,13 @@ environment:
dependencies:
flutter:
sdk: flutter
google_maps_flutter: 0.5.21+7
collection: 1.14.11 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
meta: 1.1.7 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
typed_data: 1.1.6 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
vector_math: 2.0.8 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
dev_dependencies:
flutter_test:
sdk: flutter
archive: 2.0.10 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
args: 1.5.2 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
async: 2.3.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
boolean_selector: 1.0.5 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
charcode: 1.1.2 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
convert: 2.1.1 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
crypto: 2.1.3 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
image: 2.1.4 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
matcher: 0.12.5 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
path: 1.6.4 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
pedantic: 1.8.0+1 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
petitparser: 2.4.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
quiver: 2.0.5 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
source_span: 1.5.5 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
stack_trace: 1.9.3 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
stream_channel: 2.0.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
string_scanner: 1.0.5 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
term_glyph: 1.1.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
test_api: 0.2.5 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
xml: 3.5.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
flutter:
uses-material-design: true
# PUBSPEC CHECKSUM: 2334
# PUBSPEC CHECKSUM: 1d3d
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment