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

Commit 4819f6b

Browse files
committed
Reduce server dependencies in tests
1 parent 18607ea commit 4819f6b

File tree

1 file changed

+23
-8
lines changed

1 file changed

+23
-8
lines changed

packages/video_player/video_player_web/example/integration_test/video_player_web_test.dart

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,22 @@ import 'package:integration_test/integration_test.dart';
1111
import 'package:video_player_platform_interface/video_player_platform_interface.dart';
1212
import 'package:video_player_web/video_player_web.dart';
1313

14+
// Returns the URL to load an asset from this example app as a network source.
15+
//
16+
// TODO(stuartmorgan): Convert this to a local `HttpServer` that vends the
17+
// assets directly, https://github.com/flutter/flutter/issues/95420
18+
String getUrlForAssetAsNetworkSource(String assetKey) {
19+
return 'https://github.com/flutter/plugins/blob/'
20+
// This hash can be rolled forward to pick up newly-added assets.
21+
'cb381ced070d356799dddf24aca38ce0579d3d7b'
22+
'/packages/video_player/video_player/example/'
23+
'$assetKey'
24+
'?raw=true';
25+
}
26+
27+
// Use WebM for web to allow CI to use Chromium.
28+
const String _videoAssetKey = 'assets/Butterfly-209.webm';
29+
1430
void main() {
1531
IntegrationTestWidgetsFlutterBinding.ensureInitialized();
1632

@@ -23,8 +39,7 @@ void main() {
2339
.create(
2440
DataSource(
2541
sourceType: DataSourceType.network,
26-
uri:
27-
'https://github.com/flutter/plugins/blob/main/packages/video_player/video_player/example/assets/Butterfly-209.webm?raw=true',
42+
uri: getUrlForAssetAsNetworkSource(_videoAssetKey),
2843
),
2944
)
3045
.then((int? textureId) => textureId!);
@@ -38,9 +53,9 @@ void main() {
3853
expect(
3954
VideoPlayerPlatform.instance.create(
4055
DataSource(
41-
sourceType: DataSourceType.network,
42-
uri:
43-
'https://github.com/flutter/plugins/blob/main/packages/video_player/video_player/example/assets/Butterfly-209.webm?raw=true'),
56+
sourceType: DataSourceType.network,
57+
uri: getUrlForAssetAsNetworkSource(_videoAssetKey),
58+
),
4459
),
4560
completion(isNonZero));
4661
});
@@ -100,9 +115,9 @@ void main() {
100115
(WidgetTester tester) async {
101116
final int videoPlayerId = (await VideoPlayerPlatform.instance.create(
102117
DataSource(
103-
sourceType: DataSourceType.network,
104-
uri:
105-
'https://flutter.github.io/assets-for-api-docs/assets/videos/_non_existent_video.mp4'),
118+
sourceType: DataSourceType.network,
119+
uri: getUrlForAssetAsNetworkSource('assets/__non_existent.webm'),
120+
),
106121
))!;
107122

108123
final Stream<VideoEvent> eventStream =

0 commit comments

Comments
 (0)