@@ -1779,7 +1779,11 @@ class _MockHttpRequest extends HttpClientRequest {
1779
1779
}
1780
1780
1781
1781
/// A mocked [HttpClientResponse] which is empty and has a [statusCode] of 400.
1782
- class _MockHttpResponse extends Stream <List <int >> implements HttpClientResponse {
1782
+ // TODO(tvolkert): Change to `extends Stream<Uint8List>` once
1783
+ // https://dart-review.googlesource.com/c/sdk/+/104525 is rolled into the framework.
1784
+ class _MockHttpResponse implements HttpClientResponse {
1785
+ final Stream <Uint8List > _delegate = Stream <Uint8List >.fromIterable (const Iterable <Uint8List >.empty ());
1786
+
1783
1787
@override
1784
1788
final HttpHeaders headers = _MockHttpHeaders ();
1785
1789
@@ -1809,8 +1813,8 @@ class _MockHttpResponse extends Stream<List<int>> implements HttpClientResponse
1809
1813
bool get isRedirect => false ;
1810
1814
1811
1815
@override
1812
- StreamSubscription <List < int >> listen (void Function (List < int > event) onData, { Function onError, void Function () onDone, bool cancelOnError }) {
1813
- return const Stream <List < int > >.empty ().listen (onData, onError: onError, onDone: onDone, cancelOnError: cancelOnError);
1816
+ StreamSubscription <Uint8List > listen (void Function (Uint8List event) onData, { Function onError, void Function () onDone, bool cancelOnError }) {
1817
+ return const Stream <Uint8List >.empty ().listen (onData, onError: onError, onDone: onDone, cancelOnError: cancelOnError);
1814
1818
}
1815
1819
1816
1820
@override
@@ -1829,6 +1833,189 @@ class _MockHttpResponse extends Stream<List<int>> implements HttpClientResponse
1829
1833
1830
1834
@override
1831
1835
int get statusCode => 400 ;
1836
+
1837
+ @override
1838
+ Future <bool > any (bool Function (Uint8List element) test) {
1839
+ return _delegate.any (test);
1840
+ }
1841
+
1842
+ @override
1843
+ Stream <Uint8List > asBroadcastStream ({
1844
+ void Function (StreamSubscription <Uint8List > subscription) onListen,
1845
+ void Function (StreamSubscription <Uint8List > subscription) onCancel,
1846
+ }) {
1847
+ return _delegate.asBroadcastStream (onListen: onListen, onCancel: onCancel);
1848
+ }
1849
+
1850
+ @override
1851
+ Stream <E > asyncExpand <E >(Stream <E > Function (Uint8List event) convert) {
1852
+ return _delegate.asyncExpand <E >(convert);
1853
+ }
1854
+
1855
+ @override
1856
+ Stream <E > asyncMap <E >(FutureOr <E > Function (Uint8List event) convert) {
1857
+ return _delegate.asyncMap <E >(convert);
1858
+ }
1859
+
1860
+ @override
1861
+ Stream <R > cast <R >() {
1862
+ return _delegate.cast <R >();
1863
+ }
1864
+
1865
+ @override
1866
+ Future <bool > contains (Object needle) {
1867
+ return _delegate.contains (needle);
1868
+ }
1869
+
1870
+ @override
1871
+ Stream <Uint8List > distinct ([bool Function (Uint8List previous, Uint8List next) equals]) {
1872
+ return _delegate.distinct (equals);
1873
+ }
1874
+
1875
+ @override
1876
+ Future <E > drain <E >([E futureValue]) {
1877
+ return _delegate.drain <E >(futureValue);
1878
+ }
1879
+
1880
+ @override
1881
+ Future <Uint8List > elementAt (int index) {
1882
+ return _delegate.elementAt (index);
1883
+ }
1884
+
1885
+ @override
1886
+ Future <bool > every (bool Function (Uint8List element) test) {
1887
+ return _delegate.every (test);
1888
+ }
1889
+
1890
+ @override
1891
+ Stream <S > expand <S >(Iterable <S > Function (Uint8List element) convert) {
1892
+ return _delegate.expand (convert);
1893
+ }
1894
+
1895
+ @override
1896
+ Future <Uint8List > get first => _delegate.first;
1897
+
1898
+ @override
1899
+ Future <Uint8List > firstWhere (
1900
+ bool Function (Uint8List element) test, {
1901
+ List <int > Function () orElse,
1902
+ }) {
1903
+ return _delegate.firstWhere (test, orElse: orElse);
1904
+ }
1905
+
1906
+ @override
1907
+ Future <S > fold <S >(S initialValue, S Function (S previous, Uint8List element) combine) {
1908
+ return _delegate.fold <S >(initialValue, combine);
1909
+ }
1910
+
1911
+ @override
1912
+ Future <dynamic > forEach (void Function (Uint8List element) action) {
1913
+ return _delegate.forEach (action);
1914
+ }
1915
+
1916
+ @override
1917
+ Stream <Uint8List > handleError (
1918
+ Function onError, {
1919
+ bool Function (dynamic error) test,
1920
+ }) {
1921
+ return _delegate.handleError (onError, test: test);
1922
+ }
1923
+
1924
+ @override
1925
+ bool get isBroadcast => _delegate.isBroadcast;
1926
+
1927
+ @override
1928
+ Future <bool > get isEmpty => _delegate.isEmpty;
1929
+
1930
+ @override
1931
+ Future <String > join ([String separator = '' ]) {
1932
+ return _delegate.join (separator);
1933
+ }
1934
+
1935
+ @override
1936
+ Future <Uint8List > get last => _delegate.last;
1937
+
1938
+ @override
1939
+ Future <Uint8List > lastWhere (
1940
+ bool Function (Uint8List element) test, {
1941
+ List <int > Function () orElse,
1942
+ }) {
1943
+ return _delegate.lastWhere (test, orElse: orElse);
1944
+ }
1945
+
1946
+ @override
1947
+ Future <int > get length => _delegate.length;
1948
+
1949
+ @override
1950
+ Stream <S > map <S >(S Function (Uint8List event) convert) {
1951
+ return _delegate.map <S >(convert);
1952
+ }
1953
+
1954
+ @override
1955
+ Future <dynamic > pipe (StreamConsumer <List <int >> streamConsumer) {
1956
+ return _delegate.pipe (streamConsumer);
1957
+ }
1958
+
1959
+ @override
1960
+ Future <Uint8List > reduce (List <int > Function (Uint8List previous, Uint8List element) combine) {
1961
+ return _delegate.reduce (combine);
1962
+ }
1963
+
1964
+ @override
1965
+ Future <Uint8List > get single => _delegate.single;
1966
+
1967
+ @override
1968
+ Future <Uint8List > singleWhere (bool Function (Uint8List element) test, {List <int > Function () orElse}) {
1969
+ return _delegate.singleWhere (test, orElse: orElse);
1970
+ }
1971
+
1972
+ @override
1973
+ Stream <Uint8List > skip (int count) {
1974
+ return _delegate.skip (count);
1975
+ }
1976
+
1977
+ @override
1978
+ Stream <Uint8List > skipWhile (bool Function (Uint8List element) test) {
1979
+ return _delegate.skipWhile (test);
1980
+ }
1981
+
1982
+ @override
1983
+ Stream <Uint8List > take (int count) {
1984
+ return _delegate.take (count);
1985
+ }
1986
+
1987
+ @override
1988
+ Stream <Uint8List > takeWhile (bool Function (Uint8List element) test) {
1989
+ return _delegate.takeWhile (test);
1990
+ }
1991
+
1992
+ @override
1993
+ Stream <Uint8List > timeout (
1994
+ Duration timeLimit, {
1995
+ void Function (EventSink <Uint8List > sink) onTimeout,
1996
+ }) {
1997
+ return _delegate.timeout (timeLimit, onTimeout: onTimeout);
1998
+ }
1999
+
2000
+ @override
2001
+ Future <List <Uint8List >> toList () {
2002
+ return _delegate.toList ();
2003
+ }
2004
+
2005
+ @override
2006
+ Future <Set <Uint8List >> toSet () {
2007
+ return _delegate.toSet ();
2008
+ }
2009
+
2010
+ @override
2011
+ Stream <S > transform <S >(StreamTransformer <List <int >, S > streamTransformer) {
2012
+ return _delegate.transform <S >(streamTransformer);
2013
+ }
2014
+
2015
+ @override
2016
+ Stream <Uint8List > where (bool Function (Uint8List event) test) {
2017
+ return _delegate.where (test);
2018
+ }
1832
2019
}
1833
2020
1834
2021
/// A mocked [HttpHeaders] that ignores all writes.
0 commit comments