Skip to content

Commit

Permalink
[webview_flutter] Fix macOS 14+ test hangs (#7953)
Browse files Browse the repository at this point in the history
Starting in macOS 14, webview_flutter integration tests hang due to being unable to connect to the test server. Based on local experimentation, in appears that we are not able to connect when binding to the "any" address, which gives us an IP address of 0.0.0.0, but using the loopback address (which is all we should need; the point is to accept local connections from the test itself) does work.

Since our test fleet is a mixed macOS 13/14 fleet, this should fix flaky timeouts of macOS platform tests in CI, in addition to fixing local runs.

Fixes flutter/flutter#157449
  • Loading branch information
stuartmorgan authored Oct 29, 2024
1 parent 028027e commit ab404b5
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ import 'package:webview_flutter_wkwebview/webview_flutter_wkwebview.dart';
Future<void> main() async {
IntegrationTestWidgetsFlutterBinding.ensureInitialized();

final HttpServer server = await HttpServer.bind(InternetAddress.anyIPv4, 0);
final HttpServer server =
await HttpServer.bind(InternetAddress.loopbackIPv4, 0);
unawaited(server.forEach((HttpRequest request) {
if (request.uri.path == '/hello.txt') {
request.response.writeln('Hello, world.');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ import 'package:webview_flutter/src/webview_flutter_legacy.dart';
Future<void> main() async {
IntegrationTestWidgetsFlutterBinding.ensureInitialized();

final HttpServer server = await HttpServer.bind(InternetAddress.anyIPv4, 0);
final HttpServer server =
await HttpServer.bind(InternetAddress.loopbackIPv4, 0);
unawaited(server.forEach((HttpRequest request) {
if (request.uri.path == '/hello.txt') {
request.response.writeln('Hello, world.');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ const bool skipOnIosFor154676 = true;
Future<void> main() async {
IntegrationTestWidgetsFlutterBinding.ensureInitialized();

final HttpServer server = await HttpServer.bind(InternetAddress.anyIPv4, 0);
final HttpServer server =
await HttpServer.bind(InternetAddress.loopbackIPv4, 0);
unawaited(server.forEach((HttpRequest request) {
if (request.uri.path == '/hello.txt') {
request.response.writeln('Hello, world.');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ import 'package:webview_flutter_wkwebview/webview_flutter_wkwebview.dart';
Future<void> main() async {
IntegrationTestWidgetsFlutterBinding.ensureInitialized();

final HttpServer server = await HttpServer.bind(InternetAddress.anyIPv4, 0);
final HttpServer server =
await HttpServer.bind(InternetAddress.loopbackIPv4, 0);
unawaited(server.forEach((HttpRequest request) {
if (request.uri.path == '/hello.txt') {
request.response.writeln('Hello, world.');
Expand Down

0 comments on commit ab404b5

Please sign in to comment.