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
4d0f09a2
Unverified
Commit
4d0f09a2
authored
Aug 31, 2018
by
Chris Bracken
Committed by
GitHub
Aug 31, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Migrate Flutter Tester tests to Dart 2 (#21292)
parent
c1beb15f
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
3 deletions
+36
-3
flutter_tester_test.dart
packages/flutter_tools/test/tester/flutter_tester_test.dart
+36
-3
No files found.
packages/flutter_tools/test/tester/flutter_tester_test.dart
View file @
4d0f09a2
...
...
@@ -6,11 +6,14 @@ import 'dart:async';
import
'package:file/file.dart'
;
import
'package:file/memory.dart'
;
import
'package:flutter_tools/src/artifacts.dart'
;
import
'package:flutter_tools/src/base/platform.dart'
;
import
'package:flutter_tools/src/build_info.dart'
;
import
'package:flutter_tools/src/cache.dart'
;
import
'package:flutter_tools/src/compile.dart'
;
import
'package:flutter_tools/src/device.dart'
;
import
'package:flutter_tools/src/tester/flutter_tester.dart'
;
import
'package:mockito/mockito.dart'
;
import
'package:process/process.dart'
;
import
'../src/common.dart'
;
...
...
@@ -96,6 +99,8 @@ void main() {
String
projectPath
;
String
mainPath
;
MockArtifacts
mockArtifacts
;
MockKernelCompiler
mockKernelCompiler
;
MockProcessManager
mockProcessManager
;
MockProcess
mockProcess
;
...
...
@@ -104,6 +109,8 @@ void main() {
FileSystem:
()
=>
fs
,
Cache:
()
=>
new
Cache
(
rootOverride:
fs
.
directory
(
flutterRoot
)),
ProcessManager:
()
=>
mockProcessManager
,
KernelCompiler:
()
=>
mockKernelCompiler
,
Artifacts:
()
=>
mockArtifacts
,
};
setUp
(()
{
...
...
@@ -121,13 +128,20 @@ void main() {
mockProcessManager
=
new
MockProcessManager
();
mockProcessManager
.
processFactory
=
(
List
<
String
>
commands
)
=>
mockProcess
;
mockArtifacts
=
new
MockArtifacts
();
final
String
artifactPath
=
fs
.
path
.
join
(
flutterRoot
,
'artifact'
);
fs
.
file
(
artifactPath
).
createSync
(
recursive:
true
);
when
(
mockArtifacts
.
getArtifactPath
(
any
)).
thenReturn
(
artifactPath
);
mockKernelCompiler
=
new
MockKernelCompiler
();
});
testUsingContext
(
'not debug'
,
()
async
{
final
LaunchResult
result
=
await
device
.
startApp
(
null
,
mainPath:
mainPath
,
debuggingOptions:
new
DebuggingOptions
.
disabled
(
const
BuildInfo
(
BuildMode
.
release
,
null
)));
const
BuildInfo
(
BuildMode
.
release
,
null
,
previewDart2:
true
)));
expect
(
result
.
started
,
isFalse
);
},
overrides:
startOverrides
);
...
...
@@ -137,7 +151,7 @@ void main() {
await
device
.
startApp
(
null
,
mainPath:
mainPath
,
debuggingOptions:
new
DebuggingOptions
.
disabled
(
const
BuildInfo
(
BuildMode
.
debug
,
null
)));
const
BuildInfo
(
BuildMode
.
debug
,
null
,
previewDart2:
true
)));
},
throwsToolExit
());
},
overrides:
startOverrides
);
...
...
@@ -152,10 +166,26 @@ Hello!
.
codeUnits
]));
when
(
mockKernelCompiler
.
compile
(
sdkRoot:
anyNamed
(
'sdkRoot'
),
incrementalCompilerByteStorePath:
anyNamed
(
'incrementalCompilerByteStorePath'
),
mainPath:
anyNamed
(
'mainPath'
),
outputFilePath:
anyNamed
(
'outputFilePath'
),
depFilePath:
anyNamed
(
'depFilePath'
),
trackWidgetCreation:
anyNamed
(
'trackWidgetCreation'
),
extraFrontEndOptions:
anyNamed
(
'extraFrontEndOptions'
),
fileSystemRoots:
anyNamed
(
'fileSystemRoots'
),
fileSystemScheme:
anyNamed
(
'fileSystemScheme'
),
packagesPath:
anyNamed
(
'packagesPath'
),
)).
thenAnswer
((
_
)
async
{
fs
.
file
(
'
$mainPath
.dill'
).
createSync
(
recursive:
true
);
return
new
CompilerOutput
(
'
$mainPath
.dill'
,
0
);
});
final
LaunchResult
result
=
await
device
.
startApp
(
null
,
mainPath:
mainPath
,
debuggingOptions:
new
DebuggingOptions
.
enabled
(
const
BuildInfo
(
BuildMode
.
debug
,
null
)));
const
BuildInfo
(
BuildMode
.
debug
,
null
,
previewDart2:
true
)));
expect
(
result
.
started
,
isTrue
);
expect
(
result
.
observatoryUri
,
observatoryUri
);
...
...
@@ -164,3 +194,6 @@ Hello!
});
});
}
class
MockArtifacts
extends
Mock
implements
Artifacts
{}
class
MockKernelCompiler
extends
Mock
implements
KernelCompiler
{}
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