diff --git a/dev/integration_tests/web/lib/framework_stack_trace.dart b/dev/integration_tests/web/lib/framework_stack_trace.dart index d68eb46416..cc32638807 100644 --- a/dev/integration_tests/web/lib/framework_stack_trace.dart +++ b/dev/integration_tests/web/lib/framework_stack_trace.dart @@ -35,14 +35,14 @@ Future main() async { output.writeln('--- TEST FAILED ---'); } - print(output); - web.window.fetch( + await web.window.fetch( '/test-result'.toJS, web.RequestInit( method: 'POST', body: '$output'.toJS, ) - ); + ).toDart; + print(output); } bool _errorMessageFormattedCorrectly(String errorMessage) { diff --git a/dev/integration_tests/web/lib/sound_mode.dart b/dev/integration_tests/web/lib/sound_mode.dart index ffd50f8558..77978666b1 100644 --- a/dev/integration_tests/web/lib/sound_mode.dart +++ b/dev/integration_tests/web/lib/sound_mode.dart @@ -9,7 +9,7 @@ import 'dart:js_interop'; import 'package:web/web.dart' as web; // Verify that web applications can be run in sound mode. -void main() { +void main() async { const bool isWeak = [] is List; String output; if (isWeak) { @@ -17,12 +17,12 @@ void main() { } else { output = '--- TEST SUCCEEDED ---'; } - print(output); - web.window.fetch( + await web.window.fetch( '/test-result'.toJS, web.RequestInit( method: 'POST', body: output.toJS, ) - ); + ).toDart; + print(output); } diff --git a/dev/integration_tests/web/lib/stack_trace.dart b/dev/integration_tests/web/lib/stack_trace.dart index a7eec7d4ac..e1428ecd4a 100644 --- a/dev/integration_tests/web/lib/stack_trace.dart +++ b/dev/integration_tests/web/lib/stack_trace.dart @@ -66,7 +66,7 @@ const List expectedDebugStackFrames = [ /// Tests that we do not crash while parsing Web stack traces. /// /// This test is run in debug, profile, and release modes. -void main() { +void main() async { final StringBuffer output = StringBuffer(); try { try { @@ -97,14 +97,14 @@ void main() { output.writeln(unexpectedStackTrace); output.writeln('--- TEST FAILED ---'); } - print(output); - web.window.fetch( + await web.window.fetch( '/test-result'.toJS, web.RequestInit( method: 'POST', body: '$output'.toJS, ) - ); + ).toDart; + print(output); } @noInline diff --git a/dev/integration_tests/web/lib/web_define_loading.dart b/dev/integration_tests/web/lib/web_define_loading.dart index 89c332f47f..39056d6000 100644 --- a/dev/integration_tests/web/lib/web_define_loading.dart +++ b/dev/integration_tests/web/lib/web_define_loading.dart @@ -12,17 +12,16 @@ Future main() async { String.fromEnvironment('test.valueB'); if (combined == 'Example,AValue') { output.write('--- TEST SUCCEEDED ---'); - print('--- TEST SUCCEEDED ---'); } else { output.write('--- TEST FAILED ---'); - print('--- TEST FAILED ---'); } - web.window.fetch( + await web.window.fetch( '/test-result'.toJS, web.RequestInit( method: 'POST', body: '$output'.toJS, ) - ); + ).toDart; + print(output); } diff --git a/dev/integration_tests/web/lib/web_resources_cdn_test.dart b/dev/integration_tests/web/lib/web_resources_cdn_test.dart index 23c5de73e6..ee3af8daa6 100644 --- a/dev/integration_tests/web/lib/web_resources_cdn_test.dart +++ b/dev/integration_tests/web/lib/web_resources_cdn_test.dart @@ -6,12 +6,19 @@ import 'dart:js_interop'; import 'package:web/web.dart' as web; -// Attempt to load CanvasKit resources hosted on gstatic. Future main() async { + if (await testFetchResources()) { + print('--- TEST SUCCEEDED ---'); + } else { + print('--- TEST FAILED ---'); + } +} + +// Attempt to load CanvasKit resources hosted on gstatic. +Future testFetchResources() async { const String engineVersion = String.fromEnvironment('TEST_FLUTTER_ENGINE_VERSION'); if (engineVersion.isEmpty) { - print('--- TEST FAILED ---'); - return; + return false; } try { final web.Response response = await web.window.fetch( @@ -20,14 +27,12 @@ Future main() async { method: 'GET', ), ).toDart; - if (response.ok) { - print('--- TEST SUCCEEDED ---'); - } else { - print('--- TEST FAILED ---'); + if (!response.ok) { + return false; } } catch (err) { print(err); - print('--- TEST FAILED ---'); + return false; } try { final web.Response response = await web.window.fetch( @@ -36,13 +41,12 @@ Future main() async { method: 'GET', ) ).toDart; - if (response.ok) { - print('--- TEST SUCCEEDED ---'); - } else { - print('--- TEST FAILED ---'); + if (!response.ok) { + return false; } } catch (err) { print(err); - print('--- TEST FAILED ---'); + return false; } + return true; }