Visitar URL original
Add leak tracking in test/painting #1 by droidbg · Pull Request #136167 · flutter/flutter · GitHub
Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Update. network image test web leak tracking
  • Loading branch information
droidbg committed Oct 8, 2023
commit 1c7188ae17ed2ceff19fe0cf71405fca547121ee
10 changes: 6 additions & 4 deletions packages/flutter/test/painting/_network_image_test_web.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/src/painting/_network_image_web.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart';
import 'package:web/web.dart' as web;

import '../image_data.dart';
Expand All @@ -16,7 +17,7 @@ void runTests() {
debugRestoreHttpRequestFactory();
});

testWidgets('loads an image from the network with headers',
testWidgetsWithLeakTracking('loads an image from the network with headers',
(WidgetTester tester) async {
final TestHttpRequest testHttpRequest = TestHttpRequest()
..status = 200
Expand All @@ -42,13 +43,13 @@ void runTests() {
assert(mapEquals(testHttpRequest.responseHeaders, headers), true);
});

testWidgets('loads an image from the network with unsuccessful HTTP code',
testWidgetsWithLeakTracking(
'loads an image from the network with unsuccessful HTTP code',
(WidgetTester tester) async {
final TestHttpRequest testHttpRequest = TestHttpRequest()
..status = 404
..mockEvent = MockEvent('error', web.Event('test error'));


httpRequestFactory = () {
return testHttpRequest.getMock();
};
Expand All @@ -67,7 +68,8 @@ void runTests() {
expect((tester.takeException() as web.ProgressEvent).type, 'test error');
});

testWidgets('loads an image from the network with empty response',
testWidgetsWithLeakTracking(
'loads an image from the network with empty response',
(WidgetTester tester) async {
final TestHttpRequest testHttpRequest = TestHttpRequest()
..status = 200
Expand Down