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
f5827f0f
Unverified
Commit
f5827f0f
authored
May 24, 2019
by
Zachary Anderson
Committed by
GitHub
May 24, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[flutter_tool] Improve Fuchsia 'run' tests (#33263)
parent
7ec9a6fa
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
285 additions
and
35 deletions
+285
-35
fuchsia_dev_finder.dart
...ges/flutter_tools/lib/src/fuchsia/fuchsia_dev_finder.dart
+11
-2
fuchsia_device.dart
packages/flutter_tools/lib/src/fuchsia/fuchsia_device.dart
+10
-9
fuchsia_sdk.dart
packages/flutter_tools/lib/src/fuchsia/fuchsia_sdk.dart
+3
-0
fuchsa_device_test.dart
packages/flutter_tools/test/fuchsia/fuchsa_device_test.dart
+261
-24
No files found.
packages/flutter_tools/lib/src/fuchsia/fuchsia_dev_finder.dart
View file @
f5827f0f
...
...
@@ -4,6 +4,7 @@
import
'../base/common.dart'
;
import
'../base/process.dart'
;
import
'../globals.dart'
;
import
'fuchsia_sdk.dart'
;
// Usage: dev_finder <flags> <subcommand> <subcommand args>
...
...
@@ -31,7 +32,11 @@ class FuchsiaDevFinder {
'-full'
];
final
RunResult
result
=
await
runAsync
(
command
);
return
(
result
.
exitCode
==
0
)
?
result
.
stdout
.
split
(
'
\n
'
)
:
null
;
if
(
result
.
exitCode
!=
0
)
{
printError
(
'dev_finder failed:
${result.stderr}
'
);
return
null
;
}
return
result
.
stdout
.
split
(
'
\n
'
);
}
/// Returns the host address by which the device [deviceName] should use for
...
...
@@ -51,6 +56,10 @@ class FuchsiaDevFinder {
deviceName
];
final
RunResult
result
=
await
runAsync
(
command
);
return
(
result
.
exitCode
==
0
)
?
result
.
stdout
.
trim
()
:
null
;
if
(
result
.
exitCode
!=
0
)
{
printError
(
'dev_finder failed:
${result.stderr}
'
);
return
null
;
}
return
result
.
stdout
.
trim
();
}
}
packages/flutter_tools/lib/src/fuchsia/fuchsia_device.dart
View file @
f5827f0f
...
...
@@ -44,9 +44,6 @@ class FuchsiaDeviceTools {
FuchsiaTilesCtl
get
tilesCtl
=>
_tilesCtl
??=
FuchsiaTilesCtl
();
}
final
FuchsiaAmberCtl
_amberCtl
=
fuchsiaDeviceTools
.
amberCtl
;
final
FuchsiaTilesCtl
_tilesCtl
=
fuchsiaDeviceTools
.
tilesCtl
;
final
String
_ipv4Loopback
=
InternetAddress
.
loopbackIPv4
.
address
;
final
String
_ipv6Loopback
=
InternetAddress
.
loopbackIPv6
.
address
;
...
...
@@ -233,6 +230,10 @@ class FuchsiaDevice extends Device {
await
stopApp
(
package
);
// Find out who the device thinks we are.
final
String
host
=
await
fuchsiaSdk
.
fuchsiaDevFinder
.
resolve
(
name
);
if
(
host
==
null
)
{
printError
(
'Failed to resolve host for Fuchsia device'
);
return
LaunchResult
.
failed
();
}
final
int
port
=
await
os
.
findFreePort
();
if
(
port
==
0
)
{
printError
(
'Failed to find a free port'
);
...
...
@@ -265,14 +266,14 @@ class FuchsiaDevice extends Device {
}
// Teach amber about the package server.
if
(!
await
_
amberCtl
.
addSrc
(
this
,
fuchsiaPackageServer
))
{
if
(!
await
fuchsiaDeviceTools
.
amberCtl
.
addSrc
(
this
,
fuchsiaPackageServer
))
{
printError
(
'Failed to teach amber about the package server'
);
return
LaunchResult
.
failed
();
}
serverRegistered
=
true
;
// Tell amber to prefetch the app.
if
(!
await
_
amberCtl
.
getUp
(
this
,
appName
))
{
if
(!
await
fuchsiaDeviceTools
.
amberCtl
.
getUp
(
this
,
appName
))
{
printError
(
'Failed to get amber to prefetch the package'
);
return
LaunchResult
.
failed
();
}
...
...
@@ -286,14 +287,14 @@ class FuchsiaDevice extends Device {
// Instruct tiles_ctl to start the app.
final
String
fuchsiaUrl
=
'fuchsia-pkg://fuchsia.com/
$appName
#meta/
$appName
.cmx'
;
if
(!
await
_
tilesCtl
.
add
(
this
,
fuchsiaUrl
,
<
String
>[]))
{
if
(!
await
fuchsiaDeviceTools
.
tilesCtl
.
add
(
this
,
fuchsiaUrl
,
<
String
>[]))
{
printError
(
'Failed to add the app to tiles'
);
return
LaunchResult
.
failed
();
}
}
finally
{
// Try to un-teach amber about the package server if needed.
if
(
serverRegistered
)
{
await
_
amberCtl
.
rmSrc
(
this
,
fuchsiaPackageServer
);
await
fuchsiaDeviceTools
.
amberCtl
.
rmSrc
(
this
,
fuchsiaPackageServer
);
}
// Shutdown the package server and delete the package repo;
fuchsiaPackageServer
.
stop
();
...
...
@@ -308,7 +309,7 @@ class FuchsiaDevice extends Device {
// In a debug or profile build, try to find the observatory uri.
final
FuchsiaIsolateDiscoveryProtocol
discovery
=
FuchsiaIsolateDiscoveryProtocol
(
this
,
appName
);
getIsolateDiscoveryProtocol
(
appName
);
try
{
final
Uri
observatoryUri
=
await
discovery
.
uri
;
return
LaunchResult
.
succeeded
(
observatoryUri:
observatoryUri
);
...
...
@@ -321,7 +322,7 @@ class FuchsiaDevice extends Device {
Future
<
bool
>
stopApp
(
covariant
FuchsiaApp
app
)
async
{
final
int
appKey
=
await
FuchsiaTilesCtl
.
findAppKey
(
this
,
app
.
id
);
if
(
appKey
!=
-
1
)
{
if
(!
await
_
tilesCtl
.
remove
(
this
,
appKey
))
{
if
(!
await
fuchsiaDeviceTools
.
tilesCtl
.
remove
(
this
,
appKey
))
{
printError
(
'tiles_ctl remove on
${app.id}
failed.'
);
return
false
;
}
...
...
packages/flutter_tools/lib/src/fuchsia/fuchsia_sdk.dart
View file @
f5827f0f
...
...
@@ -50,6 +50,9 @@ class FuchsiaSdk {
return
null
;
}
final
List
<
String
>
devices
=
await
fuchsiaDevFinder
.
list
();
if
(
devices
==
null
)
{
return
null
;
}
return
devices
.
isNotEmpty
?
devices
[
0
]
:
null
;
}
...
...
packages/flutter_tools/test/fuchsia/fuchsa_device_test.dart
View file @
f5827f0f
This diff is collapsed.
Click to expand it.
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