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
03c56676
Unverified
Commit
03c56676
authored
Apr 10, 2020
by
Christopher Fujino
Committed by
GitHub
Apr 10, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[flutter_tools] Remove fromPlatform from tests (#54152)
parent
59b2c5a3
Changes
19
Hide whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
62 additions
and
61 deletions
+62
-61
doctor_test.dart
...utter_tools/test/commands.shard/hermetic/doctor_test.dart
+4
-3
analyze_once_test.dart
...ools/test/commands.shard/permeable/analyze_once_test.dart
+2
-1
create_test.dart
...tter_tools/test/commands.shard/permeable/create_test.dart
+1
-0
android_studio_test.dart
...tools/test/general.shard/android/android_studio_test.dart
+8
-6
android_studio_validator_test.dart
.../general.shard/android/android_studio_validator_test.dart
+4
-3
gradle_errors_test.dart
..._tools/test/general.shard/android/gradle_errors_test.dart
+4
-3
gradle_test.dart
...flutter_tools/test/general.shard/android/gradle_test.dart
+5
-3
application_package_test.dart
...er_tools/test/general.shard/application_package_test.dart
+1
-1
logger_test.dart
...es/flutter_tools/test/general.shard/base/logger_test.dart
+5
-5
net_test.dart
packages/flutter_tools/test/general.shard/base/net_test.dart
+5
-4
process_test.dart
...s/flutter_tools/test/general.shard/base/process_test.dart
+2
-2
user_messages_test.dart
...ter_tools/test/general.shard/base/user_messages_test.dart
+3
-6
icon_tree_shaker_test.dart
...ral.shard/build_system/targets/icon_tree_shaker_test.dart
+1
-3
devices_test.dart
...es/flutter_tools/test/general.shard/ios/devices_test.dart
+3
-6
mac_test.dart
packages/flutter_tools/test/general.shard/ios/mac_test.dart
+1
-1
simulators_test.dart
...flutter_tools/test/general.shard/ios/simulators_test.dart
+4
-2
xcodeproj_test.dart
.../flutter_tools/test/general.shard/ios/xcodeproj_test.dart
+6
-8
xcode_test.dart
...es/flutter_tools/test/general.shard/macos/xcode_test.dart
+2
-4
mocks.dart
packages/flutter_tools/test/src/mocks.dart
+1
-0
No files found.
packages/flutter_tools/test/commands.shard/hermetic/doctor_test.dart
View file @
03c56676
...
...
@@ -33,9 +33,10 @@ import '../../src/common.dart';
import
'../../src/context.dart'
;
import
'../../src/testbed.dart'
;
final
Generator
_kNoColorOutputPlatform
=
()
=>
FakePlatform
.
fromPlatform
(
const
LocalPlatform
())
..
localeName
=
'en_US.UTF-8'
..
stdoutSupportsAnsi
=
false
;
final
Generator
_kNoColorOutputPlatform
=
()
=>
FakePlatform
(
localeName:
'en_US.UTF-8'
,
stdoutSupportsAnsi:
false
,
);
final
Map
<
Type
,
Generator
>
noColorTerminalOverride
=
<
Type
,
Generator
>{
Platform:
_kNoColorOutputPlatform
,
...
...
packages/flutter_tools/test/commands.shard/permeable/analyze_once_test.dart
View file @
03c56676
...
...
@@ -20,7 +20,8 @@ import 'package:process/process.dart';
import
'../../src/common.dart'
;
import
'../../src/context.dart'
;
final
Platform
_kNoColorTerminalPlatform
=
FakePlatform
.
fromPlatform
(
const
LocalPlatform
())..
stdoutSupportsAnsi
=
false
;
final
Platform
_kNoColorTerminalPlatform
=
FakePlatform
(
stdoutSupportsAnsi:
false
);
void
main
(
)
{
String
analyzerSeparator
;
...
...
packages/flutter_tools/test/commands.shard/permeable/create_test.dart
View file @
03c56676
...
...
@@ -31,6 +31,7 @@ import '../../src/testbed.dart';
const
String
frameworkRevision
=
'12345678'
;
const
String
frameworkChannel
=
'omega'
;
// TODO(fujino): replace FakePlatform.fromPlatform() with FakePlatform()
final
Generator
_kNoColorTerminalPlatform
=
()
=>
FakePlatform
.
fromPlatform
(
const
LocalPlatform
())..
stdoutSupportsAnsi
=
false
;
final
Map
<
Type
,
Generator
>
noColorTerminalOverride
=
<
Type
,
Generator
>{
Platform:
_kNoColorTerminalPlatform
,
...
...
packages/flutter_tools/test/general.shard/android/android_studio_test.dart
View file @
03c56676
...
...
@@ -32,15 +32,17 @@ const Map<String, dynamic> macStudioInfoPlist = <String, dynamic>{
class
MockPlistUtils
extends
Mock
implements
PlistParser
{}
Platform
linuxPlatform
(
)
{
return
FakePlatform
.
fromPlatform
(
const
LocalPlatform
())
..
operatingSystem
=
'linux'
..
environment
=
<
String
,
String
>{
'HOME'
:
homeLinux
};
return
FakePlatform
(
operatingSystem:
'linux'
,
environment:
<
String
,
String
>{
'HOME'
:
homeLinux
},
);
}
Platform
macPlatform
(
)
{
return
FakePlatform
.
fromPlatform
(
const
LocalPlatform
())
..
operatingSystem
=
'macos'
..
environment
=
<
String
,
String
>{
'HOME'
:
homeMac
};
return
FakePlatform
(
operatingSystem:
'macos'
,
environment:
<
String
,
String
>{
'HOME'
:
homeMac
},
);
}
void
main
(
)
{
...
...
packages/flutter_tools/test/general.shard/android/android_studio_validator_test.dart
View file @
03c56676
...
...
@@ -18,9 +18,10 @@ import '../../src/context.dart';
const
String
home
=
'/home/me'
;
Platform
linuxPlatform
(
)
{
return
FakePlatform
.
fromPlatform
(
const
LocalPlatform
())
..
operatingSystem
=
'linux'
..
environment
=
<
String
,
String
>{
'HOME'
:
home
};
return
FakePlatform
(
operatingSystem:
'linux'
,
environment:
<
String
,
String
>{
'HOME'
:
home
}
);
}
void
main
(
)
{
...
...
packages/flutter_tools/test/general.shard/android/gradle_errors_test.dart
View file @
03c56676
...
...
@@ -601,9 +601,10 @@ bool testErrorMessage(String errorMessage, GradleHandledError error) {
}
Platform
fakePlatform
(
String
name
)
{
return
FakePlatform
.
fromPlatform
(
const
LocalPlatform
())
..
operatingSystem
=
name
;
return
FakePlatform
(
environment:
<
String
,
String
>{},
operatingSystem:
name
,
);
}
class
FakeGradleUtils
extends
GradleUtils
{
...
...
packages/flutter_tools/test/general.shard/android/gradle_test.dart
View file @
03c56676
...
...
@@ -2633,9 +2633,11 @@ FlutterProject generateFakeAppBundle(String directoryName, String fileName) {
}
FakePlatform
fakePlatform
(
String
name
)
{
return
FakePlatform
.
fromPlatform
(
const
LocalPlatform
())
..
operatingSystem
=
name
..
stdoutSupportsAnsi
=
false
;
return
FakePlatform
(
environment:
<
String
,
String
>{
'HOME'
:
'/path/to/home'
},
operatingSystem:
name
,
stdoutSupportsAnsi:
false
,
);
}
class
FakeGradleUtils
extends
GradleUtils
{
...
...
packages/flutter_tools/test/general.shard/application_package_test.dart
View file @
03c56676
...
...
@@ -25,7 +25,7 @@ import 'package:platform/platform.dart';
import
'../src/common.dart'
;
import
'../src/context.dart'
;
final
Generator
_kNoColorTerminalPlatform
=
()
=>
FakePlatform
.
fromPlatform
(
const
LocalPlatform
())..
stdoutSupportsAnsi
=
false
;
final
Generator
_kNoColorTerminalPlatform
=
()
=>
FakePlatform
(
stdoutSupportsAnsi:
false
)
;
final
Map
<
Type
,
Generator
>
noColorTerminalOverride
=
<
Type
,
Generator
>{
Platform:
_kNoColorTerminalPlatform
,
};
...
...
packages/flutter_tools/test/general.shard/base/logger_test.dart
View file @
03c56676
...
...
@@ -15,7 +15,7 @@ import 'package:quiver/testing/async.dart';
import
'../../src/common.dart'
;
import
'../../src/mocks.dart'
as
mocks
;
final
Platform
_kNoAnsiPlatform
=
FakePlatform
.
fromPlatform
(
const
LocalPlatform
())..
stdoutSupportsAnsi
=
false
;
final
Platform
_kNoAnsiPlatform
=
FakePlatform
(
stdoutSupportsAnsi:
false
)
;
final
String
red
=
RegExp
.
escape
(
AnsiTerminal
.
red
);
final
String
bold
=
RegExp
.
escape
(
AnsiTerminal
.
bold
);
final
String
resetBold
=
RegExp
.
escape
(
AnsiTerminal
.
resetBold
);
...
...
@@ -54,7 +54,7 @@ void main() {
final
BufferLogger
mockLogger
=
BufferLogger
(
terminal:
AnsiTerminal
(
stdio:
mocks
.
MockStdio
(),
platform:
FakePlatform
(
)..
stdoutSupportsAnsi
=
true
,
platform:
FakePlatform
(
stdoutSupportsAnsi:
true
)
,
),
outputPreferences:
OutputPreferences
.
test
(
showColor:
true
),
);
...
...
@@ -250,8 +250,8 @@ void main() {
AnsiStatus
ansiStatus
;
setUp
(()
{
platform
=
FakePlatform
.
fromPlatform
(
testPlatform
)..
stdoutSupportsAnsi
=
false
;
ansiPlatform
=
FakePlatform
.
fromPlatform
(
testPlatform
)..
stdoutSupportsAnsi
=
true
;
platform
=
FakePlatform
(
stdoutSupportsAnsi:
false
)
;
ansiPlatform
=
FakePlatform
(
stdoutSupportsAnsi:
true
)
;
terminal
=
AnsiTerminal
(
stdio:
mockStdio
,
...
...
@@ -749,7 +749,7 @@ void main() {
final
Logger
logger
=
StdoutLogger
(
terminal:
AnsiTerminal
(
stdio:
mockStdio
,
platform:
FakePlatform
(
)..
stdoutSupportsAnsi
=
true
,
platform:
FakePlatform
(
stdoutSupportsAnsi:
true
)
,
),
stdio:
mockStdio
,
outputPreferences:
OutputPreferences
.
test
(
showColor:
true
),
...
...
packages/flutter_tools/test/general.shard/base/net_test.dart
View file @
03c56676
...
...
@@ -25,7 +25,7 @@ void main() {
testLogger
=
BufferLogger
(
terminal:
AnsiTerminal
(
stdio:
MockStdio
(),
platform:
FakePlatform
.
fromPlatform
(
const
LocalPlatform
())..
stdoutSupportsAnsi
=
false
,
platform:
FakePlatform
(
stdoutSupportsAnsi:
false
)
,
),
outputPreferences:
OutputPreferences
.
test
(),
);
...
...
@@ -35,7 +35,7 @@ void main() {
return
Net
(
httpClientFactory:
()
=>
client
,
logger:
testLogger
,
platform:
FakePlatform
.
fromPlatform
(
const
LocalPlatform
()
),
platform:
FakePlatform
(
),
);
}
...
...
@@ -160,10 +160,11 @@ void main() {
ArgumentError
(
'test exception handling'
),
),
logger:
testLogger
,
platform:
FakePlatform
.
fromPlatform
(
const
LocalPlatform
())
..
environment
=
<
String
,
String
>{
platform:
FakePlatform
(
environment:
<
String
,
String
>{
'FLUTTER_STORAGE_BASE_URL'
:
'example.invalid'
,
},
),
);
String
error
;
FakeAsync
().
run
((
FakeAsync
time
)
{
...
...
packages/flutter_tools/test/general.shard/base/process_test.dart
View file @
03c56676
...
...
@@ -85,7 +85,7 @@ void main() {
mockLogger
=
BufferLogger
(
terminal:
AnsiTerminal
(
stdio:
MockStdio
(),
platform:
FakePlatform
.
fromPlatform
(
const
LocalPlatform
())..
stdoutSupportsAnsi
=
false
,
platform:
FakePlatform
(
stdoutSupportsAnsi:
false
)
,
),
outputPreferences:
OutputPreferences
(
wrapText:
true
,
wrapColumn:
40
),
);
...
...
@@ -248,7 +248,7 @@ void main() {
testLogger
=
BufferLogger
(
terminal:
AnsiTerminal
(
stdio:
MockStdio
(),
platform:
FakePlatform
.
fromPlatform
(
const
LocalPlatform
())..
stdoutSupportsAnsi
=
false
,
platform:
FakePlatform
(
stdinSupportsAnsi:
false
)
,
),
outputPreferences:
OutputPreferences
(
wrapText:
true
,
wrapColumn:
40
),
);
...
...
packages/flutter_tools/test/general.shard/base/user_messages_test.dart
View file @
03c56676
...
...
@@ -11,12 +11,9 @@ import '../../src/common.dart';
typedef
_InstallationMessage
=
String
Function
(
Platform
);
void
main
(
)
{
final
FakePlatform
macPlatform
=
FakePlatform
.
fromPlatform
(
const
LocalPlatform
());
macPlatform
.
operatingSystem
=
'macos'
;
final
FakePlatform
linuxPlatform
=
FakePlatform
.
fromPlatform
(
const
LocalPlatform
());
linuxPlatform
.
operatingSystem
=
'linux'
;
final
FakePlatform
windowsPlatform
=
FakePlatform
.
fromPlatform
(
const
LocalPlatform
());
windowsPlatform
.
operatingSystem
=
'windows'
;
final
FakePlatform
macPlatform
=
FakePlatform
(
operatingSystem:
'macos'
);
final
FakePlatform
linuxPlatform
=
FakePlatform
(
operatingSystem:
'linux'
);
final
FakePlatform
windowsPlatform
=
FakePlatform
(
operatingSystem:
'windows'
);
void
_checkInstallationURL
(
_InstallationMessage
message
)
{
expect
(
message
(
macPlatform
),
contains
(
'https://flutter.dev/docs/get-started/install/macos#android-setup'
));
...
...
packages/flutter_tools/test/general.shard/build_system/targets/icon_tree_shaker_test.dart
View file @
03c56676
...
...
@@ -23,9 +23,7 @@ import '../../../src/common.dart';
import
'../../../src/context.dart'
;
import
'../../../src/mocks.dart'
as
mocks
;
final
Platform
_kNoAnsiPlatform
=
FakePlatform
.
fromPlatform
(
const
LocalPlatform
())
..
stdoutSupportsAnsi
=
false
;
final
Platform
_kNoAnsiPlatform
=
FakePlatform
(
stdoutSupportsAnsi:
false
);
void
main
(
)
{
BufferLogger
logger
;
...
...
packages/flutter_tools/test/general.shard/ios/devices_test.dart
View file @
03c56676
...
...
@@ -28,12 +28,9 @@ import '../../src/context.dart';
import
'../../src/mocks.dart'
;
void
main
(
)
{
final
FakePlatform
macPlatform
=
FakePlatform
.
fromPlatform
(
const
LocalPlatform
());
macPlatform
.
operatingSystem
=
'macos'
;
final
FakePlatform
linuxPlatform
=
FakePlatform
.
fromPlatform
(
const
LocalPlatform
());
linuxPlatform
.
operatingSystem
=
'linux'
;
final
FakePlatform
windowsPlatform
=
FakePlatform
.
fromPlatform
(
const
LocalPlatform
());
windowsPlatform
.
operatingSystem
=
'windows'
;
final
FakePlatform
macPlatform
=
FakePlatform
(
operatingSystem:
'macos'
);
final
FakePlatform
linuxPlatform
=
FakePlatform
(
operatingSystem:
'linux'
);
final
FakePlatform
windowsPlatform
=
FakePlatform
(
operatingSystem:
'windows'
);
group
(
'IOSDevice'
,
()
{
final
List
<
Platform
>
unsupportedPlatforms
=
<
Platform
>[
linuxPlatform
,
windowsPlatform
];
...
...
packages/flutter_tools/test/general.shard/ios/mac_test.dart
View file @
03c56676
...
...
@@ -23,7 +23,7 @@ import 'package:process/process.dart';
import
'../../src/common.dart'
;
import
'../../src/context.dart'
;
final
Generator
_kNoColorTerminalPlatform
=
()
=>
FakePlatform
.
fromPlatform
(
const
LocalPlatform
())..
stdoutSupportsAnsi
=
false
;
final
Generator
_kNoColorTerminalPlatform
=
()
=>
FakePlatform
(
stdoutSupportsAnsi:
false
)
;
final
Map
<
Type
,
Generator
>
noColorTerminalOverride
=
<
Type
,
Generator
>{
Platform:
_kNoColorTerminalPlatform
,
};
...
...
packages/flutter_tools/test/general.shard/ios/simulators_test.dart
View file @
03c56676
...
...
@@ -44,8 +44,10 @@ void main() {
MemoryFileSystem
fileSystem
;
setUp
(()
{
osx
=
FakePlatform
.
fromPlatform
(
const
LocalPlatform
());
osx
.
operatingSystem
=
'macos'
;
osx
=
FakePlatform
(
environment:
<
String
,
String
>{},
operatingSystem:
'macos'
,
);
fileSystem
=
MemoryFileSystem
();
fsUtils
=
FileSystemUtils
(
fileSystem:
fileSystem
,
platform:
osx
);
});
...
...
packages/flutter_tools/test/general.shard/ios/xcodeproj_test.dart
View file @
03c56676
...
...
@@ -36,7 +36,7 @@ void main() {
setUp
(()
{
processManager
=
mocks
.
MockProcessManager
();
platform
=
fakePlatform
(
'macos'
);
platform
=
FakePlatform
(
operatingSystem:
'macos'
);
fileSystem
=
MemoryFileSystem
();
fileSystem
.
file
(
xcodebuild
).
createSync
(
recursive:
true
);
terminal
=
MockAnsiTerminal
();
...
...
@@ -125,7 +125,7 @@ void main() {
});
testWithoutContext
(
'xcodebuild isInstalled is false when not on MacOS'
,
()
{
final
Platform
platform
=
fakePlatform
(
'notMacOS'
);
final
Platform
platform
=
FakePlatform
(
operatingSystem:
'notMacOS'
);
xcodeProjectInterpreter
=
XcodeProjectInterpreter
(
logger:
logger
,
fileSystem:
fileSystem
,
...
...
@@ -175,6 +175,7 @@ void main() {
});
testWithoutContext
(
'xcodebuild build settings is empty when xcodebuild failed to get the build settings'
,
()
async
{
platform
.
environment
=
Map
<
String
,
String
>.
unmodifiable
(<
String
,
String
>{});
when
(
processManager
.
runSync
(
argThat
(
contains
(
xcodebuild
)),
workingDirectory:
anyNamed
(
'workingDirectory'
),
...
...
@@ -190,6 +191,7 @@ void main() {
flakes:
1
,
delay:
delay
+
const
Duration
(
seconds:
1
),
);
platform
.
environment
=
Map
<
String
,
String
>.
unmodifiable
(<
String
,
String
>{});
expect
(
await
xcodeProjectInterpreter
.
getBuildSettings
(
''
,
''
,
timeout:
delay
),
...
...
@@ -422,7 +424,7 @@ Information about project "Runner":
FakePlatform
platform
;
setUp
(()
{
platform
=
fakePlatform
(
'ignored'
);
platform
=
FakePlatform
(
);
});
testWithoutContext
(
'environment variables as Xcode build settings'
,
()
{
...
...
@@ -447,7 +449,7 @@ Information about project "Runner":
fs
=
MemoryFileSystem
();
mockArtifacts
=
MockLocalEngineArtifacts
();
mockProcessManager
=
MockProcessManager
();
macOS
=
fakePlatform
(
'macos'
);
macOS
=
FakePlatform
(
operatingSystem:
'macos'
);
fs
.
file
(
xcodebuild
).
createSync
(
recursive:
true
);
});
...
...
@@ -803,10 +805,6 @@ flutter:
});
}
FakePlatform
fakePlatform
(
String
name
)
{
return
FakePlatform
.
fromPlatform
(
const
LocalPlatform
())..
operatingSystem
=
name
;
}
class
MockLocalEngineArtifacts
extends
Mock
implements
LocalEngineArtifacts
{}
class
MockProcessManager
extends
Mock
implements
ProcessManager
{}
class
MockXcodeProjectInterpreter
extends
Mock
implements
XcodeProjectInterpreter
{}
...
...
packages/flutter_tools/test/general.shard/macos/xcode_test.dart
View file @
03c56676
...
...
@@ -253,8 +253,7 @@ void main() {
});
group
(
'available devices'
,
()
{
final
FakePlatform
macPlatform
=
FakePlatform
.
fromPlatform
(
const
LocalPlatform
());
macPlatform
.
operatingSystem
=
'macos'
;
final
FakePlatform
macPlatform
=
FakePlatform
(
operatingSystem:
'macos'
);
testWithoutContext
(
'Xcode not installed'
,
()
async
{
when
(
mockXcode
.
isInstalledAndMeetsVersionCheck
).
thenReturn
(
false
);
...
...
@@ -447,8 +446,7 @@ void main() {
});
group
(
'diagnostics'
,
()
{
final
FakePlatform
macPlatform
=
FakePlatform
.
fromPlatform
(
const
LocalPlatform
());
macPlatform
.
operatingSystem
=
'macos'
;
final
FakePlatform
macPlatform
=
FakePlatform
(
operatingSystem:
'macos'
);
testWithoutContext
(
'Xcode not installed'
,
()
async
{
when
(
mockXcode
.
isInstalledAndMeetsVersionCheck
).
thenReturn
(
false
);
...
...
packages/flutter_tools/test/src/mocks.dart
View file @
03c56676
...
...
@@ -29,6 +29,7 @@ import 'package:process/process.dart';
import
'common.dart'
;
// TODO(fujino): replace FakePlatform.fromPlatform() with FakePlatform()
final
Generator
kNoColorTerminalPlatform
=
()
{
return
FakePlatform
.
fromPlatform
(
const
LocalPlatform
()
...
...
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