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
d550d497
Unverified
Commit
d550d497
authored
Aug 25, 2021
by
Jenn Magder
Committed by
GitHub
Aug 25, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Migrate some flutter_tools tests to null safety (#88850)
parent
59f3f23a
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
53 additions
and
77 deletions
+53
-77
code_signing.dart
packages/flutter_tools/lib/src/ios/code_signing.dart
+1
-1
error_handling_io_test.dart
...tools/test/general.shard/base/error_handling_io_test.dart
+15
-20
process_test.dart
...s/flutter_tools/test/general.shard/base/process_test.dart
+15
-17
invalidated_reason_test.dart
...t/general.shard/build_system/invalidated_reason_test.dart
+0
-2
flutter_root_test.dart
..._tools/test/general.shard/commands/flutter_root_test.dart
+0
-2
custom_devices_config_test.dart
...eral.shard/custom_devices/custom_devices_config_test.dart
+0
-2
generate_synthetic_packages_test.dart
.../general.shard/dart/generate_synthetic_packages_test.dart
+0
-1
code_signing_test.dart
...utter_tools/test/general.shard/ios/code_signing_test.dart
+21
-23
macos_workflow_test.dart
...r_tools/test/general.shard/macos/macos_workflow_test.dart
+0
-2
plugins_test.dart
...lutter_tools/test/general.shard/windows/plugins_test.dart
+0
-2
project_test.dart
...lutter_tools/test/general.shard/windows/project_test.dart
+0
-2
custom_devices_common.dart
packages/flutter_tools/test/src/custom_devices_common.dart
+1
-3
No files found.
packages/flutter_tools/lib/src/ios/code_signing.dart
View file @
d550d497
...
...
@@ -187,7 +187,7 @@ Future<Map<String, String>?> getCodeSigningIdentityDevelopmentTeam({
final
String
opensslOutput
=
await
utf8
.
decodeStream
(
opensslProcess
.
stdout
);
// Fire and forget discard of the stderr stream so we don't hold onto resources.
// Don't care about the result.
unawaited
(
opensslProcess
.
stderr
.
drain
<
String
>());
unawaited
(
opensslProcess
.
stderr
.
drain
<
String
?
>());
if
(
await
opensslProcess
.
exitCode
!=
0
)
{
return
null
;
...
...
packages/flutter_tools/test/general.shard/base/error_handling_io_test.dart
View file @
d550d497
...
...
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// @dart = 2.8
import
'dart:io'
as
io
;
// flutter_ignore: dart_io_import;
import
'package:file/file.dart'
;
...
...
@@ -103,7 +101,7 @@ void main() {
const
int
kUserPermissionDenied
=
5
;
const
int
kFatalDeviceHardwareError
=
483
;
FileExceptionHandler
exceptionHandler
;
late
FileExceptionHandler
exceptionHandler
;
setUp
(()
{
exceptionHandler
=
FileExceptionHandler
();
...
...
@@ -340,7 +338,7 @@ void main() {
testWithoutContext
(
'When reading from a file or directory without permission'
,
()
{
final
ErrorHandlingFileSystem
fileSystem
=
ErrorHandlingFileSystem
(
delegate:
ThrowsOnCurrentDirectoryFileSystem
(
)..
errorCode
=
kUserPermissionDenied
,
delegate:
ThrowsOnCurrentDirectoryFileSystem
(
kUserPermissionDenied
)
,
platform:
windowsPlatform
,
);
...
...
@@ -354,7 +352,7 @@ void main() {
const
int
enospc
=
28
;
const
int
eacces
=
13
;
FileExceptionHandler
exceptionHandler
;
late
FileExceptionHandler
exceptionHandler
;
setUp
(()
{
exceptionHandler
=
FileExceptionHandler
();
...
...
@@ -531,7 +529,7 @@ void main() {
testWithoutContext
(
'When the current working directory disappears'
,
()
async
{
final
ErrorHandlingFileSystem
fileSystem
=
ErrorHandlingFileSystem
(
delegate:
ThrowsOnCurrentDirectoryFileSystem
(
)..
errorCode
=
kSystemCannotFindFile
,
delegate:
ThrowsOnCurrentDirectoryFileSystem
(
kSystemCannotFindFile
)
,
platform:
linuxPlatform
,
);
...
...
@@ -560,7 +558,7 @@ void main() {
const
int
eperm
=
1
;
const
int
enospc
=
28
;
const
int
eacces
=
13
;
FileExceptionHandler
exceptionHandler
;
late
FileExceptionHandler
exceptionHandler
;
setUp
(()
{
exceptionHandler
=
FileExceptionHandler
();
...
...
@@ -754,7 +752,7 @@ void main() {
testWithoutContext
(
'When reading from current directory without permission'
,
()
{
final
ErrorHandlingFileSystem
fileSystem
=
ErrorHandlingFileSystem
(
delegate:
ThrowsOnCurrentDirectoryFileSystem
(
)..
errorCode
=
eacces
,
delegate:
ThrowsOnCurrentDirectoryFileSystem
(
eacces
)
,
platform:
linuxPlatform
,
);
...
...
@@ -781,11 +779,9 @@ void main() {
);
final
Object
firstPath
=
fs
.
path
;
expect
(
firstPath
,
isNotNull
);
fs
.
currentDirectory
=
null
;
// For fs.path.absolute usage.
fileSystem
.
path
=
MemoryFileSystem
.
test
().
path
;
expect
(
identical
(
firstPath
,
fs
.
path
),
false
);
});
...
...
@@ -1089,8 +1085,8 @@ void main() {
group
(
'CopySync'
,
()
{
const
int
eaccess
=
13
;
FileExceptionHandler
exceptionHandler
;
ErrorHandlingFileSystem
fileSystem
;
late
FileExceptionHandler
exceptionHandler
;
late
ErrorHandlingFileSystem
fileSystem
;
setUp
(()
{
exceptionHandler
=
FileExceptionHandler
();
...
...
@@ -1191,20 +1187,22 @@ class ThrowingFakeProcessManager extends Fake implements ProcessManager {
final
Exception
_exception
;
@override
bool
canRun
(
dynamic
executable
,
{
String
workingDirectory
})
{
bool
canRun
(
dynamic
executable
,
{
String
?
workingDirectory
})
{
throw
_exception
;
}
}
class
ThrowsOnCurrentDirectoryFileSystem
extends
Fake
implements
FileSystem
{
int
errorCode
;
ThrowsOnCurrentDirectoryFileSystem
(
this
.
errorCode
);
final
int
errorCode
;
@override
Directory
get
currentDirectory
=>
throw
FileSystemException
(
''
,
''
,
OSError
(
''
,
errorCode
));
}
class
FakeExistsFile
extends
Fake
implements
File
{
Object
error
;
late
Object
error
;
int
existsCount
=
0
;
...
...
@@ -1225,10 +1223,7 @@ class FakeExistsFile extends Fake implements File {
class
FakeFileSystem
extends
Fake
implements
FileSystem
{
@override
p
.
Context
path
;
@override
Directory
get
currentDirectory
=>
null
;
p
.
Context
get
path
=>
p
.
Context
();
@override
set
currentDirectory
(
dynamic
path
)
{
}
...
...
packages/flutter_tools/test/general.shard/base/process_test.dart
View file @
d550d497
...
...
@@ -2,8 +2,6 @@
// 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:flutter_tools/src/base/io.dart'
;
import
'package:flutter_tools/src/base/logger.dart'
;
import
'package:flutter_tools/src/base/platform.dart'
;
...
...
@@ -16,8 +14,8 @@ import '../../src/fakes.dart';
void
main
(
)
{
group
(
'process exceptions'
,
()
{
FakeProcessManager
fakeProcessManager
;
ProcessUtils
processUtils
;
late
FakeProcessManager
fakeProcessManager
;
late
ProcessUtils
processUtils
;
setUp
(()
{
fakeProcessManager
=
FakeProcessManager
.
empty
();
...
...
@@ -42,7 +40,7 @@ void main() {
group
(
'shutdownHooks'
,
()
{
testWithoutContext
(
'runInExpectedOrder'
,
()
async
{
int
i
=
1
;
int
cleanup
;
int
?
cleanup
;
final
ShutdownHooks
shutdownHooks
=
ShutdownHooks
(
logger:
BufferLogger
.
test
());
...
...
@@ -57,9 +55,9 @@ void main() {
});
group
(
'output formatting'
,
()
{
FakeProcessManager
processManager
;
ProcessUtils
processUtils
;
BufferLogger
logger
;
late
FakeProcessManager
processManager
;
late
ProcessUtils
processUtils
;
late
BufferLogger
logger
;
setUp
(()
{
processManager
=
FakeProcessManager
.
empty
();
...
...
@@ -104,8 +102,8 @@ void main() {
});
group
(
'run'
,
()
{
FakeProcessManager
fakeProcessManager
;
ProcessUtils
processUtils
;
late
FakeProcessManager
fakeProcessManager
;
late
ProcessUtils
processUtils
;
setUp
(()
{
fakeProcessManager
=
FakeProcessManager
.
empty
();
...
...
@@ -180,9 +178,9 @@ void main() {
});
group
(
'runSync'
,
()
{
FakeProcessManager
fakeProcessManager
;
ProcessUtils
processUtils
;
BufferLogger
testLogger
;
late
FakeProcessManager
fakeProcessManager
;
late
ProcessUtils
processUtils
;
late
BufferLogger
testLogger
;
setUp
(()
{
fakeProcessManager
=
FakeProcessManager
.
empty
();
...
...
@@ -331,8 +329,8 @@ void main() {
});
group
(
'exitsHappySync'
,
()
{
FakeProcessManager
processManager
;
ProcessUtils
processUtils
;
late
FakeProcessManager
processManager
;
late
ProcessUtils
processUtils
;
setUp
(()
{
processManager
=
FakeProcessManager
.
empty
();
...
...
@@ -388,8 +386,8 @@ void main() {
});
group
(
'exitsHappy'
,
()
{
FakeProcessManager
processManager
;
ProcessUtils
processUtils
;
late
FakeProcessManager
processManager
;
late
ProcessUtils
processUtils
;
setUp
(()
{
processManager
=
FakeProcessManager
.
empty
();
...
...
packages/flutter_tools/test/general.shard/build_system/invalidated_reason_test.dart
View file @
d550d497
...
...
@@ -2,8 +2,6 @@
// 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:flutter_tools/src/build_system/build_system.dart'
;
import
'../../src/common.dart'
;
...
...
packages/flutter_tools/test/general.shard/commands/flutter_root_test.dart
View file @
d550d497
...
...
@@ -2,8 +2,6 @@
// 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:file/memory.dart'
;
import
'package:flutter_tools/src/base/file_system.dart'
;
import
'package:flutter_tools/src/base/platform.dart'
;
...
...
packages/flutter_tools/test/general.shard/custom_devices/custom_devices_config_test.dart
View file @
d550d497
...
...
@@ -2,8 +2,6 @@
// 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:file/memory.dart'
;
import
'package:flutter_tools/src/base/file_system.dart'
;
import
'package:flutter_tools/src/base/logger.dart'
;
...
...
packages/flutter_tools/test/general.shard/dart/generate_synthetic_packages_test.dart
View file @
d550d497
...
...
@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import
'dart:async'
;
import
'package:file/memory.dart'
;
...
...
packages/flutter_tools/test/general.shard/ios/code_signing_test.dart
View file @
d550d497
...
...
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// @dart = 2.8
import
'dart:async'
;
import
'dart:convert'
;
...
...
@@ -25,9 +23,9 @@ const String kCertificates = '''
void
main
(
)
{
group
(
'Auto signing'
,
()
{
Config
testConfig
;
AnsiTerminal
testTerminal
;
BufferLogger
logger
;
late
Config
testConfig
;
late
AnsiTerminal
testTerminal
;
late
BufferLogger
logger
;
setUp
(()
async
{
logger
=
BufferLogger
.
test
();
...
...
@@ -37,7 +35,7 @@ void main() {
});
testWithoutContext
(
'No auto-sign if Xcode project settings are not available'
,
()
async
{
final
Map
<
String
,
String
>
signingConfigs
=
await
getCodeSigningIdentityDevelopmentTeam
(
final
Map
<
String
,
String
>
?
signingConfigs
=
await
getCodeSigningIdentityDevelopmentTeam
(
buildSettings:
null
,
processManager:
FakeProcessManager
.
empty
(),
logger:
logger
,
...
...
@@ -48,7 +46,7 @@ void main() {
});
testWithoutContext
(
'No discovery if development team specified in Xcode project'
,
()
async
{
final
Map
<
String
,
String
>
signingConfigs
=
await
getCodeSigningIdentityDevelopmentTeam
(
final
Map
<
String
,
String
>
?
signingConfigs
=
await
getCodeSigningIdentityDevelopmentTeam
(
buildSettings:
<
String
,
String
>{
'DEVELOPMENT_TEAM'
:
'abc'
,
},
...
...
@@ -71,7 +69,7 @@ void main() {
),
]);
final
Map
<
String
,
String
>
signingConfigs
=
await
getCodeSigningIdentityDevelopmentTeam
(
final
Map
<
String
,
String
>
?
signingConfigs
=
await
getCodeSigningIdentityDevelopmentTeam
(
buildSettings:
<
String
,
String
>{
'bogus'
:
'bogus'
,
},
...
...
@@ -135,13 +133,13 @@ void main() {
]);
// Verify that certifacte value is passed into openssl command.
String
stdin
;
String
?
stdin
;
controller
.
stream
.
listen
((
List
<
int
>
chunk
)
{
stdin
=
utf8
.
decode
(
chunk
);
completer
.
complete
();
});
final
Map
<
String
,
String
>
signingConfigs
=
await
getCodeSigningIdentityDevelopmentTeam
(
final
Map
<
String
,
String
>
?
signingConfigs
=
await
getCodeSigningIdentityDevelopmentTeam
(
buildSettings:
<
String
,
String
>{
'bogus'
:
'bogus'
,
},
...
...
@@ -187,13 +185,13 @@ void main() {
]);
// Verify that certifacte value is passed into openssl command.
String
stdin
;
String
?
stdin
;
controller
.
stream
.
listen
((
List
<
int
>
chunk
)
{
stdin
=
utf8
.
decode
(
chunk
);
completer
.
complete
();
});
final
Map
<
String
,
String
>
signingConfigs
=
await
getCodeSigningIdentityDevelopmentTeam
(
final
Map
<
String
,
String
>
?
signingConfigs
=
await
getCodeSigningIdentityDevelopmentTeam
(
buildSettings:
<
String
,
String
>{
'bogus'
:
'bogus'
,
},
...
...
@@ -237,13 +235,13 @@ void main() {
]);
// Verify that certifacte value is passed into openssl command.
String
stdin
;
String
?
stdin
;
controller
.
stream
.
listen
((
List
<
int
>
chunk
)
{
stdin
=
utf8
.
decode
(
chunk
);
completer
.
complete
();
});
final
Map
<
String
,
String
>
signingConfigs
=
await
getCodeSigningIdentityDevelopmentTeam
(
final
Map
<
String
,
String
>
?
signingConfigs
=
await
getCodeSigningIdentityDevelopmentTeam
(
buildSettings:
<
String
,
String
>{
'bogus'
:
'bogus'
,
},
...
...
@@ -295,13 +293,13 @@ void main() {
]);
// Verify that certifacte value is passed into openssl command.
String
stdin
;
String
?
stdin
;
controller
.
stream
.
listen
((
List
<
int
>
chunk
)
{
stdin
=
utf8
.
decode
(
chunk
);
completer
.
complete
();
});
final
Map
<
String
,
String
>
signingConfigs
=
await
getCodeSigningIdentityDevelopmentTeam
(
final
Map
<
String
,
String
>
?
signingConfigs
=
await
getCodeSigningIdentityDevelopmentTeam
(
buildSettings:
<
String
,
String
>{
'bogus'
:
'bogus'
,
},
...
...
@@ -348,13 +346,13 @@ void main() {
]);
// Verify that certifacte value is passed into openssl command.
String
stdin
;
String
?
stdin
;
controller
.
stream
.
listen
((
List
<
int
>
chunk
)
{
stdin
=
utf8
.
decode
(
chunk
);
completer
.
complete
();
});
final
Map
<
String
,
String
>
signingConfigs
=
await
getCodeSigningIdentityDevelopmentTeam
(
final
Map
<
String
,
String
>
?
signingConfigs
=
await
getCodeSigningIdentityDevelopmentTeam
(
buildSettings:
<
String
,
String
>{
'bogus'
:
'bogus'
,
},
...
...
@@ -406,13 +404,13 @@ void main() {
]);
// Verify that certifacte value is passed into openssl command.
String
stdin
;
String
?
stdin
;
controller
.
stream
.
listen
((
List
<
int
>
chunk
)
{
stdin
=
utf8
.
decode
(
chunk
);
completer
.
complete
();
});
final
Map
<
String
,
String
>
signingConfigs
=
await
getCodeSigningIdentityDevelopmentTeam
(
final
Map
<
String
,
String
>
?
signingConfigs
=
await
getCodeSigningIdentityDevelopmentTeam
(
buildSettings:
<
String
,
String
>{
'bogus'
:
'bogus'
,
},
...
...
@@ -449,7 +447,7 @@ void main() {
),
]);
final
Map
<
String
,
String
>
signingConfigs
=
await
getCodeSigningIdentityDevelopmentTeam
(
final
Map
<
String
,
String
>
?
signingConfigs
=
await
getCodeSigningIdentityDevelopmentTeam
(
buildSettings:
<
String
,
String
>{
'bogus'
:
'bogus'
,
},
...
...
@@ -481,7 +479,7 @@ void main() {
),
]);
final
Map
<
String
,
String
>
signingConfigs
=
await
getCodeSigningIdentityDevelopmentTeam
(
final
Map
<
String
,
String
>
?
signingConfigs
=
await
getCodeSigningIdentityDevelopmentTeam
(
buildSettings:
<
String
,
String
>{
'bogus'
:
'bogus'
,
},
...
...
@@ -495,7 +493,7 @@ void main() {
});
}
Stream
<
String
>
mockTerminalStdInStream
;
late
Stream
<
String
>
mockTerminalStdInStream
;
class
TestTerminal
extends
AnsiTerminal
{
TestTerminal
()
:
super
(
stdio:
globals
.
stdio
,
platform:
globals
.
platform
);
...
...
packages/flutter_tools/test/general.shard/macos/macos_workflow_test.dart
View file @
d550d497
...
...
@@ -2,8 +2,6 @@
// 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:flutter_tools/src/base/platform.dart'
;
import
'package:flutter_tools/src/macos/macos_workflow.dart'
;
...
...
packages/flutter_tools/test/general.shard/windows/plugins_test.dart
View file @
d550d497
...
...
@@ -2,8 +2,6 @@
// 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:file/file.dart'
;
import
'package:file/memory.dart'
;
import
'package:file_testing/file_testing.dart'
;
...
...
packages/flutter_tools/test/general.shard/windows/project_test.dart
View file @
d550d497
...
...
@@ -2,8 +2,6 @@
// 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:file/file.dart'
;
import
'package:file/memory.dart'
;
import
'package:flutter_tools/src/project.dart'
;
...
...
packages/flutter_tools/test/src/custom_devices_common.dart
View file @
d550d497
...
...
@@ -2,15 +2,13 @@
// 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:flutter_tools/src/base/file_system.dart'
;
import
'package:flutter_tools/src/convert.dart'
;
import
'package:flutter_tools/src/custom_devices/custom_device_config.dart'
;
void
writeCustomDevicesConfigFile
(
Directory
dir
,
{
List
<
CustomDeviceConfig
>
configs
,
List
<
CustomDeviceConfig
>
?
configs
,
dynamic
json
})
{
dir
.
createSync
(
recursive:
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