flutter/dev/manual_tests/test/mock_image_http.dart
Ian Hickson 44e228eb9e
Move image logic from services/ to painting/. (#13409)
This allows the scheduler library to depend on the services library
and the painting library to depend on the scheduler library without
the services library having to depend on the scheduler library.

While I was at it I also cleaned up some of the binding logic: the
licenses logic can now be overridden (and the test library does so),
and the image cache can now be overridden as well.
2017-12-07 14:53:08 -08:00

16 lines
556 B
Dart

import 'dart:async';
import 'package:flutter/foundation.dart' show ValueGetter;
import 'package:http/http.dart' as http;
import 'package:http/testing.dart' as http;
import '../../../packages/flutter/test/painting/image_data.dart';
// Returns a mock HTTP client that responds with an image to all requests.
ValueGetter<http.Client> createMockImageHttpClient = () {
return new http.MockClient((http.BaseRequest request) {
return new Future<http.Response>.value(
new http.Response.bytes(kTransparentImage, 200, request: request)
);
});
};