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
b15465fc
Unverified
Commit
b15465fc
authored
Mar 09, 2021
by
Jonah Williams
Committed by
GitHub
Mar 09, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[flutter_tools] simplify fake imports for FakeProcessManager (#77748)
parent
48f56740
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
17 deletions
+31
-17
fake_process_manager.dart
packages/flutter_tools/test/src/fake_process_manager.dart
+17
-17
test_wrapper.dart
packages/flutter_tools/test/src/test_wrapper.dart
+14
-0
No files found.
packages/flutter_tools/test/src/fake_process_manager.dart
View file @
b15465fc
...
...
@@ -6,13 +6,13 @@
import
'dart:async'
;
import
'dart:convert'
;
import
'dart:io'
as
io
show
ProcessSignal
;
import
'dart:io'
as
io
show
ProcessSignal
,
Process
,
ProcessStartMode
,
ProcessResult
,
systemEncoding
;
import
'package:f
lutter_tools/src/base/io
.dart'
;
import
'package:f
ile/file
.dart'
;
import
'package:meta/meta.dart'
;
import
'package:process/process.dart'
;
import
'common.dart'
;
import
'
context
.dart'
;
import
'
test_wrapper
.dart'
;
export
'package:process/process.dart'
show
ProcessManager
;
...
...
@@ -120,7 +120,7 @@ class FakeCommand {
}
}
class
_FakeProcess
implements
Process
{
class
_FakeProcess
implements
io
.
Process
{
_FakeProcess
(
this
.
_exitCode
,
Duration
duration
,
...
...
@@ -251,37 +251,37 @@ abstract class FakeProcessManager implements ProcessManager {
}
@override
Future
<
Process
>
start
(
Future
<
io
.
Process
>
start
(
List
<
dynamic
>
command
,
{
String
workingDirectory
,
Map
<
String
,
String
>
environment
,
bool
includeParentEnvironment
=
true
,
// ignored
bool
runInShell
=
false
,
// ignored
ProcessStartMode
mode
=
ProcessStartMode
.
normal
,
// ignored
io
.
ProcessStartMode
mode
=
io
.
ProcessStartMode
.
normal
,
// ignored
})
{
final
_FakeProcess
process
=
_runCommand
(
command
.
cast
<
String
>(),
workingDirectory
,
environment
,
systemEncoding
);
final
_FakeProcess
process
=
_runCommand
(
command
.
cast
<
String
>(),
workingDirectory
,
environment
,
io
.
systemEncoding
);
if
(
process
.
_completer
!=
null
)
{
_fakeRunningProcesses
[
process
.
pid
]
=
process
;
process
.
exitCode
.
whenComplete
(()
{
_fakeRunningProcesses
.
remove
(
process
.
pid
);
});
}
return
Future
<
Process
>.
value
(
process
);
return
Future
<
io
.
Process
>.
value
(
process
);
}
@override
Future
<
ProcessResult
>
run
(
Future
<
io
.
ProcessResult
>
run
(
List
<
dynamic
>
command
,
{
String
workingDirectory
,
Map
<
String
,
String
>
environment
,
bool
includeParentEnvironment
=
true
,
// ignored
bool
runInShell
=
false
,
// ignored
Encoding
stdoutEncoding
=
systemEncoding
,
Encoding
stderrEncoding
=
systemEncoding
,
Encoding
stdoutEncoding
=
io
.
systemEncoding
,
Encoding
stderrEncoding
=
io
.
systemEncoding
,
})
async
{
final
_FakeProcess
process
=
_runCommand
(
command
.
cast
<
String
>(),
workingDirectory
,
environment
,
stdoutEncoding
);
await
process
.
exitCode
;
return
ProcessResult
(
return
io
.
ProcessResult
(
process
.
pid
,
process
.
_exitCode
,
stdoutEncoding
==
null
?
process
.
stdout
:
await
stdoutEncoding
.
decodeStream
(
process
.
stdout
),
...
...
@@ -290,17 +290,17 @@ abstract class FakeProcessManager implements ProcessManager {
}
@override
ProcessResult
runSync
(
io
.
ProcessResult
runSync
(
List
<
dynamic
>
command
,
{
String
workingDirectory
,
Map
<
String
,
String
>
environment
,
bool
includeParentEnvironment
=
true
,
// ignored
bool
runInShell
=
false
,
// ignored
Encoding
stdoutEncoding
=
systemEncoding
,
// actual encoder is ignored
Encoding
stderrEncoding
=
systemEncoding
,
// actual encoder is ignored
Encoding
stdoutEncoding
=
io
.
systemEncoding
,
// actual encoder is ignored
Encoding
stderrEncoding
=
io
.
systemEncoding
,
// actual encoder is ignored
})
{
final
_FakeProcess
process
=
_runCommand
(
command
.
cast
<
String
>(),
workingDirectory
,
environment
,
stdoutEncoding
);
return
ProcessResult
(
return
io
.
ProcessResult
(
process
.
pid
,
process
.
_exitCode
,
stdoutEncoding
==
null
?
utf8
.
encode
(
process
.
_stdout
)
:
process
.
_stdout
,
...
...
packages/flutter_tools/test/src/test_wrapper.dart
0 → 100644
View file @
b15465fc
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// @dart = 2.8
import
'package:test_api/test_api.dart'
as
test_package
show
TypeMatcher
;
// ignore: deprecated_member_use
import
'package:test_api/test_api.dart'
hide
TypeMatcher
,
isInstanceOf
;
// ignore: deprecated_member_use
// ignore: deprecated_member_use
export
'package:test_core/test_core.dart'
hide
TypeMatcher
,
isInstanceOf
,
test
;
// Defines a 'package:test' shim.
/// A matcher that compares the type of the actual value to the type argument T.
// TODO(ianh): Remove this once https://github.com/dart-lang/matcher/issues/98 is fixed
test_package
.
TypeMatcher
<
T
>
isInstanceOf
<
T
>()
=>
isA
<
T
>();
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