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
b257c33b
Unverified
Commit
b257c33b
authored
Jul 15, 2019
by
Jonah Williams
Committed by
GitHub
Jul 15, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use DeviceManager instead of device to determine if device supports project (#36213)
parent
6b17840c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
1 deletion
+26
-1
device.dart
packages/flutter_tools/lib/src/device.dart
+3
-1
device_test.dart
packages/flutter_tools/test/general.shard/device_test.dart
+23
-0
No files found.
packages/flutter_tools/lib/src/device.dart
View file @
b257c33b
...
...
@@ -202,7 +202,7 @@ class DeviceManager {
if
(
devices
.
length
>
1
&&
!
hasSpecifiedDeviceId
)
{
devices
=
<
Device
>[
for
(
Device
device
in
devices
)
if
(
device
.
isSupportedForProject
(
flutterProject
))
if
(
isDeviceSupportedForProject
(
device
,
flutterProject
))
device
];
}
...
...
@@ -224,6 +224,8 @@ class DeviceManager {
}
/// Returns whether the device is supported for the project.
///
/// This exists to allow the check to be overriden for google3 clients.
bool
isDeviceSupportedForProject
(
Device
device
,
FlutterProject
flutterProject
)
{
return
device
.
isSupportedForProject
(
flutterProject
);
}
...
...
packages/flutter_tools/test/general.shard/device_test.dart
View file @
b257c33b
...
...
@@ -116,6 +116,20 @@ void main() {
nonEphemeralTwo
,
]);
});
testUsingContext
(
'uses DeviceManager.isDeviceSupportedForProject instead of device.isSupportedForProject'
,
()
async
{
final
List
<
Device
>
devices
=
<
Device
>[
unsupported
,
];
final
TestDeviceManager
deviceManager
=
TestDeviceManager
(
devices
);
deviceManager
.
isAlwaysSupportedOverride
=
true
;
final
List
<
Device
>
filtered
=
await
deviceManager
.
findTargetDevices
(
FlutterProject
.
current
());
expect
(
filtered
,
<
Device
>[
unsupported
,
]);
});
});
}
...
...
@@ -123,11 +137,20 @@ class TestDeviceManager extends DeviceManager {
TestDeviceManager
(
this
.
allDevices
);
final
List
<
Device
>
allDevices
;
bool
isAlwaysSupportedOverride
;
@override
Stream
<
Device
>
getAllConnectedDevices
()
{
return
Stream
<
Device
>.
fromIterable
(
allDevices
);
}
@override
bool
isDeviceSupportedForProject
(
Device
device
,
FlutterProject
flutterProject
)
{
if
(
isAlwaysSupportedOverride
!=
null
)
{
return
isAlwaysSupportedOverride
;
}
return
super
.
isDeviceSupportedForProject
(
device
,
flutterProject
);
}
}
class
_MockDevice
extends
Device
{
...
...
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