Skip to content
This repository has been archived by the owner on Feb 22, 2023. It is now read-only.

Fix test exclusion logic for nnbd plugins #3342

Merged
merged 15 commits into from
Dec 20, 2020
16 changes: 16 additions & 0 deletions .cirrus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,16 @@ task:
- flutter channel $CHANNEL
- ./script/incremental_build.sh test
- name: analyze
env:
matrix:
CHANNEL: "master"
CHANNEL: "stable"
script: ./script/incremental_build.sh analyze
- name: build_all_plugins_apk
env:
matrix:
CHANNEL: "master"
CHANNEL: "stable"
script:
# TODO(jackson): Allow web plugins once supported on stable
# https://github.com/flutter/flutter/issues/42864
Expand Down Expand Up @@ -143,6 +151,10 @@ task:
- xcrun simctl create Flutter-iPhone com.apple.CoreSimulator.SimDeviceType.iPhone-X com.apple.CoreSimulator.SimRuntime.iOS-13-3 | xargs xcrun simctl boot
matrix:
- name: build_all_plugins_ipa
env:
matrix:
CHANNEL: "master"
CHANNEL: "stable"
script:
# TODO(jackson): Allow web plugins once supported on stable
# https://github.com/flutter/flutter/issues/42864
Expand Down Expand Up @@ -196,6 +208,10 @@ task:
activate_script: pub global activate flutter_plugin_tools
matrix:
- name: build_all_plugins_app
env:
matrix:
CHANNEL: "master"
CHANNEL: "stable"
script:
- flutter channel master
- ./script/build_all_plugins_app.sh macos
Expand Down
5 changes: 4 additions & 1 deletion packages/android_intent/test/android_intent_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// @dart = 2.9

import 'package:android_intent/flag.dart';
import 'package:flutter/services.dart';
import 'package:flutter_test/flutter_test.dart';
Expand All @@ -11,7 +13,8 @@ import 'package:platform/platform.dart';

void main() {
AndroidIntent androidIntent;
late MockMethodChannel mockChannel;
MockMethodChannel mockChannel;

setUp(() {
mockChannel = MockMethodChannel();
when(mockChannel.invokeMethod<bool>('canResolveActivity', any))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

// @dart = 2.9

import 'package:flutter_test/flutter_test.dart';
import 'package:integration_test/integration_test.dart';
import 'package:flutter_plugin_android_lifecycle_example/main.dart';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
// Copyright 2019, the Chromium project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

// ignore_for_file: public_member_api_docs

import 'package:flutter/material.dart';
Expand Down
14 changes: 6 additions & 8 deletions packages/flutter_plugin_android_lifecycle/example/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,23 +1,21 @@
name: flutter_plugin_android_lifecycle_example
description: Demonstrates how to use the flutter_plugin_android_lifecycle plugin.
publish_to: 'none'

environment:
sdk: ">=2.12.0-0 <3.0.0"

dependencies:
flutter:
sdk: flutter
integration_test:
path: ../../integration_test
flutter_plugin_android_lifecycle:
path: ../

dev_dependencies:
integration_test:
path: ../../integration_test
flutter_test:
sdk: flutter
pedantic: ^1.8.0

flutter_plugin_android_lifecycle:
path: ../
environment:
sdk: ">=2.12.0-0 <3.0.0"

flutter:
uses-material-design: true
10 changes: 6 additions & 4 deletions packages/local_auth/example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,17 @@ class MyApp extends StatefulWidget {

class _MyAppState extends State<MyApp> {
final LocalAuthentication auth = LocalAuthentication();
bool _canCheckBiometrics;
List<BiometricType> _availableBiometrics;
late bool _canCheckBiometrics;
late List<BiometricType> _availableBiometrics;
String _authorized = 'Not Authorized';
bool _isAuthenticating = false;

Future<void> _checkBiometrics() async {
bool canCheckBiometrics;
late bool canCheckBiometrics;
try {
canCheckBiometrics = await auth.canCheckBiometrics;
} on PlatformException catch (e) {
canCheckBiometrics = false;
print(e);
}
if (!mounted) return;
Expand All @@ -41,10 +42,11 @@ class _MyAppState extends State<MyApp> {
}

Future<void> _getAvailableBiometrics() async {
List<BiometricType> availableBiometrics;
late List<BiometricType> availableBiometrics;
try {
availableBiometrics = await auth.getAvailableBiometrics();
} on PlatformException catch (e) {
availableBiometrics = <BiometricType>[];
print(e);
}
if (!mounted) return;
Expand Down
2 changes: 1 addition & 1 deletion packages/local_auth/example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ flutter:
uses-material-design: true

environment:
sdk: ">=2.1.0 <3.0.0"
sdk: ">=2.12.0-0 <3.0.0"
flutter: ">=1.12.13+hotfix.5 <2.0.0"
6 changes: 6 additions & 0 deletions packages/local_auth/integration_test/local_auth_test.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// @dart = 2.9

import 'package:flutter_test/flutter_test.dart';
import 'package:integration_test/integration_test.dart';

Expand Down
2 changes: 2 additions & 0 deletions packages/share/integration_test/share_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

// @dart = 2.9

import 'package:flutter_test/flutter_test.dart';
import 'package:share/share.dart';
import 'package:integration_test/integration_test.dart';
Expand Down
2 changes: 1 addition & 1 deletion packages/share/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ flutter:
dependencies:
meta: ^1.3.0-nullsafety.6
mime: ^1.0.0-nullsafety.0
test: ^1.16.0-nullsafety.13
flutter:
sdk: flutter

dev_dependencies:
test: ^1.16.0-nullsafety.13
mockito: ^4.1.3
flutter_test:
sdk: flutter
Expand Down
4 changes: 3 additions & 1 deletion packages/share/test/share_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// @dart = 2.9

import 'dart:io';
import 'dart:ui';

Expand All @@ -15,7 +17,7 @@ import 'package:flutter/services.dart';
void main() {
TestWidgetsFlutterBinding.ensureInitialized();

late MockMethodChannel mockChannel;
MockMethodChannel mockChannel;

setUp(() {
mockChannel = MockMethodChannel();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.


blasten marked this conversation as resolved.
Show resolved Hide resolved
// TODO(amirh): Remove this once flutter_driver supports null safety.
// https://github.com/flutter/flutter/issues/71379
// @dart = 2.9
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

// @dart = 2.9

import 'dart:async';
import 'dart:convert';
import 'dart:io';
Expand Down Expand Up @@ -358,12 +360,12 @@ void main() {
videoTestBase64 = base64Encode(const Utf8Encoder().convert(videoTest));
});

test('Auto media playback', () async {
testWidgets('Auto media playback', (WidgetTester tester) async {
Completer<WebViewController> controllerCompleter =
Completer<WebViewController>();
Completer<void> pageLoaded = Completer<void>();

await pumpWidget(
await tester.pumpWidget(
Directionality(
textDirection: TextDirection.ltr,
child: WebView(
Expand All @@ -390,7 +392,7 @@ void main() {
pageLoaded = Completer<void>();

// We change the key to re-create a new webview as we change the initialMediaPlaybackPolicy
await pumpWidget(
await tester.pumpWidget(
Directionality(
textDirection: TextDirection.ltr,
child: WebView(
Expand All @@ -416,13 +418,14 @@ void main() {
expect(isPaused, _webviewBool(true));
});

test('Changes to initialMediaPlaybackPolicy are ignored', () async {
testWidgets('Changes to initialMediaPlaybackPolicy are ignored',
(WidgetTester tester) async {
final Completer<WebViewController> controllerCompleter =
Completer<WebViewController>();
Completer<void> pageLoaded = Completer<void>();

final GlobalKey key = GlobalKey();
await pumpWidget(
await tester.pumpWidget(
Directionality(
textDirection: TextDirection.ltr,
child: WebView(
Expand All @@ -447,7 +450,7 @@ void main() {

pageLoaded = Completer<void>();

await pumpWidget(
await tester.pumpWidget(
Directionality(
textDirection: TextDirection.ltr,
child: WebView(
Expand All @@ -474,12 +477,13 @@ void main() {
expect(isPaused, _webviewBool(false));
});

test('Video plays inline when allowsInlineMediaPlayback is true', () async {
testWidgets('Video plays inline when allowsInlineMediaPlayback is true',
(WidgetTester tester) async {
Completer<WebViewController> controllerCompleter =
Completer<WebViewController>();
Completer<void> pageLoaded = Completer<void>();

await pumpWidget(
await tester.pumpWidget(
Directionality(
textDirection: TextDirection.ltr,
child: WebView(
Expand Down Expand Up @@ -507,7 +511,7 @@ void main() {
controllerCompleter = Completer<WebViewController>();
pageLoaded = Completer<void>();

await pumpWidget(
await tester.pumpWidget(
Directionality(
textDirection: TextDirection.ltr,
child: WebView(
Expand Down
16 changes: 8 additions & 8 deletions packages/webview_flutter/example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ class _WebViewExampleState extends State<WebViewExample> {
if (controller.hasData) {
return FloatingActionButton(
onPressed: () async {
final String url = await controller.data.currentUrl();
final String url = (await controller.data!.currentUrl())!;
// ignore: deprecated_member_use
Scaffold.of(context).showSnackBar(
SnackBar(content: Text('Favorited $url')),
Expand Down Expand Up @@ -145,25 +145,25 @@ class SampleMenu extends StatelessWidget {
onSelected: (MenuOptions value) {
switch (value) {
case MenuOptions.showUserAgent:
_onShowUserAgent(controller.data, context);
_onShowUserAgent(controller.data!, context);
break;
case MenuOptions.listCookies:
_onListCookies(controller.data, context);
_onListCookies(controller.data!, context);
break;
case MenuOptions.clearCookies:
_onClearCookies(context);
break;
case MenuOptions.addToCache:
_onAddToCache(controller.data, context);
_onAddToCache(controller.data!, context);
break;
case MenuOptions.listCache:
_onListCache(controller.data, context);
_onListCache(controller.data!, context);
break;
case MenuOptions.clearCache:
_onClearCache(controller.data, context);
_onClearCache(controller.data!, context);
break;
case MenuOptions.navigationDelegate:
_onNavigationDelegateExample(controller.data, context);
_onNavigationDelegateExample(controller.data!, context);
break;
}
},
Expand Down Expand Up @@ -299,7 +299,7 @@ class NavigationControls extends StatelessWidget {
(BuildContext context, AsyncSnapshot<WebViewController> snapshot) {
final bool webViewReady =
snapshot.connectionState == ConnectionState.done;
final WebViewController controller = snapshot.data;
final WebViewController controller = snapshot.data!;
return Row(
children: <Widget>[
IconButton(
Expand Down
2 changes: 1 addition & 1 deletion packages/webview_flutter/example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: webview_flutter_example
description: Demonstrates how to use the webview_flutter plugin.

environment:
sdk: ">=2.0.0-dev.68.0 <3.0.0"
sdk: ">=2.12.0-0 <3.0.0"

dependencies:
flutter:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

// @dart = 2.9

import 'dart:async';
import 'dart:convert';
import 'dart:io';
Expand Down
2 changes: 1 addition & 1 deletion script/build_all_plugins_app.sh
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ readonly EXCLUDED=$(IFS=, ; echo "${EXCLUDED_PLUGINS_LIST[*]}")

ALL_EXCLUDED=($EXCLUDED)
# Exclude nnbd plugins from stable.
if [[ "$CHANNEL" -eq "stable" ]]; then
if [ "$CHANNEL" == "stable" ]; then
ALL_EXCLUDED=("$EXCLUDED,$EXCLUDED_PLUGINS_FROM_STABLE")
fi

Expand Down
2 changes: 1 addition & 1 deletion script/incremental_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ fi
# Plugins that are excluded from this task.
ALL_EXCLUDED=("")
# Exclude nnbd plugins from stable.
if [[ "$CHANNEL" -eq "stable" ]]; then
if [ "$CHANNEL" == "stable" ]; then
ALL_EXCLUDED=($EXCLUDED_PLUGINS_FROM_STABLE)
echo "Excluding the following plugins: $ALL_EXCLUDED"
fi
Expand Down