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
4a010665
Unverified
Commit
4a010665
authored
Aug 31, 2018
by
Chris Bracken
Committed by
GitHub
Aug 31, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Migrate hot reload tests to Dart 2 (#21290)
parent
4d0f09a2
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
10 deletions
+20
-10
resident_runner.dart
packages/flutter_tools/lib/src/resident_runner.dart
+2
-1
hot_test.dart
packages/flutter_tools/test/hot_test.dart
+18
-9
No files found.
packages/flutter_tools/lib/src/resident_runner.dart
View file @
4a010665
...
@@ -47,9 +47,10 @@ class FlutterDevice {
...
@@ -47,9 +47,10 @@ class FlutterDevice {
this
.
dillOutputPath
,
this
.
dillOutputPath
,
this
.
fileSystemRoots
,
this
.
fileSystemRoots
,
this
.
fileSystemScheme
,
this
.
fileSystemScheme
,
ResidentCompiler
generator
,
})
{
})
{
if
(
previewDart2
)
{
if
(
previewDart2
)
{
generator
=
new
ResidentCompiler
(
this
.
generator
=
generator
??
new
ResidentCompiler
(
artifacts
.
getArtifactPath
(
Artifact
.
flutterPatchedSdkPath
),
artifacts
.
getArtifactPath
(
Artifact
.
flutterPatchedSdkPath
),
trackWidgetCreation:
trackWidgetCreation
,
trackWidgetCreation:
trackWidgetCreation
,
fileSystemRoots:
fileSystemRoots
,
fileSystemScheme:
fileSystemScheme
fileSystemRoots:
fileSystemRoots
,
fileSystemScheme:
fileSystemScheme
...
...
packages/flutter_tools/test/hot_test.dart
View file @
4a010665
...
@@ -4,6 +4,7 @@
...
@@ -4,6 +4,7 @@
import
'dart:async'
;
import
'dart:async'
;
import
'package:flutter_tools/src/artifacts.dart'
;
import
'package:flutter_tools/src/device.dart'
;
import
'package:flutter_tools/src/device.dart'
;
import
'package:flutter_tools/src/resident_runner.dart'
;
import
'package:flutter_tools/src/resident_runner.dart'
;
import
'package:flutter_tools/src/run_hot.dart'
;
import
'package:flutter_tools/src/run_hot.dart'
;
...
@@ -12,6 +13,7 @@ import 'package:mockito/mockito.dart';
...
@@ -12,6 +13,7 @@ import 'package:mockito/mockito.dart';
import
'src/common.dart'
;
import
'src/common.dart'
;
import
'src/context.dart'
;
import
'src/context.dart'
;
import
'src/mocks.dart'
;
void
main
(
)
{
void
main
(
)
{
group
(
'validateReloadReport'
,
()
{
group
(
'validateReloadReport'
,
()
{
...
@@ -91,34 +93,41 @@ void main() {
...
@@ -91,34 +93,41 @@ void main() {
});
});
group
(
'hotRestart'
,
()
{
group
(
'hotRestart'
,
()
{
final
List
<
FlutterDevice
>
devices
=
<
FlutterDevice
>[];
final
MockResidentCompiler
residentCompiler
=
new
MockResidentCompiler
();
MockLocalEngineArtifacts
mockArtifacts
;
setUp
(()
{
setUp
(()
{
devices
.
add
(
new
FlutterDevice
(
new
MockDevice
(),
mockArtifacts
=
new
MockLocalEngineArtifacts
();
previewDart2:
false
,
trackWidgetCreation:
false
)
);
when
(
mockArtifacts
.
getArtifactPath
(
Artifact
.
flutterPatchedSdkPath
)).
thenReturn
(
'some/path'
);
});
});
testUsingContext
(
'no setup'
,
()
async
{
testUsingContext
(
'no setup'
,
()
async
{
expect
((
await
new
HotRunner
(
devices
).
restart
(
fullRestart:
true
)).
isOk
,
final
List
<
FlutterDevice
>
devices
=
<
FlutterDevice
>[
new
FlutterDevice
(
new
MockDevice
(),
generator:
residentCompiler
,
trackWidgetCreation:
false
,
previewDart2:
true
)];
true
);
expect
((
await
new
HotRunner
(
devices
).
restart
(
fullRestart:
true
)).
isOk
,
true
);
},
overrides:
<
Type
,
Generator
>{
Artifacts:
()
=>
mockArtifacts
,
});
});
testUsingContext
(
'setup function succeeds'
,
()
async
{
testUsingContext
(
'setup function succeeds'
,
()
async
{
expect
((
await
new
HotRunner
(
devices
).
restart
(
fullRestart:
true
)).
isOk
,
final
List
<
FlutterDevice
>
devices
=
<
FlutterDevice
>[
new
FlutterDevice
(
new
MockDevice
(),
generator:
residentCompiler
,
trackWidgetCreation:
false
,
previewDart2:
true
)];
true
);
expect
((
await
new
HotRunner
(
devices
).
restart
(
fullRestart:
true
)).
isOk
,
true
);
},
overrides:
<
Type
,
Generator
>{
},
overrides:
<
Type
,
Generator
>{
Artifacts:
()
=>
mockArtifacts
,
HotRunnerConfig:
()
=>
new
TestHotRunnerConfig
(
successfulSetup:
true
),
HotRunnerConfig:
()
=>
new
TestHotRunnerConfig
(
successfulSetup:
true
),
});
});
testUsingContext
(
'setup function fails'
,
()
async
{
testUsingContext
(
'setup function fails'
,
()
async
{
expect
((
await
new
HotRunner
(
devices
).
restart
(
fullRestart:
true
)).
isOk
,
final
List
<
FlutterDevice
>
devices
=
<
FlutterDevice
>[
new
FlutterDevice
(
new
MockDevice
(),
generator:
residentCompiler
,
trackWidgetCreation:
false
,
previewDart2:
true
)];
false
);
expect
((
await
new
HotRunner
(
devices
).
restart
(
fullRestart:
true
)).
isOk
,
false
);
},
overrides:
<
Type
,
Generator
>{
},
overrides:
<
Type
,
Generator
>{
Artifacts:
()
=>
mockArtifacts
,
HotRunnerConfig:
()
=>
new
TestHotRunnerConfig
(
successfulSetup:
false
),
HotRunnerConfig:
()
=>
new
TestHotRunnerConfig
(
successfulSetup:
false
),
});
});
});
});
}
}
class
MockLocalEngineArtifacts
extends
Mock
implements
LocalEngineArtifacts
{}
class
MockDevice
extends
Mock
implements
Device
{
class
MockDevice
extends
Mock
implements
Device
{
MockDevice
()
{
MockDevice
()
{
when
(
isSupported
()).
thenReturn
(
true
);
when
(
isSupported
()).
thenReturn
(
true
);
...
...
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