Skip to content

Commit

Permalink
More HttpClientResponse implements Stream<Uint8List> fixes (flutter…
Browse files Browse the repository at this point in the history
  • Loading branch information
tvolkert authored and johnsonmh committed Jul 30, 2019
1 parent 95a700c commit 77e40db
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
7 changes: 6 additions & 1 deletion packages/flutter_tools/test/base/net_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ class MockHttpClientRequest implements io.HttpClientRequest {
}
}

class MockHttpClientResponse extends Stream<List<int>> implements io.HttpClientResponse {
class MockHttpClientResponse implements io.HttpClientResponse {
MockHttpClientResponse(this.statusCode);

@override
Expand All @@ -253,6 +253,11 @@ class MockHttpClientResponse extends Stream<List<int>> implements io.HttpClientR
.listen(onData, onError: onError, onDone: onDone, cancelOnError: cancelOnError);
}

@override
Future<dynamic> forEach(void Function(Uint8List element) action) {
return Future<void>.error(const io.SocketException('test'));
}

@override
dynamic noSuchMethod(Invocation invocation) {
throw 'io.HttpClientResponse - $invocation';
Expand Down
8 changes: 7 additions & 1 deletion packages/flutter_tools/test/commands/create_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1286,7 +1286,7 @@ class MockHttpClientRequest implements HttpClientRequest {
}
}

class MockHttpClientResponse extends Stream<List<int>> implements HttpClientResponse {
class MockHttpClientResponse implements HttpClientResponse {
MockHttpClientResponse(this.statusCode, {this.result});

@override
Expand All @@ -1313,6 +1313,12 @@ class MockHttpClientResponse extends Stream<List<int>> implements HttpClientResp
.listen(onData, onError: onError, onDone: onDone, cancelOnError: cancelOnError);
}

@override
Future<dynamic> forEach(void Function(Uint8List element) action) {
action(Uint8List.fromList(result.codeUnits));
return Future<void>.value();
}

@override
dynamic noSuchMethod(Invocation invocation) {
throw 'io.HttpClientResponse - $invocation';
Expand Down

0 comments on commit 77e40db

Please sign in to comment.