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

Prepare for fix to https://github.com/flutter/flutter/issues/109339. #6278

Merged
merged 3 commits into from
Aug 17, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,14 @@ void main() {
test('Cannot be implemented with `implements`', () {
expect(() {
CameraPlatform.instance = ImplementsCameraPlatform();
}, throwsNoSuchMethodError);
// In versions of `package:plugin_platform_interface` prior to fixing
// https://github.com/flutter/flutter/issues/109339, an attempt to
// implement a platform interface using `implements` would sometimes
// throw a `NoSuchMethodError` and other times throw an
// `AssertionError`. After the issue is fixed, an `AssertionError` will
// always be thrown. For the purpose of this test, we don't really care
// what exception is thrown, so just allow any exception.
}, throwsA(anything));
});

test('Can be extended', () {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,14 @@ void main() {
expect(() {
GoogleMapsFlutterPlatform.instance =
ImplementsGoogleMapsFlutterPlatform();
}, throwsA(isInstanceOf<AssertionError>()));
// In versions of `package:plugin_platform_interface` prior to fixing
// https://github.com/flutter/flutter/issues/109339, an attempt to
// implement a platform interface using `implements` would sometimes
// throw a `NoSuchMethodError` and other times throw an
// `AssertionError`. After the issue is fixed, an `AssertionError` will
// always be thrown. For the purpose of this test, we don't really care
// what exception is thrown, so just allow any exception.
}, throwsA(anything));
});

test('Can be mocked with `implements`', () {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,14 @@ void main() {
test('Cannot be implemented with `implements`', () {
expect(() {
GoogleSignInPlatform.instance = ImplementsGoogleSignInPlatform();
}, throwsA(isA<Error>()));
// In versions of `package:plugin_platform_interface` prior to fixing
// https://github.com/flutter/flutter/issues/109339, an attempt to
// implement a platform interface using `implements` would sometimes
// throw a `NoSuchMethodError` and other times throw an
// `AssertionError`. After the issue is fixed, an `AssertionError` will
// always be thrown. For the purpose of this test, we don't really care
// what exception is thrown, so just allow any exception.
}, throwsA(anything));
});

test('Can be extended', () {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,14 @@ void main() {
test('Cannot be implemented with `implements`', () {
expect(() {
InAppPurchasePlatform.instance = ImplementsInAppPurchasePlatform();
}, throwsNoSuchMethodError);
// In versions of `package:plugin_platform_interface` prior to fixing
// https://github.com/flutter/flutter/issues/109339, an attempt to
// implement a platform interface using `implements` would sometimes
// throw a `NoSuchMethodError` and other times throw an
// `AssertionError`. After the issue is fixed, an `AssertionError` will
// always be thrown. For the purpose of this test, we don't really care
// what exception is thrown, so just allow any exception.
}, throwsA(anything));
});

test('Can be extended', () {
Expand Down Expand Up @@ -126,7 +133,7 @@ void main() {
InAppPurchasePlatformAddition.instance = null;
});

test('Cannot be implemented with `implements`', () {
test('Default instance is null', () {
expect(InAppPurchasePlatformAddition.instance, isNull);
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,14 @@ void main() {
test('Cannot be implemented with `implements`', () {
expect(() {
QuickActionsPlatform.instance = ImplementsQuickActionsPlatform();
}, throwsNoSuchMethodError);
// In versions of `package:plugin_platform_interface` prior to fixing
// https://github.com/flutter/flutter/issues/109339, an attempt to
// implement a platform interface using `implements` would sometimes
// throw a `NoSuchMethodError` and other times throw an
// `AssertionError`. After the issue is fixed, an `AssertionError` will
// always be thrown. For the purpose of this test, we don't really care
// what exception is thrown, so just allow any exception.
}, throwsA(anything));
});

test('Can be extended', () {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,14 @@ void main() {
test('Cannot be implemented with `implements`', () {
expect(() {
UrlLauncherPlatform.instance = ImplementsUrlLauncherPlatform();
}, throwsA(isInstanceOf<AssertionError>()));
// In versions of `package:plugin_platform_interface` prior to fixing
// https://github.com/flutter/flutter/issues/109339, an attempt to
// implement a platform interface using `implements` would sometimes
// throw a `NoSuchMethodError` and other times throw an
// `AssertionError`. After the issue is fixed, an `AssertionError` will
// always be thrown. For the purpose of this test, we don't really care
// what exception is thrown, so just allow any exception.
}, throwsA(anything));
});

test('Can be mocked with `implements`', () {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,14 @@ void main() {

expect(() {
PlatformNavigationDelegate(params);
}, throwsNoSuchMethodError);
// In versions of `package:plugin_platform_interface` prior to fixing
// https://github.com/flutter/flutter/issues/109339, an attempt to
// implement a platform interface using `implements` would sometimes throw
// a `NoSuchMethodError` and other times throw an `AssertionError`. After
// the issue is fixed, an `AssertionError` will always be thrown. For the
// purpose of this test, we don't really care what exception is thrown, so
// just allow any exception.
}, throwsA(anything));
});

test('Can be extended', () {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,14 @@ void main() {
expect(() {
PlatformWebViewController(
const PlatformWebViewControllerCreationParams());
}, throwsNoSuchMethodError);
// In versions of `package:plugin_platform_interface` prior to fixing
// https://github.com/flutter/flutter/issues/109339, an attempt to
// implement a platform interface using `implements` would sometimes throw
// a `NoSuchMethodError` and other times throw an `AssertionError`. After
// the issue is fixed, an `AssertionError` will always be thrown. For the
// purpose of this test, we don't really care what exception is thrown, so
// just allow any exception.
}, throwsA(anything));
});

test('Can be extended', () {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,14 @@ void main() {

expect(() {
PlatformWebViewWidget(params);
}, throwsNoSuchMethodError);
// In versions of `package:plugin_platform_interface` prior to fixing
// https://github.com/flutter/flutter/issues/109339, an attempt to
// implement a platform interface using `implements` would sometimes throw
// a `NoSuchMethodError` and other times throw an `AssertionError`. After
// the issue is fixed, an `AssertionError` will always be thrown. For the
// purpose of this test, we don't really care what exception is thrown, so
// just allow any exception.
}, throwsA(anything));
});

test('Can be extended', () {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,14 @@ void main() {
test('Cannot be implemented with `implements`', () {
expect(() {
WebViewPlatform.instance = ImplementsWebViewPlatform();
}, throwsNoSuchMethodError);
// In versions of `package:plugin_platform_interface` prior to fixing
// https://github.com/flutter/flutter/issues/109339, an attempt to
// implement a platform interface using `implements` would sometimes throw
// a `NoSuchMethodError` and other times throw an `AssertionError`. After
// the issue is fixed, an `AssertionError` will always be thrown. For the
// purpose of this test, we don't really care what exception is thrown, so
// just allow any exception.
}, throwsA(anything));
});

test('Can be extended', () {
Expand Down