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
c6dbb6f2
Unverified
Commit
c6dbb6f2
authored
Mar 11, 2021
by
Jonah Williams
Committed by
GitHub
Mar 11, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update mockito dep and remove usage in manual tests and localizations (#77945)
parent
b8d44fd2
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
52 additions
and
31 deletions
+52
-31
pubspec.yaml
dev/manual_tests/pubspec.yaml
+1
-3
mock_image_http.dart
dev/manual_tests/test/mock_image_http.dart
+47
-23
pubspec.yaml
packages/flutter_localizations/pubspec.yaml
+1
-2
update_packages.dart
packages/flutter_tools/lib/src/commands/update_packages.dart
+1
-1
pubspec.yaml
packages/flutter_tools/pubspec.yaml
+2
-2
No files found.
dev/manual_tests/pubspec.yaml
View file @
c6dbb6f2
...
...
@@ -17,8 +17,6 @@ dev_dependencies:
flutter_test
:
sdk
:
flutter
mockito
:
4.1.1
async
:
2.5.0
# THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
boolean_selector
:
2.1.0
# THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
charcode
:
1.2.0
# THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
...
...
@@ -36,4 +34,4 @@ dev_dependencies:
flutter
:
uses-material-design
:
true
# PUBSPEC CHECKSUM:
d387
# PUBSPEC CHECKSUM:
7441
dev/manual_tests/test/mock_image_http.dart
View file @
c6dbb6f2
...
...
@@ -2,38 +2,62 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import
'dart:async'
;
import
'dart:io'
;
import
'package:
mockito/mockito
.dart'
;
import
'package:
flutter_test/flutter_test
.dart'
;
import
'../../../packages/flutter/test/image_data.dart'
;
// Returns a mock HTTP client that responds with an image to all requests.
MockHttpClient
createMockImageHttpClient
(
SecurityContext
_
)
{
final
MockHttpClient
client
=
MockHttpClient
();
final
MockHttpClientRequest
request
=
MockHttpClientRequest
();
final
MockHttpClientResponse
response
=
MockHttpClientResponse
();
final
MockHttpHeaders
headers
=
MockHttpHeaders
();
when
(
client
.
getUrl
(
any
)).
thenAnswer
((
_
)
=>
Future
<
HttpClientRequest
>.
value
(
request
));
when
(
request
.
headers
).
thenReturn
(
headers
);
when
(
request
.
close
()).
thenAnswer
((
_
)
=>
Future
<
HttpClientResponse
>.
value
(
response
));
when
(
response
.
contentLength
).
thenReturn
(
kTransparentImage
.
length
);
when
(
response
.
statusCode
).
thenReturn
(
HttpStatus
.
ok
);
when
(
response
.
compressionState
).
thenReturn
(
HttpClientResponseCompressionState
.
notCompressed
);
when
(
response
.
listen
(
any
)).
thenAnswer
((
Invocation
invocation
)
{
final
void
Function
(
List
<
int
>)
onData
=
invocation
.
positionalArguments
[
0
]
as
void
Function
(
List
<
int
>);
final
void
Function
()
onDone
=
invocation
.
namedArguments
[
#onDone
]
as
void
Function
();
final
void
Function
(
Object
,
[
StackTrace
])
onError
=
invocation
.
namedArguments
[
#onError
]
as
void
Function
(
Object
,
[
StackTrace
]);
final
bool
cancelOnError
=
invocation
.
namedArguments
[
#cancelOnError
]
as
bool
;
return
Stream
<
List
<
int
>>.
fromIterable
(<
List
<
int
>>[
kTransparentImage
]).
listen
(
onData
,
onDone:
onDone
,
onError:
onError
,
cancelOnError:
cancelOnError
);
});
FakeHttpClient
createMockImageHttpClient
(
SecurityContext
_
)
{
final
FakeHttpClient
client
=
FakeHttpClient
();
return
client
;
}
class
MockHttpClient
extends
Mock
implements
HttpClient
{}
class
FakeHttpClient
extends
Fake
implements
HttpClient
{
@override
bool
autoUncompress
=
false
;
class
MockHttpClientRequest
extends
Mock
implements
HttpClientRequest
{}
final
FakeHttpClientRequest
request
=
FakeHttpClientRequest
();
class
MockHttpClientResponse
extends
Mock
implements
HttpClientResponse
{}
@override
Future
<
HttpClientRequest
>
getUrl
(
Uri
url
)
async
{
return
request
;
}
}
class
FakeHttpClientRequest
extends
Fake
implements
HttpClientRequest
{
final
FakeHttpClientResponse
response
=
FakeHttpClientResponse
();
@override
Future
<
HttpClientResponse
>
close
()
async
{
return
response
;
}
}
class
FakeHttpClientResponse
extends
Fake
implements
HttpClientResponse
{
@override
int
get
statusCode
=>
200
;
@override
int
get
contentLength
=>
kTransparentImage
.
length
;
@override
final
FakeHttpHeaders
headers
=
FakeHttpHeaders
();
@override
HttpClientResponseCompressionState
get
compressionState
=>
HttpClientResponseCompressionState
.
notCompressed
;
@override
StreamSubscription
<
List
<
int
>>
listen
(
void
Function
(
List
<
int
>)
onData
,
{
void
Function
()
onDone
,
Function
onError
,
bool
cancelOnError
,
})
{
return
Stream
<
List
<
int
>>.
fromIterable
(<
List
<
int
>>[
kTransparentImage
])
.
listen
(
onData
,
onDone:
onDone
,
onError:
onError
,
cancelOnError:
cancelOnError
);
}
}
class
MockHttpHeaders
extends
Mock
implements
HttpHeaders
{}
class
FakeHttpHeaders
extends
Fake
implements
HttpHeaders
{}
packages/flutter_localizations/pubspec.yaml
View file @
c6dbb6f2
...
...
@@ -21,7 +21,6 @@ dependencies:
dev_dependencies
:
flutter_test
:
sdk
:
flutter
mockito
:
4.1.1
async
:
2.5.0
# THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
boolean_selector
:
2.1.0
# THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
...
...
@@ -35,4 +34,4 @@ dev_dependencies:
term_glyph
:
1.2.0
# THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
test_api
:
0.2.19
# THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
# PUBSPEC CHECKSUM:
18bf
# PUBSPEC CHECKSUM:
9279
packages/flutter_tools/lib/src/commands/update_packages.dart
View file @
c6dbb6f2
...
...
@@ -29,7 +29,7 @@ const Map<String, String> _kManuallyPinnedDependencies = <String, String>{
// existing tests do not fail when the package has a new version.
'flutter_gallery_assets'
:
'^1.0.1'
,
'flutter_template_images'
:
'1.0.1'
,
// Must always exactly match flutter_tools template.
'mockito'
:
'4.1.1'
,
// Prevent mockito from upgrading to the source gen version.
'mockito'
:
'4.1.1
+1
'
,
// Prevent mockito from upgrading to the source gen version.
'vm_service_client'
:
'0.2.6+2'
,
// Final version before being marked deprecated.
// DART TEAM OWNED NNBD DEPS
'archive'
:
'">=3.0.0-nullsafety.0"'
,
...
...
packages/flutter_tools/pubspec.yaml
View file @
c6dbb6f2
...
...
@@ -94,7 +94,7 @@ dependencies:
dev_dependencies
:
collection
:
1.15.0
mockito
:
4.1.1
mockito
:
4.1.1
+1
file_testing
:
3.0.0
test
:
1.16.5
pubspec_parse
:
0.1.8
...
...
@@ -108,4 +108,4 @@ dartdoc:
# Exclude this package from the hosted API docs.
nodoc
:
true
# PUBSPEC CHECKSUM:
09dc
# PUBSPEC CHECKSUM:
4339
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