Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
66273157
Unverified
Commit
66273157
authored
Jun 28, 2019
by
Todd Volkert
Committed by
GitHub
Jun 28, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
More preparation for HttpClientResponse implements Uint8List (#35245)
https://github.com/dart-lang/sdk/issues/36900
parent
17c18da0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
14 deletions
+15
-14
consolidate_response_test.dart
...es/flutter/test/foundation/consolidate_response_test.dart
+12
-11
image_provider_test.dart
packages/flutter/test/painting/image_provider_test.dart
+3
-3
No files found.
packages/flutter/test/foundation/consolidate_response_test.dart
View file @
66273157
...
...
@@ -6,6 +6,7 @@
import
'dart:async'
;
import
'dart:io'
;
import
'dart:typed_data'
;
import
'package:flutter/foundation.dart'
;
import
'package:mockito/mockito.dart'
;
...
...
@@ -14,8 +15,8 @@ import '../flutter_test_alternative.dart';
void
main
(
)
{
group
(
consolidateHttpClientResponseBytes
,
()
{
final
List
<
int
>
chunkOne
=
<
int
>[
0
,
1
,
2
,
3
,
4
,
5
]
;
final
List
<
int
>
chunkTwo
=
<
int
>[
6
,
7
,
8
,
9
,
10
]
;
final
Uint8List
chunkOne
=
Uint8List
.
fromList
(<
int
>[
0
,
1
,
2
,
3
,
4
,
5
])
;
final
Uint8List
chunkTwo
=
Uint8List
.
fromList
(<
int
>[
6
,
7
,
8
,
9
,
10
])
;
MockHttpClientResponse
response
;
setUp
(()
{
...
...
@@ -32,8 +33,8 @@ void main() {
final
void
Function
()
onDone
=
invocation
.
namedArguments
[
#onDone
];
final
bool
cancelOnError
=
invocation
.
namedArguments
[
#cancelOnError
];
return
Stream
<
List
<
int
>
>.
fromIterable
(
<
List
<
int
>
>[
chunkOne
,
chunkTwo
]).
listen
(
return
Stream
<
Uint8List
>.
fromIterable
(
<
Uint8List
>[
chunkOne
,
chunkTwo
]).
listen
(
onData
,
onDone:
onDone
,
onError:
onError
,
...
...
@@ -98,8 +99,8 @@ void main() {
final
void
Function
()
onDone
=
invocation
.
namedArguments
[
#onDone
];
final
bool
cancelOnError
=
invocation
.
namedArguments
[
#cancelOnError
];
return
Stream
<
List
<
int
>
>.
fromFuture
(
Future
<
List
<
int
>
>.
error
(
Exception
(
'Test Error'
)))
return
Stream
<
Uint8List
>.
fromFuture
(
Future
<
Uint8List
>.
error
(
Exception
(
'Test Error'
)))
.
listen
(
onData
,
onDone:
onDone
,
...
...
@@ -126,9 +127,9 @@ void main() {
});
group
(
'when gzipped'
,
()
{
final
List
<
int
>
gzipped
=
gzip
.
encode
(
chunkOne
.
followedBy
(
chunkTwo
).
toList
());
final
List
<
int
>
gzippedChunkOne
=
gzipped
.
sublist
(
0
,
gzipped
.
length
~/
2
);
final
List
<
int
>
gzippedChunkTwo
=
gzipped
.
sublist
(
gzipped
.
length
~/
2
);
final
Uint8List
gzipped
=
gzip
.
encode
(
chunkOne
.
followedBy
(
chunkTwo
).
toList
());
final
Uint8List
gzippedChunkOne
=
gzipped
.
sublist
(
0
,
gzipped
.
length
~/
2
);
final
Uint8List
gzippedChunkTwo
=
gzipped
.
sublist
(
gzipped
.
length
~/
2
);
setUp
(()
{
when
(
response
.
compressionState
).
thenReturn
(
HttpClientResponseCompressionState
.
compressed
);
...
...
@@ -143,8 +144,8 @@ void main() {
final
void
Function
()
onDone
=
invocation
.
namedArguments
[
#onDone
];
final
bool
cancelOnError
=
invocation
.
namedArguments
[
#cancelOnError
];
return
Stream
<
List
<
int
>
>.
fromIterable
(
<
List
<
int
>
>[
gzippedChunkOne
,
gzippedChunkTwo
]).
listen
(
return
Stream
<
Uint8List
>.
fromIterable
(
<
Uint8List
>[
gzippedChunkOne
,
gzippedChunkTwo
]).
listen
(
onData
,
onDone:
onDone
,
onError:
onError
,
...
...
packages/flutter/test/painting/image_provider_test.dart
View file @
66273157
...
...
@@ -202,10 +202,10 @@ void main() {
});
test
(
'Notifies listeners of chunk events'
,
()
async
{
final
List
<
List
<
int
>>
chunks
=
<
List
<
int
>
>[];
final
List
<
Uint8List
>
chunks
=
<
Uint8List
>[];
const
int
chunkSize
=
8
;
for
(
int
offset
=
0
;
offset
<
kTransparentImage
.
length
;
offset
+=
chunkSize
)
{
chunks
.
add
(
kTransparentImage
.
skip
(
offset
).
take
(
chunkSize
).
toList
(
));
chunks
.
add
(
Uint8List
.
fromList
(
kTransparentImage
.
skip
(
offset
).
take
(
chunkSize
).
toList
()
));
}
final
Completer
<
void
>
imageAvailable
=
Completer
<
void
>();
final
MockHttpClientRequest
request
=
MockHttpClientRequest
();
...
...
@@ -225,7 +225,7 @@ void main() {
final
void
Function
()
onDone
=
invocation
.
namedArguments
[
#onDone
];
final
bool
cancelOnError
=
invocation
.
namedArguments
[
#cancelOnError
];
return
Stream
<
List
<
int
>
>.
fromIterable
(
chunks
).
listen
(
return
Stream
<
Uint8List
>.
fromIterable
(
chunks
).
listen
(
onData
,
onDone:
onDone
,
onError:
onError
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment