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
1ad6edb8
Unverified
Commit
1ad6edb8
authored
Jan 27, 2021
by
Jenn Magder
Committed by
GitHub
Jan 27, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove MockProcessManager from channel_test and other tests (#74780)
parent
675fd554
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
133 additions
and
271 deletions
+133
-271
devices_test.dart
...tter_tools/test/commands.shard/hermetic/devices_test.dart
+4
-34
android_studio_validator_test.dart
.../general.shard/android/android_studio_validator_test.dart
+13
-8
channel_test.dart
packages/flutter_tools/test/general.shard/channel_test.dart
+109
-202
generate_synthetic_packages_test.dart
.../general.shard/dart/generate_synthetic_packages_test.dart
+7
-12
mocks.dart
packages/flutter_tools/test/src/mocks.dart
+0
-15
No files found.
packages/flutter_tools/test/commands.shard/hermetic/devices_test.dart
View file @
1ad6edb8
...
...
@@ -3,7 +3,6 @@
// found in the LICENSE file.
import
'dart:convert'
;
import
'dart:io'
;
import
'package:flutter_tools/src/android/android_sdk.dart'
;
import
'package:flutter_tools/src/artifacts.dart'
;
...
...
@@ -11,7 +10,6 @@ import 'package:flutter_tools/src/cache.dart';
import
'package:flutter_tools/src/commands/devices.dart'
;
import
'package:flutter_tools/src/device.dart'
;
import
'package:flutter_tools/src/globals.dart'
as
globals
;
import
'package:mockito/mockito.dart'
;
import
'package:process/process.dart'
;
import
'../../src/common.dart'
;
...
...
@@ -45,7 +43,7 @@ void main() {
},
overrides:
<
Type
,
Generator
>{
AndroidSdk:
()
=>
null
,
DeviceManager:
()
=>
NoDevicesManager
(),
ProcessManager:
()
=>
MockProcessManager
(),
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
Cache:
()
=>
cache
,
Artifacts:
()
=>
Artifacts
.
test
(),
});
...
...
@@ -57,7 +55,7 @@ void main() {
expect
(
platformTypes
,
<
String
>[
'android'
,
'web'
]);
},
overrides:
<
Type
,
Generator
>{
DeviceManager:
()
=>
_FakeDeviceManager
(),
ProcessManager:
()
=>
MockProcessManager
(),
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
Cache:
()
=>
cache
,
Artifacts:
()
=>
Artifacts
.
test
(),
});
...
...
@@ -106,7 +104,7 @@ void main() {
);
},
overrides:
<
Type
,
Generator
>{
DeviceManager:
()
=>
_FakeDeviceManager
(),
ProcessManager:
()
=>
MockProcessManager
(),
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
Cache:
()
=>
cache
,
Artifacts:
()
=>
Artifacts
.
test
(),
});
...
...
@@ -127,39 +125,11 @@ webby (mobile) • webby • web-javascript • Web SDK (1.2.4) (emulato
);
},
overrides:
<
Type
,
Generator
>{
DeviceManager:
()
=>
_FakeDeviceManager
(),
ProcessManager:
()
=>
MockProcessManager
(),
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
});
});
}
class
MockProcessManager
extends
Mock
implements
ProcessManager
{
@override
Future
<
ProcessResult
>
run
(
List
<
dynamic
>
command
,
{
String
workingDirectory
,
Map
<
String
,
String
>
environment
,
bool
includeParentEnvironment
=
true
,
bool
runInShell
=
false
,
Encoding
stdoutEncoding
=
systemEncoding
,
Encoding
stderrEncoding
=
systemEncoding
,
})
async
{
return
ProcessResult
(
0
,
0
,
''
,
''
);
}
@override
ProcessResult
runSync
(
List
<
dynamic
>
command
,
{
String
workingDirectory
,
Map
<
String
,
String
>
environment
,
bool
includeParentEnvironment
=
true
,
bool
runInShell
=
false
,
Encoding
stdoutEncoding
=
systemEncoding
,
Encoding
stderrEncoding
=
systemEncoding
,
})
{
return
ProcessResult
(
0
,
0
,
''
,
''
);
}
}
class
_FakeDeviceManager
extends
DeviceManager
{
_FakeDeviceManager
();
...
...
packages/flutter_tools/test/general.shard/android/android_studio_validator_test.dart
View file @
1ad6edb8
...
...
@@ -12,7 +12,6 @@ import 'package:flutter_tools/src/base/platform.dart';
import
'package:flutter_tools/src/base/user_messages.dart'
;
import
'package:flutter_tools/src/doctor.dart'
;
import
'package:flutter_tools/src/globals.dart'
as
globals
;
import
'package:mockito/mockito.dart'
;
import
'package:process/process.dart'
;
import
'../../src/common.dart'
;
...
...
@@ -27,9 +26,11 @@ final Platform linuxPlatform = FakePlatform(
void
main
(
)
{
FileSystem
fileSystem
;
FakeProcessManager
fakeProcessManager
;
setUp
(()
{
fileSystem
=
MemoryFileSystem
.
test
();
fakeProcessManager
=
FakeProcessManager
.
list
(<
FakeCommand
>[]);
});
testWithoutContext
(
'NoAndroidStudioValidator shows Android Studio as "not available" when not available.'
,
()
async
{
...
...
@@ -48,10 +49,15 @@ void main() {
});
testUsingContext
(
'AndroidStudioValidator gives doctor error on java crash'
,
()
async
{
when
(
globals
.
processManager
.
canRun
(
any
)).
thenReturn
(
true
);
when
(
globals
.
processManager
.
runSync
(
any
)).
thenAnswer
((
Invocation
_
)
{
throw
const
ProcessException
(
'java'
,
<
String
>[
'--version'
]);
});
fakeProcessManager
.
addCommand
(
FakeCommand
(
command:
const
<
String
>[
'/opt/android-studio-with-cheese-5.0/jre/bin/java'
,
'-version'
,
],
onRun:
()
{
throw
const
ProcessException
(
'java'
,
<
String
>[
'-version'
]);
},
));
const
String
installPath
=
'/opt/android-studio-with-cheese-5.0'
;
const
String
studioHome
=
'
$home
/.AndroidStudioWithCheese5.0'
;
const
String
homeFile
=
'
$studioHome
/system/.home'
;
...
...
@@ -68,9 +74,10 @@ void main() {
return
message
.
isError
&&
message
.
message
.
contains
(
'ProcessException'
);
}).
isNotEmpty
,
true
);
}
expect
(
fakeProcessManager
.
hasRemainingExpectations
,
isFalse
);
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
fileSystem
,
ProcessManager:
()
=>
MockProcessManager
()
,
ProcessManager:
()
=>
fakeProcessManager
,
Platform:
()
=>
linuxPlatform
,
FileSystemUtils:
()
=>
FileSystemUtils
(
fileSystem:
fileSystem
,
...
...
@@ -78,5 +85,3 @@ void main() {
),
});
}
class
MockProcessManager
extends
Mock
implements
ProcessManager
{}
packages/flutter_tools/test/general.shard/channel_test.dart
View file @
1ad6edb8
This diff is collapsed.
Click to expand it.
packages/flutter_tools/test/general.shard/dart/generate_synthetic_packages_test.dart
View file @
1ad6edb8
...
...
@@ -31,7 +31,6 @@ void main() {
// Create an l10n.yaml file
fileSystem
.
file
(
'l10n.yaml'
).
createSync
();
final
FakeProcessManager
mockProcessManager
=
FakeProcessManager
.
any
();
final
BufferLogger
mockBufferLogger
=
BufferLogger
.
test
();
final
Artifacts
artifacts
=
Artifacts
.
test
();
final
Environment
environment
=
Environment
.
test
(
...
...
@@ -39,7 +38,7 @@ void main() {
fileSystem:
fileSystem
,
logger:
mockBufferLogger
,
artifacts:
artifacts
,
processManager:
mockProcessManager
,
processManager:
FakeProcessManager
.
any
()
,
);
final
BuildSystem
buildSystem
=
MockBuildSystem
();
...
...
@@ -72,7 +71,7 @@ void main() {
// Create an l10n.yaml file
fileSystem
.
file
(
'l10n.yaml'
).
writeAsStringSync
(
'synthetic-package: true'
);
final
FakeProcessManager
mock
ProcessManager
=
FakeProcessManager
.
any
();
final
FakeProcessManager
fake
ProcessManager
=
FakeProcessManager
.
any
();
final
BufferLogger
mockBufferLogger
=
BufferLogger
.
test
();
final
Artifacts
artifacts
=
Artifacts
.
test
();
final
Environment
environment
=
Environment
.
test
(
...
...
@@ -80,7 +79,7 @@ void main() {
fileSystem:
fileSystem
,
logger:
mockBufferLogger
,
artifacts:
artifacts
,
processManager:
mock
ProcessManager
,
processManager:
fake
ProcessManager
,
);
final
BuildSystem
buildSystem
=
MockBuildSystem
();
...
...
@@ -113,14 +112,13 @@ void main() {
// Create an l10n.yaml file
fileSystem
.
file
(
'l10n.yaml'
).
writeAsStringSync
(
'synthetic-package: null'
);
final
FakeProcessManager
mockProcessManager
=
FakeProcessManager
.
any
();
final
BufferLogger
mockBufferLogger
=
BufferLogger
.
test
();
final
Environment
environment
=
Environment
.
test
(
fileSystem
.
currentDirectory
,
fileSystem:
fileSystem
,
logger:
mockBufferLogger
,
artifacts:
Artifacts
.
test
(),
processManager:
mockProcessManager
,
processManager:
FakeProcessManager
.
any
()
,
);
final
BuildSystem
buildSystem
=
MockBuildSystem
();
...
...
@@ -150,14 +148,13 @@ void main() {
);
pubspecFile
.
writeAsStringSync
(
content
);
final
FakeProcessManager
mockProcessManager
=
FakeProcessManager
.
any
();
final
BufferLogger
mockBufferLogger
=
BufferLogger
.
test
();
final
Environment
environment
=
Environment
.
test
(
fileSystem
.
currentDirectory
,
fileSystem:
fileSystem
,
logger:
mockBufferLogger
,
artifacts:
Artifacts
.
test
(),
processManager:
mockProcessManager
,
processManager:
FakeProcessManager
.
any
()
,
);
final
BuildSystem
buildSystem
=
MockBuildSystem
();
...
...
@@ -187,14 +184,13 @@ void main() {
// Create an l10n.yaml file
fileSystem
.
file
(
'l10n.yaml'
).
writeAsStringSync
(
'helloWorld'
);
final
FakeProcessManager
mockProcessManager
=
FakeProcessManager
.
any
();
final
BufferLogger
mockBufferLogger
=
BufferLogger
.
test
();
final
Environment
environment
=
Environment
.
test
(
fileSystem
.
currentDirectory
,
fileSystem:
fileSystem
,
logger:
mockBufferLogger
,
artifacts:
Artifacts
.
test
(),
processManager:
mockProcessManager
,
processManager:
FakeProcessManager
.
any
()
,
);
final
BuildSystem
buildSystem
=
MockBuildSystem
();
...
...
@@ -227,14 +223,13 @@ void main() {
// Create an l10n.yaml file
fileSystem
.
file
(
'l10n.yaml'
).
writeAsStringSync
(
'synthetic-package: nonBoolValue'
);
final
FakeProcessManager
mockProcessManager
=
FakeProcessManager
.
any
();
final
BufferLogger
mockBufferLogger
=
BufferLogger
.
test
();
final
Environment
environment
=
Environment
.
test
(
fileSystem
.
currentDirectory
,
fileSystem:
fileSystem
,
logger:
mockBufferLogger
,
artifacts:
Artifacts
.
test
(),
processManager:
mockProcessManager
,
processManager:
FakeProcessManager
.
any
()
,
);
final
BuildSystem
buildSystem
=
MockBuildSystem
();
...
...
packages/flutter_tools/test/src/mocks.dart
View file @
1ad6edb8
...
...
@@ -18,7 +18,6 @@ import 'package:flutter_tools/src/compile.dart';
import
'package:flutter_tools/src/device.dart'
;
import
'package:flutter_tools/src/globals.dart'
as
globals
;
import
'package:flutter_tools/src/ios/devices.dart'
;
import
'package:flutter_tools/src/ios/simulators.dart'
;
import
'package:flutter_tools/src/project.dart'
;
import
'package:mockito/mockito.dart'
;
import
'package:package_config/package_config.dart'
;
...
...
@@ -580,17 +579,6 @@ class MockIOSDevice extends Mock implements IOSDevice {
bool
isSupportedForProject
(
FlutterProject
flutterProject
)
=>
true
;
}
class
MockIOSSimulator
extends
Mock
implements
IOSSimulator
{
@override
Future
<
TargetPlatform
>
get
targetPlatform
async
=>
TargetPlatform
.
ios
;
@override
bool
isSupported
()
=>
true
;
@override
bool
isSupportedForProject
(
FlutterProject
flutterProject
)
=>
true
;
}
/// Common functionality for tracking mock interaction.
class
BasicMock
{
final
List
<
String
>
messages
=
<
String
>[];
...
...
@@ -710,9 +698,6 @@ class MockStdIn extends Mock implements IOSink {
class
MockStream
extends
Mock
implements
Stream
<
List
<
int
>>
{}
class
MockDevToolsServer
extends
Mock
implements
HttpServer
{}
class
MockInternetAddress
extends
Mock
implements
InternetAddress
{}
class
AlwaysTrueBotDetector
implements
BotDetector
{
const
AlwaysTrueBotDetector
();
...
...
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