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
8db51f66
Unverified
Commit
8db51f66
authored
Jan 29, 2021
by
Jonah Williams
Committed by
GitHub
Jan 29, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[flutter_tools] remove mock android device from log reader test (#74995)
parent
6efe8e91
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
18 deletions
+34
-18
adb_log_reader_test.dart
...tools/test/general.shard/android/adb_log_reader_test.dart
+34
-18
No files found.
packages/flutter_tools/test/general.shard/android/adb_log_reader_test.dart
View file @
8db51f66
...
...
@@ -7,7 +7,7 @@
import
'dart:async'
;
import
'package:flutter_tools/src/android/android_device.dart'
;
import
'package:
mockito/mockito
.dart'
;
import
'package:
test/fake
.dart'
;
import
'../../src/common.dart'
;
import
'../../src/context.dart'
;
...
...
@@ -39,7 +39,7 @@ void main() {
)
]);
await
AdbLogReader
.
createLogReader
(
create
Mock
Device
(
kLollipopVersionCode
),
create
Fake
Device
(
kLollipopVersionCode
),
processManager
,
);
...
...
@@ -62,7 +62,7 @@ void main() {
)
]);
await
AdbLogReader
.
createLogReader
(
create
Mock
Device
(
kLollipopVersionCode
-
1
),
create
Fake
Device
(
kLollipopVersionCode
-
1
),
processManager
,
);
...
...
@@ -85,7 +85,7 @@ void main() {
)
]);
await
AdbLogReader
.
createLogReader
(
create
Mock
Device
(
null
),
create
Fake
Device
(
null
),
processManager
,
);
...
...
@@ -110,7 +110,7 @@ void main() {
)
]);
await
AdbLogReader
.
createLogReader
(
create
Mock
Device
(
null
),
create
Fake
Device
(
null
),
processManager
,
includePastLogs:
true
,
);
...
...
@@ -136,7 +136,7 @@ void main() {
)
]);
final
AdbLogReader
logReader
=
await
AdbLogReader
.
createLogReader
(
create
Mock
Device
(
null
),
create
Fake
Device
(
null
),
processManager
,
);
final
Completer
<
void
>
onDone
=
Completer
<
void
>.
sync
();
...
...
@@ -170,7 +170,7 @@ void main() {
)
]);
final
AdbLogReader
logReader
=
await
AdbLogReader
.
createLogReader
(
create
Mock
Device
(
null
),
create
Fake
Device
(
null
),
processManager
,
);
await
expectLater
(
logReader
.
logLines
,
emitsInOrder
(<
String
>[
...
...
@@ -183,16 +183,32 @@ void main() {
});
}
MockAndroidDevice
createMockDevice
(
int
sdkLevel
)
{
final
MockAndroidDevice
mockAndroidDevice
=
MockAndroidDevice
();
when
(
mockAndroidDevice
.
apiVersion
)
.
thenAnswer
((
Invocation
invocation
)
async
=>
sdkLevel
.
toString
());
when
(
mockAndroidDevice
.
lastLogcatTimestamp
()).
thenAnswer
((
Invocation
_
)
async
=>
kLastLogcatTimestamp
);
when
(
mockAndroidDevice
.
adbCommandForDevice
(
any
))
.
thenAnswer
((
Invocation
invocation
)
=>
<
String
>[
'adb'
,
'-s'
,
'1234'
,
...
invocation
.
positionalArguments
.
first
as
List
<
String
>
]);
return
mockAndroidDevice
;
AndroidDevice
createFakeDevice
(
int
sdkLevel
)
{
return
FakeAndroidDevice
(
sdkLevel
.
toString
(),
kLastLogcatTimestamp
,
);
}
class
MockAndroidDevice
extends
Mock
implements
AndroidDevice
{}
class
FakeAndroidDevice
extends
Fake
implements
AndroidDevice
{
FakeAndroidDevice
(
this
.
_apiVersion
,
this
.
_lastLogcatTimestamp
);
final
String
_lastLogcatTimestamp
;
final
String
_apiVersion
;
@override
String
get
name
=>
'test-device'
;
@override
Future
<
String
>
get
apiVersion
=>
Future
<
String
>.
value
(
_apiVersion
);
@override
Future
<
String
>
lastLogcatTimestamp
()
async
=>
_lastLogcatTimestamp
;
@override
List
<
String
>
adbCommandForDevice
(
List
<
String
>
command
)
{
return
<
String
>[
'adb'
,
'-s'
,
'1234'
,
...
command
,
];
}
}
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