Skip to content

Commit 40bfb70

Browse files
author
Harry Terkelsen
authored
Add smoke test for gstatic resources (#123270)
1 parent f4caee6 commit 40bfb70

2 files changed

Lines changed: 49 additions & 0 deletions

File tree

dev/bots/test.dart

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1135,6 +1135,7 @@ Future<void> _runWebUnitTests(String webRenderer) async {
11351135

11361136
/// Coarse-grained integration tests running on the Web.
11371137
Future<void> _runWebLongRunningTests() async {
1138+
final String engineVersion = File(engineVersionFile).readAsStringSync().trim();
11381139
final List<ShardRunner> tests = <ShardRunner>[
11391140
for (String buildMode in _kAllBuildModes) ...<ShardRunner>[
11401141
() => _runFlutterDriverWebTest(
@@ -1228,6 +1229,10 @@ Future<void> _runWebLongRunningTests() async {
12281229
() => _runWebDebugTest('lib/stack_trace.dart'),
12291230
() => _runWebDebugTest('lib/framework_stack_trace.dart'),
12301231
() => _runWebDebugTest('lib/web_directory_loading.dart'),
1232+
() => _runWebDebugTest('lib/web_resources_cdn_test.dart',
1233+
additionalArguments: <String>[
1234+
'--dart-define=TEST_FLUTTER_ENGINE_VERSION=$engineVersion',
1235+
]),
12311236
() => _runWebDebugTest('test/test.dart'),
12321237
() => _runWebDebugTest('lib/null_safe_main.dart', enableNullSafety: true),
12331238
() => _runWebDebugTest('lib/web_define_loading.dart',
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
// Copyright 2014 The Flutter Authors. All rights reserved.
2+
// Use of this source code is governed by a BSD-style license that can be
3+
// found in the LICENSE file.
4+
5+
import 'dart:html' as html;
6+
7+
// Attempt to load CanvasKit resources hosted on gstatic.
8+
Future<void> main() async {
9+
const String engineVersion = String.fromEnvironment('TEST_FLUTTER_ENGINE_VERSION');
10+
if (engineVersion.isEmpty) {
11+
print('--- TEST FAILED ---');
12+
return;
13+
}
14+
try {
15+
final html.HttpRequest request = await html.HttpRequest.request(
16+
'https://www.gstatic.com/flutter-canvaskit/$engineVersion/canvaskit.js',
17+
method: 'GET',
18+
);
19+
final dynamic response = request.response;
20+
if (response != null) {
21+
print('--- TEST SUCCEEDED ---');
22+
} else {
23+
print('--- TEST FAILED ---');
24+
}
25+
} catch (err) {
26+
print(err);
27+
print('--- TEST FAILED ---');
28+
}
29+
try {
30+
final html.HttpRequest request = await html.HttpRequest.request(
31+
'https://www.gstatic.com/flutter-canvaskit/$engineVersion/canvaskit.wasm',
32+
method: 'GET',
33+
);
34+
final dynamic response = request.response;
35+
if (response != null) {
36+
print('--- TEST SUCCEEDED ---');
37+
} else {
38+
print('--- TEST FAILED ---');
39+
}
40+
} catch (err) {
41+
print(err);
42+
print('--- TEST FAILED ---');
43+
}
44+
}

0 commit comments

Comments
 (0)