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
73df0697
Unverified
Commit
73df0697
authored
Jun 14, 2021
by
Jonah Williams
Committed by
GitHub
Jun 14, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[flutter_tools] fully remove mocks from resident_runner_test.dart (#84591)
parent
477683e0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
192 additions
and
357 deletions
+192
-357
resident_runner_test.dart
...lutter_tools/test/general.shard/resident_runner_test.dart
+192
-357
No files found.
packages/flutter_tools/test/general.shard/resident_runner_test.dart
View file @
73df0697
...
...
@@ -35,8 +35,8 @@ import 'package:flutter_tools/src/run_hot.dart';
import
'package:flutter_tools/src/version.dart'
;
import
'package:flutter_tools/src/vmservice.dart'
;
import
'package:meta/meta.dart'
;
import
'package:mockito/mockito.dart'
;
import
'package:package_config/package_config.dart'
;
import
'package:test/fake.dart'
;
import
'package:vm_service/vm_service.dart'
as
vm_service
;
import
'../src/common.dart'
;
...
...
@@ -142,10 +142,10 @@ final Uri testUri = Uri.parse('foo://bar');
void
main
(
)
{
Testbed
testbed
;
MockFlutterDevice
mockF
lutterDevice
;
FakeDevFS
mockD
evFS
;
FakeFlutterDevice
f
lutterDevice
;
FakeDevFS
d
evFS
;
ResidentRunner
residentRunner
;
FakeDevice
mockD
evice
;
FakeDevice
d
evice
;
FakeVmServiceHost
fakeVmServiceHost
;
setUp
(()
{
...
...
@@ -157,7 +157,7 @@ void main() {
..
writeAsStringSync
(
'ABC'
);
residentRunner
=
HotRunner
(
<
FlutterDevice
>[
mockF
lutterDevice
,
f
lutterDevice
,
],
stayResident:
false
,
debuggingOptions:
DebuggingOptions
.
enabled
(
BuildInfo
.
debug
),
...
...
@@ -165,48 +165,13 @@ void main() {
devtoolsHandler:
createNoOpHandler
,
);
});
mockFlutterDevice
=
MockFlutterDevice
();
mockDevice
=
FakeDevice
();
mockDevFS
=
FakeDevFS
();
// FlutterDevice Mocks.
when
(
mockFlutterDevice
.
updateDevFS
(
invalidatedFiles:
anyNamed
(
'invalidatedFiles'
),
mainUri:
anyNamed
(
'mainUri'
),
target:
anyNamed
(
'target'
),
bundle:
anyNamed
(
'bundle'
),
firstBuildTime:
anyNamed
(
'firstBuildTime'
),
bundleFirstUpload:
anyNamed
(
'bundleFirstUpload'
),
bundleDirty:
anyNamed
(
'bundleDirty'
),
fullRestart:
anyNamed
(
'fullRestart'
),
projectRootPath:
anyNamed
(
'projectRootPath'
),
pathToReload:
anyNamed
(
'pathToReload'
),
dillOutputPath:
anyNamed
(
'dillOutputPath'
),
packageConfig:
anyNamed
(
'packageConfig'
),
)).
thenAnswer
((
Invocation
invocation
)
async
{
return
UpdateFSReport
(
success:
true
,
syncedBytes:
0
,
invalidatedSourcesCount:
1
,
);
});
when
(
mockFlutterDevice
.
devFS
).
thenReturn
(
mockDevFS
);
when
(
mockFlutterDevice
.
device
).
thenReturn
(
mockDevice
);
when
(
mockFlutterDevice
.
stopEchoingDeviceLog
()).
thenAnswer
((
Invocation
invocation
)
async
{
});
when
(
mockFlutterDevice
.
observatoryUris
).
thenAnswer
((
_
)
=>
Stream
<
Uri
>.
value
(
testUri
));
when
(
mockFlutterDevice
.
connect
(
reloadSources:
anyNamed
(
'reloadSources'
),
restart:
anyNamed
(
'restart'
),
compileExpression:
anyNamed
(
'compileExpression'
),
getSkSLMethod:
anyNamed
(
'getSkSLMethod'
),
allowExistingDdsInstance:
anyNamed
(
'allowExistingDdsInstance'
),
)).
thenAnswer
((
Invocation
invocation
)
async
{
});
when
(
mockFlutterDevice
.
setupDevFS
(
any
,
any
))
.
thenAnswer
((
Invocation
invocation
)
async
{
return
testUri
;
});
when
(
mockFlutterDevice
.
vmService
).
thenAnswer
((
Invocation
invocation
)
{
return
fakeVmServiceHost
?.
vmService
;
});
device
=
FakeDevice
();
devFS
=
FakeDevFS
();
flutterDevice
=
FakeFlutterDevice
()
..
testUri
=
testUri
..
vmServiceHost
=
(()
=>
fakeVmServiceHost
)
..
device
=
device
..
_devFS
=
devFS
;
});
testUsingContext
(
'ResidentRunner can attach to device successfully'
,
()
=>
testbed
.
run
(()
async
{
...
...
@@ -225,9 +190,6 @@ void main() {
final
Future
<
DebugConnectionInfo
>
connectionInfo
=
futureConnectionInfo
.
future
;
expect
(
await
result
,
0
);
verify
(
mockFlutterDevice
.
initLogReader
()).
called
(
1
);
expect
(
futureConnectionInfo
.
isCompleted
,
true
);
expect
((
await
connectionInfo
).
baseUri
,
'foo://bar'
);
expect
(
futureAppStart
.
isCompleted
,
true
);
...
...
@@ -242,45 +204,21 @@ void main() {
listViews
,
setAssetBundlePath
,
]);
final
MockResidentCompiler
residentCompiler
=
MockResidentCompiler
();
final
FakeResidentCompiler
residentCompiler
=
FakeResidentCompiler
()
..
nextOutput
=
const
CompilerOutput
(
'foo'
,
0
,<
Uri
>[]);
residentRunner
=
HotRunner
(
<
FlutterDevice
>[
mockF
lutterDevice
,
f
lutterDevice
,
],
stayResident:
false
,
debuggingOptions:
DebuggingOptions
.
enabled
(
BuildInfo
.
debug
),
target:
'main.dart'
,
devtoolsHandler:
createNoOpHandler
,
);
when
(
mockFlutterDevice
.
generator
).
thenReturn
(
residentCompiler
);
when
(
residentCompiler
.
recompile
(
any
,
any
,
outputPath:
anyNamed
(
'outputPath'
),
packageConfig:
anyNamed
(
'packageConfig'
),
suppressErrors:
true
,
projectRootPath:
anyNamed
(
'projectRootPath'
),
fs:
anyNamed
(
'fs'
),
)).
thenAnswer
((
Invocation
invocation
)
async
{
return
const
CompilerOutput
(
'foo'
,
0
,<
Uri
>[]);
});
when
(
mockFlutterDevice
.
runHot
(
hotRunner:
anyNamed
(
'hotRunner'
),
route:
anyNamed
(
'route'
),
)).
thenAnswer
((
Invocation
invocation
)
async
{
return
0
;
});
flutterDevice
.
generator
=
residentCompiler
;
expect
(
await
residentRunner
.
run
(
enableDevTools:
true
),
0
);
verify
(
residentCompiler
.
recompile
(
any
,
any
,
outputPath:
anyNamed
(
'outputPath'
),
packageConfig:
anyNamed
(
'packageConfig'
),
suppressErrors:
true
,
projectRootPath:
anyNamed
(
'projectRootPath'
),
fs:
anyNamed
(
'fs'
),
)).
called
(
1
);
expect
(
residentCompiler
.
didSuppressErrors
,
true
);
expect
(
fakeVmServiceHost
.
hasRemainingExpectations
,
false
);
}));
...
...
@@ -289,34 +227,18 @@ void main() {
globals
.
fs
.
file
(
globals
.
fs
.
path
.
join
(
'lib'
,
'main.dart'
))
.
createSync
(
recursive:
true
);
fakeVmServiceHost
=
FakeVmServiceHost
(
requests:
<
VmServiceExpectation
>[]);
final
MockResidentCompiler
residentCompiler
=
MockResidentCompiler
();
final
FakeResidentCompiler
residentCompiler
=
FakeResidentCompiler
()
..
nextOutput
=
const
CompilerOutput
(
'foo'
,
1
,<
Uri
>[]);
residentRunner
=
HotRunner
(
<
FlutterDevice
>[
mockF
lutterDevice
,
f
lutterDevice
,
],
stayResident:
false
,
debuggingOptions:
DebuggingOptions
.
enabled
(
BuildInfo
.
debug
),
target:
'main.dart'
,
devtoolsHandler:
createNoOpHandler
,
);
when
(
mockFlutterDevice
.
generator
).
thenReturn
(
residentCompiler
);
when
(
residentCompiler
.
recompile
(
any
,
any
,
outputPath:
anyNamed
(
'outputPath'
),
packageConfig:
anyNamed
(
'packageConfig'
),
suppressErrors:
true
,
projectRootPath:
anyNamed
(
'projectRootPath'
),
fs:
anyNamed
(
'fs'
),
)).
thenAnswer
((
Invocation
invocation
)
async
{
return
const
CompilerOutput
(
'foo'
,
1
,<
Uri
>[]);
});
when
(
mockFlutterDevice
.
runHot
(
hotRunner:
anyNamed
(
'hotRunner'
),
route:
anyNamed
(
'route'
),
)).
thenAnswer
((
Invocation
invocation
)
async
{
return
0
;
});
flutterDevice
.
generator
=
residentCompiler
;
expect
(
await
residentRunner
.
run
(),
1
);
// Completing this future ensures that the daemon can exit correctly.
...
...
@@ -330,19 +252,14 @@ void main() {
fakeVmServiceHost
=
FakeVmServiceHost
(
requests:
<
VmServiceExpectation
>[]);
residentRunner
=
ColdRunner
(
<
FlutterDevice
>[
mockF
lutterDevice
,
f
lutterDevice
,
],
stayResident:
false
,
debuggingOptions:
DebuggingOptions
.
enabled
(
BuildInfo
.
release
),
target:
'main.dart'
,
devtoolsHandler:
createNoOpHandler
,
);
when
(
mockFlutterDevice
.
runCold
(
coldRunner:
anyNamed
(
'coldRunner'
),
route:
anyNamed
(
'route'
),
)).
thenAnswer
((
Invocation
invocation
)
async
{
return
1
;
});
flutterDevice
.
runColdCode
=
1
;
expect
(
await
residentRunner
.
run
(),
1
);
// Completing this future ensures that the daemon can exit correctly.
...
...
@@ -356,19 +273,15 @@ void main() {
fakeVmServiceHost
=
FakeVmServiceHost
(
requests:
<
VmServiceExpectation
>[]);
residentRunner
=
ColdRunner
(
<
FlutterDevice
>[
mockF
lutterDevice
,
f
lutterDevice
,
],
stayResident:
false
,
debuggingOptions:
DebuggingOptions
.
enabled
(
BuildInfo
.
release
),
target:
'main.dart'
,
devtoolsHandler:
createNoOpHandler
,
);
when
(
mockFlutterDevice
.
runCold
(
coldRunner:
anyNamed
(
'coldRunner'
),
route:
anyNamed
(
'route'
),
)).
thenAnswer
((
Invocation
invocation
)
async
{
throw
Exception
(
'BAD STUFF'
);
});
flutterDevice
.
runColdError
=
Exception
(
'BAD STUFF'
);
expect
(
await
residentRunner
.
run
(),
1
);
// Completing this future ensures that the daemon can exit correctly.
...
...
@@ -383,10 +296,11 @@ void main() {
listViews
,
setAssetBundlePath
,
]);
final
MockResidentCompiler
residentCompiler
=
MockResidentCompiler
();
final
FakeResidentCompiler
residentCompiler
=
FakeResidentCompiler
()
..
nextOutput
=
const
CompilerOutput
(
'foo'
,
0
,<
Uri
>[]);
residentRunner
=
HotRunner
(
<
FlutterDevice
>[
mockF
lutterDevice
,
f
lutterDevice
,
],
applicationBinary:
globals
.
fs
.
file
(
'app.apk'
),
stayResident:
false
,
...
...
@@ -394,35 +308,10 @@ void main() {
target:
'main.dart'
,
devtoolsHandler:
createNoOpHandler
,
);
when
(
mockFlutterDevice
.
generator
).
thenReturn
(
residentCompiler
);
when
(
residentCompiler
.
recompile
(
any
,
any
,
outputPath:
anyNamed
(
'outputPath'
),
packageConfig:
anyNamed
(
'packageConfig'
),
projectRootPath:
anyNamed
(
'projectRootPath'
),
fs:
anyNamed
(
'fs'
),
suppressErrors:
false
,
)).
thenAnswer
((
Invocation
invocation
)
async
{
return
const
CompilerOutput
(
'foo'
,
0
,
<
Uri
>[]);
});
when
(
mockFlutterDevice
.
runHot
(
hotRunner:
anyNamed
(
'hotRunner'
),
route:
anyNamed
(
'route'
),
)).
thenAnswer
((
Invocation
invocation
)
async
{
return
0
;
});
flutterDevice
.
generator
=
residentCompiler
;
expect
(
await
residentRunner
.
run
(
enableDevTools:
true
),
0
);
verify
(
residentCompiler
.
recompile
(
any
,
any
,
outputPath:
anyNamed
(
'outputPath'
),
packageConfig:
anyNamed
(
'packageConfig'
),
suppressErrors:
false
,
projectRootPath:
anyNamed
(
'projectRootPath'
),
fs:
anyNamed
(
'fs'
),
)).
called
(
1
);
expect
(
residentCompiler
.
didSuppressErrors
,
false
);
expect
(
fakeVmServiceHost
.
hasRemainingExpectations
,
false
);
}));
...
...
@@ -468,7 +357,7 @@ void main() {
]);
residentRunner
=
HotRunner
(
<
FlutterDevice
>[
mockF
lutterDevice
,
f
lutterDevice
,
],
stayResident:
false
,
debuggingOptions:
DebuggingOptions
.
enabled
(
...
...
@@ -489,9 +378,6 @@ void main() {
final
Future
<
DebugConnectionInfo
>
connectionInfo
=
futureConnectionInfo
.
future
;
expect
(
await
result
,
0
);
verify
(
mockFlutterDevice
.
initLogReader
()).
called
(
1
);
expect
(
futureConnectionInfo
.
isCompleted
,
true
);
expect
((
await
connectionInfo
).
baseUri
,
'foo://bar'
);
expect
(
futureAppStart
.
isCompleted
,
true
);
...
...
@@ -513,20 +399,7 @@ void main() {
enableDevTools:
true
,
));
await
futureAppStart
.
future
;
when
(
mockFlutterDevice
.
updateDevFS
(
mainUri:
anyNamed
(
'mainUri'
),
target:
anyNamed
(
'target'
),
bundle:
anyNamed
(
'bundle'
),
firstBuildTime:
anyNamed
(
'firstBuildTime'
),
bundleFirstUpload:
anyNamed
(
'bundleFirstUpload'
),
bundleDirty:
anyNamed
(
'bundleDirty'
),
fullRestart:
anyNamed
(
'fullRestart'
),
projectRootPath:
anyNamed
(
'projectRootPath'
),
pathToReload:
anyNamed
(
'pathToReload'
),
invalidatedFiles:
anyNamed
(
'invalidatedFiles'
),
dillOutputPath:
anyNamed
(
'dillOutputPath'
),
packageConfig:
anyNamed
(
'packageConfig'
),
)).
thenThrow
(
vm_service
.
RPCError
(
'something bad happened'
,
666
,
''
));
flutterDevice
.
reportError
=
vm_service
.
RPCError
(
'something bad happened'
,
666
,
''
);
final
OperationResult
result
=
await
residentRunner
.
restart
(
fullRestart:
false
);
expect
(
result
.
fatal
,
true
);
...
...
@@ -557,7 +430,7 @@ void main() {
connectionInfoCompleter:
futureConnectionInfo
,
));
await
futureAppStart
.
future
;
when
(
mockFlutterDevice
.
devFS
).
thenReturn
(
null
)
;
flutterDevice
.
_devFS
=
null
;
final
OperationResult
result
=
await
residentRunner
.
restart
(
fullRestart:
false
);
expect
(
result
.
fatal
,
false
);
...
...
@@ -581,20 +454,7 @@ void main() {
enableDevTools:
true
,
));
await
futureAppStart
.
future
;
when
(
mockFlutterDevice
.
updateDevFS
(
mainUri:
anyNamed
(
'mainUri'
),
target:
anyNamed
(
'target'
),
bundle:
anyNamed
(
'bundle'
),
firstBuildTime:
anyNamed
(
'firstBuildTime'
),
bundleFirstUpload:
anyNamed
(
'bundleFirstUpload'
),
bundleDirty:
anyNamed
(
'bundleDirty'
),
fullRestart:
anyNamed
(
'fullRestart'
),
projectRootPath:
anyNamed
(
'projectRootPath'
),
pathToReload:
anyNamed
(
'pathToReload'
),
invalidatedFiles:
anyNamed
(
'invalidatedFiles'
),
dillOutputPath:
anyNamed
(
'dillOutputPath'
),
packageConfig:
anyNamed
(
'packageConfig'
),
)).
thenThrow
(
vm_service
.
RPCError
(
'something bad happened'
,
kIsolateReloadBarred
,
''
));
flutterDevice
.
reportError
=
vm_service
.
RPCError
(
'something bad happened'
,
kIsolateReloadBarred
,
''
);
final
OperationResult
result
=
await
residentRunner
.
restart
(
fullRestart:
false
);
expect
(
result
.
fatal
,
true
);
...
...
@@ -623,7 +483,7 @@ void main() {
]);
residentRunner
=
HotRunner
(
<
FlutterDevice
>[
mockF
lutterDevice
,
f
lutterDevice
,
],
stayResident:
false
,
target:
'main.dart'
,
...
...
@@ -642,20 +502,7 @@ void main() {
enableDevTools:
true
,
));
await
futureAppStart
.
future
;
when
(
mockFlutterDevice
.
updateDevFS
(
mainUri:
anyNamed
(
'mainUri'
),
target:
anyNamed
(
'target'
),
bundle:
anyNamed
(
'bundle'
),
firstBuildTime:
anyNamed
(
'firstBuildTime'
),
bundleFirstUpload:
anyNamed
(
'bundleFirstUpload'
),
bundleDirty:
anyNamed
(
'bundleDirty'
),
fullRestart:
anyNamed
(
'fullRestart'
),
projectRootPath:
anyNamed
(
'projectRootPath'
),
pathToReload:
anyNamed
(
'pathToReload'
),
invalidatedFiles:
anyNamed
(
'invalidatedFiles'
),
dillOutputPath:
anyNamed
(
'dillOutputPath'
),
packageConfig:
anyNamed
(
'packageConfig'
),
)).
thenThrow
(
vm_service
.
RPCError
(
'something bad happened'
,
666
,
''
));
flutterDevice
.
reportError
=
vm_service
.
RPCError
(
'something bad happened'
,
666
,
''
);
final
OperationResult
result
=
await
residentRunner
.
restart
(
fullRestart:
false
);
expect
(
result
.
fatal
,
true
);
...
...
@@ -696,7 +543,7 @@ void main() {
]);
residentRunner
=
HotRunner
(
<
FlutterDevice
>[
mockF
lutterDevice
,
f
lutterDevice
,
],
stayResident:
false
,
debuggingOptions:
DebuggingOptions
.
enabled
(
BuildInfo
.
debug
),
...
...
@@ -711,22 +558,7 @@ void main() {
enableDevTools:
true
,
));
await
futureAppStart
.
future
;
when
(
mockFlutterDevice
.
updateDevFS
(
mainUri:
anyNamed
(
'mainUri'
),
target:
anyNamed
(
'target'
),
bundle:
anyNamed
(
'bundle'
),
firstBuildTime:
anyNamed
(
'firstBuildTime'
),
bundleFirstUpload:
anyNamed
(
'bundleFirstUpload'
),
bundleDirty:
anyNamed
(
'bundleDirty'
),
fullRestart:
anyNamed
(
'fullRestart'
),
projectRootPath:
anyNamed
(
'projectRootPath'
),
pathToReload:
anyNamed
(
'pathToReload'
),
invalidatedFiles:
anyNamed
(
'invalidatedFiles'
),
dillOutputPath:
anyNamed
(
'dillOutputPath'
),
packageConfig:
anyNamed
(
'packageConfig'
),
)).
thenAnswer
((
Invocation
_
)
async
{
return
UpdateFSReport
(
success:
true
,
invalidatedSourcesCount:
0
);
});
flutterDevice
.
report
=
UpdateFSReport
(
success:
true
,
invalidatedSourcesCount:
0
);
final
OperationResult
result
=
await
residentRunner
.
restart
(
fullRestart:
false
);
...
...
@@ -785,22 +617,7 @@ void main() {
enableDevTools:
true
,
));
await
futureAppStart
.
future
;
when
(
mockFlutterDevice
.
updateDevFS
(
mainUri:
anyNamed
(
'mainUri'
),
target:
anyNamed
(
'target'
),
bundle:
anyNamed
(
'bundle'
),
firstBuildTime:
anyNamed
(
'firstBuildTime'
),
bundleFirstUpload:
anyNamed
(
'bundleFirstUpload'
),
bundleDirty:
anyNamed
(
'bundleDirty'
),
fullRestart:
anyNamed
(
'fullRestart'
),
projectRootPath:
anyNamed
(
'projectRootPath'
),
pathToReload:
anyNamed
(
'pathToReload'
),
invalidatedFiles:
anyNamed
(
'invalidatedFiles'
),
dillOutputPath:
anyNamed
(
'dillOutputPath'
),
packageConfig:
anyNamed
(
'packageConfig'
),
)).
thenAnswer
((
Invocation
invocation
)
async
{
return
UpdateFSReport
(
success:
true
,
invalidatedSourcesCount:
1
);
});
flutterDevice
.
report
=
UpdateFSReport
(
success:
true
,
invalidatedSourcesCount:
1
);
final
OperationResult
result
=
await
residentRunner
.
restart
(
fullRestart:
false
);
...
...
@@ -865,29 +682,14 @@ void main() {
enableDevTools:
true
,
));
await
futureAppStart
.
future
;
when
(
mockFlutterDevice
.
updateDevFS
(
mainUri:
anyNamed
(
'mainUri'
),
target:
anyNamed
(
'target'
),
bundle:
anyNamed
(
'bundle'
),
firstBuildTime:
anyNamed
(
'firstBuildTime'
),
bundleFirstUpload:
anyNamed
(
'bundleFirstUpload'
),
bundleDirty:
anyNamed
(
'bundleDirty'
),
fullRestart:
anyNamed
(
'fullRestart'
),
projectRootPath:
anyNamed
(
'projectRootPath'
),
pathToReload:
anyNamed
(
'pathToReload'
),
invalidatedFiles:
anyNamed
(
'invalidatedFiles'
),
dillOutputPath:
anyNamed
(
'dillOutputPath'
),
packageConfig:
anyNamed
(
'packageConfig'
),
)).
thenAnswer
((
Invocation
invocation
)
async
{
return
UpdateFSReport
(
success:
true
,
invalidatedSourcesCount:
1
);
});
flutterDevice
.
report
=
UpdateFSReport
(
success:
true
,
invalidatedSourcesCount:
1
);
final
OperationResult
result
=
await
residentRunner
.
restart
(
fullRestart:
false
);
expect
(
result
.
fatal
,
false
);
expect
(
result
.
message
,
contains
(
'Reload rejected: Failed to hot reload'
));
// contains error message from reload report.
expect
(
result
.
code
,
1
);
expect
(
mockD
evFS
.
lastCompiled
,
null
);
expect
(
d
evFS
.
lastCompiled
,
null
);
}));
testUsingContext
(
'ResidentRunner can send target platform to analytics from hot reload'
,
()
=>
testbed
.
run
(()
async
{
...
...
@@ -998,11 +800,11 @@ void main() {
},
),
]);
final
Fake
FlutterDevice
flutterDevice
=
Fak
eFlutterDevice
(
mockD
evice
,
final
Fake
DelegateFlutterDevice
flutterDevice
=
FakeDelegat
eFlutterDevice
(
d
evice
,
BuildInfo
.
debug
,
FakeResidentCompiler
(),
mockD
evFS
,
d
evFS
,
)..
vmService
=
fakeVmServiceHost
.
vmService
;
residentRunner
=
HotRunner
(
<
FlutterDevice
>[
...
...
@@ -1013,7 +815,7 @@ void main() {
target:
'main.dart'
,
devtoolsHandler:
createNoOpHandler
,
);
mockD
evFS
.
nextUpdateReport
=
UpdateFSReport
(
d
evFS
.
nextUpdateReport
=
UpdateFSReport
(
success:
true
,
fastReassembleClassName:
'FOO'
,
invalidatedSourcesCount:
1
,
...
...
@@ -1310,20 +1112,7 @@ void main() {
enableDevTools:
true
,
));
await
futureAppStart
.
future
;
when
(
mockFlutterDevice
.
updateDevFS
(
mainUri:
anyNamed
(
'mainUri'
),
target:
anyNamed
(
'target'
),
bundle:
anyNamed
(
'bundle'
),
firstBuildTime:
anyNamed
(
'firstBuildTime'
),
bundleFirstUpload:
anyNamed
(
'bundleFirstUpload'
),
bundleDirty:
anyNamed
(
'bundleDirty'
),
fullRestart:
anyNamed
(
'fullRestart'
),
projectRootPath:
anyNamed
(
'projectRootPath'
),
pathToReload:
anyNamed
(
'pathToReload'
),
invalidatedFiles:
anyNamed
(
'invalidatedFiles'
),
dillOutputPath:
anyNamed
(
'dillOutputPath'
),
packageConfig:
anyNamed
(
'packageConfig'
),
)).
thenThrow
(
vm_service
.
RPCError
(
'something bad happened'
,
666
,
''
));
flutterDevice
.
reportError
=
vm_service
.
RPCError
(
'something bad happened'
,
666
,
''
);
final
OperationResult
result
=
await
residentRunner
.
restart
(
fullRestart:
true
);
expect
(
result
.
fatal
,
true
);
...
...
@@ -1348,7 +1137,7 @@ void main() {
final
ResidentRunner
otherRunner
=
HotRunner
(
<
FlutterDevice
>[
mockF
lutterDevice
,
f
lutterDevice
,
],
stayResident:
false
,
debuggingOptions:
DebuggingOptions
.
enabled
(
BuildInfo
.
debug
),
...
...
@@ -1510,7 +1299,7 @@ void main() {
fakeVmServiceHost
=
null
;
residentRunner
=
ColdRunner
(
<
FlutterDevice
>[
mockF
lutterDevice
,
f
lutterDevice
,
],
stayResident:
false
,
debuggingOptions:
DebuggingOptions
.
disabled
(
BuildInfo
.
release
),
...
...
@@ -1545,7 +1334,7 @@ void main() {
fakeVmServiceHost
=
null
;
residentRunner
=
ColdRunner
(
<
FlutterDevice
>[
mockF
lutterDevice
,
f
lutterDevice
,
],
stayResident:
false
,
debuggingOptions:
DebuggingOptions
.
disabled
(
BuildInfo
.
release
),
...
...
@@ -1635,19 +1424,13 @@ void main() {
]);
residentRunner
=
ColdRunner
(
<
FlutterDevice
>[
mockF
lutterDevice
,
f
lutterDevice
,
],
stayResident:
false
,
debuggingOptions:
DebuggingOptions
.
enabled
(
BuildInfo
.
profile
,
vmserviceOutFile:
'foo'
),
target:
'main.dart'
,
devtoolsHandler:
createNoOpHandler
,
);
when
(
mockFlutterDevice
.
runCold
(
coldRunner:
anyNamed
(
'coldRunner'
),
route:
anyNamed
(
'route'
),
)).
thenAnswer
((
Invocation
invocation
)
async
{
return
0
;
});
final
Future
<
int
>
result
=
residentRunner
.
attach
(
enableDevTools:
false
);
expect
(
await
result
,
0
);
...
...
@@ -1655,25 +1438,25 @@ void main() {
testUsingContext
(
'FlutterDevice can exit from a release mode isolate with no VmService'
,
()
=>
testbed
.
run
(()
async
{
final
TestFlutterDevice
flutterDevice
=
TestFlutterDevice
(
mockD
evice
,
d
evice
,
);
await
flutterDevice
.
exitApps
();
expect
(
mockD
evice
.
appStopped
,
true
);
expect
(
d
evice
.
appStopped
,
true
);
}));
testUsingContext
(
'FlutterDevice will exit an un-paused isolate using stopApp'
,
()
=>
testbed
.
run
(()
async
{
fakeVmServiceHost
=
FakeVmServiceHost
(
requests:
<
VmServiceExpectation
>[]);
final
TestFlutterDevice
flutterDevice
=
TestFlutterDevice
(
mockD
evice
,
d
evice
,
);
flutterDevice
.
vmService
=
fakeVmServiceHost
.
vmService
;
final
Future
<
void
>
exitFuture
=
flutterDevice
.
exitApps
();
await
expectLater
(
exitFuture
,
completes
);
expect
(
mockD
evice
.
appStopped
,
true
);
expect
(
d
evice
.
appStopped
,
true
);
expect
(
fakeVmServiceHost
.
hasRemainingExpectations
,
false
);
}));
...
...
@@ -1686,19 +1469,14 @@ void main() {
globals
.
fs
.
file
(
globals
.
fs
.
path
.
join
(
'lib'
,
'main.dart'
)).
createSync
(
recursive:
true
);
residentRunner
=
HotRunner
(
<
FlutterDevice
>[
mockF
lutterDevice
,
f
lutterDevice
,
],
stayResident:
false
,
debuggingOptions:
DebuggingOptions
.
enabled
(
BuildInfo
.
debug
,
vmserviceOutFile:
'foo'
),
target:
'main.dart'
,
devtoolsHandler:
createNoOpHandler
,
);
when
(
mockFlutterDevice
.
runHot
(
hotRunner:
anyNamed
(
'hotRunner'
),
route:
anyNamed
(
'route'
),
)).
thenAnswer
((
Invocation
invocation
)
async
{
return
0
;
});
await
residentRunner
.
run
(
enableDevTools:
true
);
expect
(
fakeVmServiceHost
.
hasRemainingExpectations
,
false
);
...
...
@@ -1714,7 +1492,7 @@ void main() {
globals
.
fs
.
file
(
globals
.
fs
.
path
.
join
(
'lib'
,
'main.dart'
)).
createSync
(
recursive:
true
);
residentRunner
=
HotRunner
(
<
FlutterDevice
>[
mockF
lutterDevice
,
f
lutterDevice
,
],
stayResident:
false
,
debuggingOptions:
DebuggingOptions
.
enabled
(
BuildInfo
.
debug
),
...
...
@@ -1722,12 +1500,7 @@ void main() {
devtoolsHandler:
createNoOpHandler
,
);
residentRunner
.
artifactDirectory
.
childFile
(
'app.dill'
).
writeAsStringSync
(
'ABC'
);
when
(
mockFlutterDevice
.
runHot
(
hotRunner:
anyNamed
(
'hotRunner'
),
route:
anyNamed
(
'route'
),
)).
thenAnswer
((
Invocation
invocation
)
async
{
return
0
;
});
await
residentRunner
.
run
(
enableDevTools:
true
);
expect
(
await
globals
.
fs
.
file
(
globals
.
fs
.
path
.
join
(
'build'
,
'cache.dill'
)).
readAsString
(),
'ABC'
);
...
...
@@ -1742,7 +1515,7 @@ void main() {
globals
.
fs
.
file
(
globals
.
fs
.
path
.
join
(
'lib'
,
'main.dart'
)).
createSync
(
recursive:
true
);
residentRunner
=
HotRunner
(
<
FlutterDevice
>[
mockF
lutterDevice
,
f
lutterDevice
,
],
stayResident:
false
,
debuggingOptions:
DebuggingOptions
.
enabled
(
...
...
@@ -1757,12 +1530,7 @@ void main() {
devtoolsHandler:
createNoOpHandler
,
);
residentRunner
.
artifactDirectory
.
childFile
(
'app.dill'
).
writeAsStringSync
(
'ABC'
);
when
(
mockFlutterDevice
.
runHot
(
hotRunner:
anyNamed
(
'hotRunner'
),
route:
anyNamed
(
'route'
),
)).
thenAnswer
((
Invocation
invocation
)
async
{
return
0
;
});
await
residentRunner
.
run
(
enableDevTools:
true
);
expect
(
await
globals
.
fs
.
file
(
globals
.
fs
.
path
.
join
(
...
...
@@ -1778,7 +1546,7 @@ void main() {
globals
.
fs
.
file
(
globals
.
fs
.
path
.
join
(
'lib'
,
'main.dart'
)).
createSync
(
recursive:
true
);
residentRunner
=
HotRunner
(
<
FlutterDevice
>[
mockF
lutterDevice
,
f
lutterDevice
,
],
stayResident:
false
,
debuggingOptions:
DebuggingOptions
.
enabled
(
...
...
@@ -1793,12 +1561,7 @@ void main() {
devtoolsHandler:
createNoOpHandler
,
);
residentRunner
.
artifactDirectory
.
childFile
(
'app.dill'
).
writeAsStringSync
(
'ABC'
);
when
(
mockFlutterDevice
.
runHot
(
hotRunner:
anyNamed
(
'hotRunner'
),
route:
anyNamed
(
'route'
),
)).
thenAnswer
((
Invocation
invocation
)
async
{
return
0
;
});
await
residentRunner
.
run
(
enableDevTools:
true
);
expect
(
await
globals
.
fs
.
file
(
globals
.
fs
.
path
.
join
(
...
...
@@ -1814,7 +1577,7 @@ void main() {
globals
.
fs
.
file
(
globals
.
fs
.
path
.
join
(
'lib'
,
'main.dart'
)).
createSync
(
recursive:
true
);
residentRunner
=
HotRunner
(
<
FlutterDevice
>[
mockF
lutterDevice
,
f
lutterDevice
,
],
stayResident:
false
,
dillOutputPath:
'test'
,
...
...
@@ -1823,12 +1586,7 @@ void main() {
devtoolsHandler:
createNoOpHandler
,
);
residentRunner
.
artifactDirectory
.
childFile
(
'app.dill'
).
writeAsStringSync
(
'ABC'
);
when
(
mockFlutterDevice
.
runHot
(
hotRunner:
anyNamed
(
'hotRunner'
),
route:
anyNamed
(
'route'
),
)).
thenAnswer
((
Invocation
invocation
)
async
{
return
0
;
});
await
residentRunner
.
run
(
enableDevTools:
true
);
expect
(
globals
.
fs
.
file
(
globals
.
fs
.
path
.
join
(
'build'
,
'cache.dill'
)),
isNot
(
exists
));
...
...
@@ -1843,7 +1601,7 @@ void main() {
globals
.
fs
.
file
(
globals
.
fs
.
path
.
join
(
'lib'
,
'main.dart'
)).
createSync
(
recursive:
true
);
residentRunner
=
HotRunner
(
<
FlutterDevice
>[
mockF
lutterDevice
,
f
lutterDevice
,
],
stayResident:
false
,
debuggingOptions:
DebuggingOptions
.
enabled
(
const
BuildInfo
(
...
...
@@ -1856,12 +1614,7 @@ void main() {
devtoolsHandler:
createNoOpHandler
,
);
residentRunner
.
artifactDirectory
.
childFile
(
'app.dill'
).
writeAsStringSync
(
'ABC'
);
when
(
mockFlutterDevice
.
runHot
(
hotRunner:
anyNamed
(
'hotRunner'
),
route:
anyNamed
(
'route'
),
)).
thenAnswer
((
Invocation
invocation
)
async
{
return
0
;
});
await
residentRunner
.
run
(
enableDevTools:
true
);
expect
(
await
globals
.
fs
.
file
(
globals
.
fs
.
path
.
join
(
'build'
,
'cache.dill.track.dill'
)).
readAsString
(),
'ABC'
);
...
...
@@ -1876,22 +1629,16 @@ void main() {
globals
.
fs
.
file
(
globals
.
fs
.
path
.
join
(
'lib'
,
'main.dart'
)).
createSync
(
recursive:
true
);
residentRunner
=
HotRunner
(
<
FlutterDevice
>[
mockF
lutterDevice
,
f
lutterDevice
,
],
stayResident:
false
,
debuggingOptions:
DebuggingOptions
.
enabled
(
BuildInfo
.
debug
),
target:
'main.dart'
,
devtoolsHandler:
createNoOpHandler
,
);
when
(
mockFlutterDevice
.
runHot
(
hotRunner:
anyNamed
(
'hotRunner'
),
route:
anyNamed
(
'route'
),
)).
thenAnswer
((
Invocation
invocation
)
async
{
return
0
;
});
await
residentRunner
.
run
();
expect
(
mockD
evice
.
disposed
,
true
);
expect
(
d
evice
.
disposed
,
true
);
}));
testUsingContext
(
'HotRunner handles failure to write vmservice file'
,
()
=>
testbed
.
run
(()
async
{
...
...
@@ -1903,19 +1650,14 @@ void main() {
globals
.
fs
.
file
(
globals
.
fs
.
path
.
join
(
'lib'
,
'main.dart'
)).
createSync
(
recursive:
true
);
residentRunner
=
HotRunner
(
<
FlutterDevice
>[
mockF
lutterDevice
,
f
lutterDevice
,
],
stayResident:
false
,
debuggingOptions:
DebuggingOptions
.
enabled
(
BuildInfo
.
debug
,
vmserviceOutFile:
'foo'
),
target:
'main.dart'
,
devtoolsHandler:
createNoOpHandler
,
);
when
(
mockFlutterDevice
.
runHot
(
hotRunner:
anyNamed
(
'hotRunner'
),
route:
anyNamed
(
'route'
),
)).
thenAnswer
((
Invocation
invocation
)
async
{
return
0
;
});
await
residentRunner
.
run
(
enableDevTools:
true
);
expect
(
testLogger
.
errorText
,
contains
(
'Failed to write vmservice-out-file at foo'
));
...
...
@@ -1931,19 +1673,14 @@ void main() {
globals
.
fs
.
file
(
globals
.
fs
.
path
.
join
(
'lib'
,
'main.dart'
)).
createSync
(
recursive:
true
);
residentRunner
=
ColdRunner
(
<
FlutterDevice
>[
mockF
lutterDevice
,
f
lutterDevice
,
],
stayResident:
false
,
debuggingOptions:
DebuggingOptions
.
enabled
(
BuildInfo
.
profile
,
vmserviceOutFile:
'foo'
),
target:
'main.dart'
,
devtoolsHandler:
createNoOpHandler
,
);
when
(
mockFlutterDevice
.
runCold
(
coldRunner:
anyNamed
(
'coldRunner'
),
route:
anyNamed
(
'route'
),
)).
thenAnswer
((
Invocation
invocation
)
async
{
return
0
;
});
await
residentRunner
.
run
(
enableDevTools:
true
);
expect
(
await
globals
.
fs
.
file
(
'foo'
).
readAsString
(),
testUri
.
toString
());
...
...
@@ -1952,9 +1689,9 @@ void main() {
testUsingContext
(
'FlutterDevice uses dartdevc configuration when targeting web'
,
()
async
{
fakeVmServiceHost
=
FakeVmServiceHost
(
requests:
<
VmServiceExpectation
>[]);
final
FakeDevice
mockD
evice
=
FakeDevice
(
targetPlatform:
TargetPlatform
.
web_javascript
);
final
FakeDevice
d
evice
=
FakeDevice
(
targetPlatform:
TargetPlatform
.
web_javascript
);
final
DefaultResidentCompiler
residentCompiler
=
(
await
FlutterDevice
.
create
(
mockD
evice
,
d
evice
,
buildInfo:
const
BuildInfo
(
BuildMode
.
debug
,
''
,
...
...
@@ -1982,10 +1719,10 @@ void main() {
testUsingContext
(
'FlutterDevice uses dartdevc configuration when targeting web with null-safety autodetected'
,
()
async
{
fakeVmServiceHost
=
FakeVmServiceHost
(
requests:
<
VmServiceExpectation
>[]);
final
FakeDevice
mockD
evice
=
FakeDevice
(
targetPlatform:
TargetPlatform
.
web_javascript
);
final
FakeDevice
d
evice
=
FakeDevice
(
targetPlatform:
TargetPlatform
.
web_javascript
);
final
DefaultResidentCompiler
residentCompiler
=
(
await
FlutterDevice
.
create
(
mockD
evice
,
d
evice
,
buildInfo:
const
BuildInfo
(
BuildMode
.
debug
,
''
,
...
...
@@ -2013,10 +1750,10 @@ void main() {
testUsingContext
(
'FlutterDevice passes flutter-widget-cache flag when feature is enabled'
,
()
async
{
fakeVmServiceHost
=
FakeVmServiceHost
(
requests:
<
VmServiceExpectation
>[]);
final
FakeDevice
mockD
evice
=
FakeDevice
(
targetPlatform:
TargetPlatform
.
android_arm
);
final
FakeDevice
d
evice
=
FakeDevice
(
targetPlatform:
TargetPlatform
.
android_arm
);
final
DefaultResidentCompiler
residentCompiler
=
(
await
FlutterDevice
.
create
(
mockD
evice
,
d
evice
,
buildInfo:
const
BuildInfo
(
BuildMode
.
debug
,
''
,
...
...
@@ -2037,11 +1774,11 @@ void main() {
testUsingContext
(
'FlutterDevice passes alternative-invalidation-strategy flag'
,
()
async
{
fakeVmServiceHost
=
FakeVmServiceHost
(
requests:
<
VmServiceExpectation
>[]);
final
FakeDevice
mockD
evice
=
FakeDevice
(
targetPlatform:
TargetPlatform
.
android_arm
);
final
FakeDevice
d
evice
=
FakeDevice
(
targetPlatform:
TargetPlatform
.
android_arm
);
final
DefaultResidentCompiler
residentCompiler
=
(
await
FlutterDevice
.
create
(
mockD
evice
,
d
evice
,
buildInfo:
const
BuildInfo
(
BuildMode
.
debug
,
''
,
...
...
@@ -2061,10 +1798,10 @@ void main() {
testUsingContext
(
'FlutterDevice passes initializeFromDill parameter if specified'
,
()
async
{
fakeVmServiceHost
=
FakeVmServiceHost
(
requests:
<
VmServiceExpectation
>[]);
final
FakeDevice
mockD
evice
=
FakeDevice
(
targetPlatform:
TargetPlatform
.
android_arm
);
final
FakeDevice
d
evice
=
FakeDevice
(
targetPlatform:
TargetPlatform
.
android_arm
);
final
DefaultResidentCompiler
residentCompiler
=
(
await
FlutterDevice
.
create
(
mockD
evice
,
d
evice
,
buildInfo:
const
BuildInfo
(
BuildMode
.
debug
,
''
,
...
...
@@ -2084,7 +1821,7 @@ void main() {
testUsingContext
(
'Handle existing VM service clients DDS error'
,
()
=>
testbed
.
run
(()
async
{
fakeVmServiceHost
=
FakeVmServiceHost
(
requests:
<
VmServiceExpectation
>[]);
final
FakeDevice
mockD
evice
=
FakeDevice
()
final
FakeDevice
d
evice
=
FakeDevice
()
..
dds
=
DartDevelopmentService
();
ddsLauncherCallback
=
(
Uri
uri
,
{
bool
enableAuthCodes
,
bool
ipv6
,
Uri
serviceUri
})
{
throw
FakeDartDevelopmentServiceException
(
message:
...
...
@@ -2092,7 +1829,7 @@ void main() {
);
};
final
TestFlutterDevice
flutterDevice
=
TestFlutterDevice
(
mockD
evice
,
d
evice
,
observatoryUris:
Stream
<
Uri
>.
value
(
testUri
),
);
bool
caught
=
false
;
...
...
@@ -2126,13 +1863,13 @@ void main() {
testUsingContext
(
'Failed DDS start outputs error message'
,
()
=>
testbed
.
run
(()
async
{
// See https://github.com/flutter/flutter/issues/72385 for context.
final
FakeDevice
mockD
evice
=
FakeDevice
()
final
FakeDevice
d
evice
=
FakeDevice
()
..
dds
=
DartDevelopmentService
();
ddsLauncherCallback
=
(
Uri
uri
,
{
bool
enableAuthCodes
,
bool
ipv6
,
Uri
serviceUri
})
{
throw
FakeDartDevelopmentServiceException
(
message:
'No URI'
);
};
final
TestFlutterDevice
flutterDevice
=
TestFlutterDevice
(
mockD
evice
,
d
evice
,
observatoryUris:
Stream
<
Uri
>.
value
(
testUri
),
);
bool
caught
=
false
;
...
...
@@ -2176,7 +1913,7 @@ void main() {
testUsingContext
(
'cleanupAtFinish shuts down resident devtools handler'
,
()
=>
testbed
.
run
(()
async
{
residentRunner
=
HotRunner
(
<
FlutterDevice
>[
mockF
lutterDevice
,
f
lutterDevice
,
],
stayResident:
false
,
debuggingOptions:
DebuggingOptions
.
enabled
(
BuildInfo
.
debug
,
vmserviceOutFile:
'foo'
),
...
...
@@ -2189,9 +1926,6 @@ void main() {
}));
}
class
MockFlutterDevice
extends
Mock
implements
FlutterDevice
{}
class
MockResidentCompiler
extends
Mock
implements
ResidentCompiler
{}
class
FakeDartDevelopmentServiceException
implements
dds
.
DartDevelopmentServiceException
{
FakeDartDevelopmentServiceException
({
this
.
message
=
defaultMessage
});
...
...
@@ -2226,8 +1960,105 @@ class ThrowingForwardingFileSystem extends ForwardingFileSystem {
}
}
class
FakeFlutterDevice
extends
FlutterDevice
{
FakeFlutterDevice
(
class
FakeFlutterDevice
extends
Fake
implements
FlutterDevice
{
FakeVmServiceHost
Function
()
vmServiceHost
;
Uri
testUri
;
UpdateFSReport
report
=
UpdateFSReport
(
success:
true
,
syncedBytes:
0
,
invalidatedSourcesCount:
1
,
);
Object
reportError
;
Object
runColdError
;
int
runHotCode
=
0
;
int
runColdCode
=
0
;
@override
ResidentCompiler
generator
;
@override
Stream
<
Uri
>
get
observatoryUris
=>
Stream
<
Uri
>.
value
(
testUri
);
@override
FlutterVmService
get
vmService
=>
vmServiceHost
?.
call
()?.
vmService
;
DevFS
_devFS
;
@override
DevFS
get
devFS
=>
_devFS
;
@override
set
devFS
(
DevFS
value
)
{
}
@override
Device
device
;
@override
Future
<
void
>
stopEchoingDeviceLog
()
async
{
}
@override
Future
<
void
>
initLogReader
()
async
{
}
@override
Future
<
Uri
>
setupDevFS
(
String
fsName
,
Directory
rootDirectory
)
async
{
return
testUri
;
}
@override
Future
<
int
>
runHot
({
HotRunner
hotRunner
,
String
route
})
async
{
return
runHotCode
;
}
@override
Future
<
int
>
runCold
({
ColdRunner
coldRunner
,
String
route
})
async
{
if
(
runColdError
!=
null
)
{
throw
runColdError
;
}
return
runColdCode
;
}
@override
Future
<
void
>
connect
({
ReloadSources
reloadSources
,
Restart
restart
,
CompileExpression
compileExpression
,
GetSkSLMethod
getSkSLMethod
,
PrintStructuredErrorLogMethod
printStructuredErrorLogMethod
,
int
hostVmServicePort
,
int
ddsPort
,
bool
disableServiceAuthCodes
=
false
,
bool
enableDds
=
true
,
@required
bool
allowExistingDdsInstance
,
bool
ipv6
=
false
,
})
async
{
}
@override
Future
<
UpdateFSReport
>
updateDevFS
({
Uri
mainUri
,
String
target
,
AssetBundle
bundle
,
DateTime
firstBuildTime
,
bool
bundleFirstUpload
=
false
,
bool
bundleDirty
=
false
,
bool
fullRestart
=
false
,
String
projectRootPath
,
String
pathToReload
,
String
dillOutputPath
,
List
<
Uri
>
invalidatedFiles
,
PackageConfig
packageConfig
,
})
async
{
if
(
reportError
!=
null
)
{
throw
reportError
;
}
return
report
;
}
@override
Future
<
void
>
updateReloadStatus
(
bool
wasReloadSuccessful
)
async
{
}
}
class
FakeDelegateFlutterDevice
extends
FlutterDevice
{
FakeDelegateFlutterDevice
(
Device
device
,
BuildInfo
buildInfo
,
ResidentCompiler
residentCompiler
,
...
...
@@ -2260,6 +2091,9 @@ class FakeFlutterDevice extends FlutterDevice {
}
class
FakeResidentCompiler
extends
Fake
implements
ResidentCompiler
{
CompilerOutput
nextOutput
;
bool
didSuppressErrors
=
false
;
@override
Future
<
CompilerOutput
>
recompile
(
Uri
mainUri
,
...
...
@@ -2270,7 +2104,8 @@ class FakeResidentCompiler extends Fake implements ResidentCompiler {
@required
FileSystem
fs
,
bool
suppressErrors
=
false
,
})
async
{
return
const
CompilerOutput
(
'foo.dill'
,
0
,
<
Uri
>[]);
didSuppressErrors
=
suppressErrors
;
return
nextOutput
??
const
CompilerOutput
(
'foo.dill'
,
0
,
<
Uri
>[]);
}
@override
...
...
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