File tree Expand file tree Collapse file tree 5 files changed +31
-28
lines changed
dev/integration_tests/web/lib Expand file tree Collapse file tree 5 files changed +31
-28
lines changed Original file line number Diff line number Diff line change @@ -35,14 +35,14 @@ Future<void> main() async {
3535 output.writeln ('--- TEST FAILED ---' );
3636 }
3737
38- print (output);
39- web.window.fetch (
38+ await web.window.fetch (
4039 '/test-result' .toJS,
4140 web.RequestInit (
4241 method: 'POST' ,
4342 body: '$output ' .toJS,
4443 )
45- );
44+ ).toDart;
45+ print (output);
4646}
4747
4848bool _errorMessageFormattedCorrectly (String errorMessage) {
Original file line number Diff line number Diff line change @@ -9,20 +9,20 @@ import 'dart:js_interop';
99import 'package:web/web.dart' as web;
1010
1111// Verify that web applications can be run in sound mode.
12- void main () {
12+ void main () async {
1313 const bool isWeak = < int ? > [] is List <int >;
1414 String output;
1515 if (isWeak) {
1616 output = '--- TEST FAILED ---' ;
1717 } else {
1818 output = '--- TEST SUCCEEDED ---' ;
1919 }
20- print (output);
21- web.window.fetch (
20+ await web.window.fetch (
2221 '/test-result' .toJS,
2322 web.RequestInit (
2423 method: 'POST' ,
2524 body: output.toJS,
2625 )
27- );
26+ ).toDart;
27+ print (output);
2828}
Original file line number Diff line number Diff line change @@ -66,7 +66,7 @@ const List<StackFrame> expectedDebugStackFrames = <StackFrame>[
6666/// Tests that we do not crash while parsing Web stack traces.
6767///
6868/// This test is run in debug, profile, and release modes.
69- void main () {
69+ void main () async {
7070 final StringBuffer output = StringBuffer ();
7171 try {
7272 try {
@@ -97,14 +97,14 @@ void main() {
9797 output.writeln (unexpectedStackTrace);
9898 output.writeln ('--- TEST FAILED ---' );
9999 }
100- print (output);
101- web.window.fetch (
100+ await web.window.fetch (
102101 '/test-result' .toJS,
103102 web.RequestInit (
104103 method: 'POST' ,
105104 body: '$output ' .toJS,
106105 )
107- );
106+ ).toDart;
107+ print (output);
108108}
109109
110110@noInline
Original file line number Diff line number Diff line change @@ -12,17 +12,16 @@ Future<void> main() async {
1212 String .fromEnvironment ('test.valueB' );
1313 if (combined == 'Example,AValue' ) {
1414 output.write ('--- TEST SUCCEEDED ---' );
15- print ('--- TEST SUCCEEDED ---' );
1615 } else {
1716 output.write ('--- TEST FAILED ---' );
18- print ('--- TEST FAILED ---' );
1917 }
2018
21- web.window.fetch (
19+ await web.window.fetch (
2220 '/test-result' .toJS,
2321 web.RequestInit (
2422 method: 'POST' ,
2523 body: '$output ' .toJS,
2624 )
27- );
25+ ).toDart;
26+ print (output);
2827}
Original file line number Diff line number Diff line change @@ -6,12 +6,19 @@ import 'dart:js_interop';
66
77import 'package:web/web.dart' as web;
88
9- // Attempt to load CanvasKit resources hosted on gstatic.
109Future <void > main () async {
10+ if (await testFetchResources ()) {
11+ print ('--- TEST SUCCEEDED ---' );
12+ } else {
13+ print ('--- TEST FAILED ---' );
14+ }
15+ }
16+
17+ // Attempt to load CanvasKit resources hosted on gstatic.
18+ Future <bool > testFetchResources () async {
1119 const String engineVersion = String .fromEnvironment ('TEST_FLUTTER_ENGINE_VERSION' );
1220 if (engineVersion.isEmpty) {
13- print ('--- TEST FAILED ---' );
14- return ;
21+ return false ;
1522 }
1623 try {
1724 final web.Response response = await web.window.fetch (
@@ -20,14 +27,12 @@ Future<void> main() async {
2027 method: 'GET' ,
2128 ),
2229 ).toDart;
23- if (response.ok) {
24- print ('--- TEST SUCCEEDED ---' );
25- } else {
26- print ('--- TEST FAILED ---' );
30+ if (! response.ok) {
31+ return false ;
2732 }
2833 } catch (err) {
2934 print (err);
30- print ( '--- TEST FAILED ---' ) ;
35+ return false ;
3136 }
3237 try {
3338 final web.Response response = await web.window.fetch (
@@ -36,13 +41,12 @@ Future<void> main() async {
3641 method: 'GET' ,
3742 )
3843 ).toDart;
39- if (response.ok) {
40- print ('--- TEST SUCCEEDED ---' );
41- } else {
42- print ('--- TEST FAILED ---' );
44+ if (! response.ok) {
45+ return false ;
4346 }
4447 } catch (err) {
4548 print (err);
46- print ( '--- TEST FAILED ---' ) ;
49+ return false ;
4750 }
51+ return true ;
4852}
You can’t perform that action at this time.
0 commit comments