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
5e614667
Unverified
Commit
5e614667
authored
Feb 18, 2021
by
Jenn Magder
Committed by
GitHub
Feb 18, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adopt FileExceptionHandler in a few tests (#76279)
parent
90531179
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
36 additions
and
14 deletions
+36
-14
clean_test.dart
...lutter_tools/test/commands.shard/hermetic/clean_test.dart
+13
-5
cache_test.dart
packages/flutter_tools/test/general.shard/cache_test.dart
+23
-8
chrome_test.dart
...ges/flutter_tools/test/general.shard/web/chrome_test.dart
+0
-1
No files found.
packages/flutter_tools/test/commands.shard/hermetic/clean_test.dart
View file @
5e614667
...
...
@@ -116,24 +116,32 @@ void main() {
group
(
'Windows'
,
()
{
FakePlatform
windowsPlatform
;
MemoryFileSystem
fileSystem
;
FileExceptionHandler
exceptionHandler
;
setUp
(()
{
windowsPlatform
=
FakePlatform
(
operatingSystem:
'windows'
);
exceptionHandler
=
FileExceptionHandler
();
fileSystem
=
MemoryFileSystem
.
test
(
opHandle:
exceptionHandler
.
opHandle
);
});
testUsingContext
(
'
$CleanCommand
prints a helpful error message on Windows'
,
()
async
{
when
(
mockXcodeProjectInterpreter
.
isInstalled
).
thenReturn
(
false
);
final
MockFile
mockFile
=
MockFile
();
when
(
mockFile
.
existsSync
()).
thenReturn
(
true
);
final
File
file
=
fileSystem
.
file
(
'file'
)..
createSync
();
exceptionHandler
.
addError
(
file
,
FileSystemOp
.
delete
,
const
FileSystemException
(
'Deletion failed'
),
);
when
(
mockFile
.
deleteSync
(
recursive:
true
)).
thenThrow
(
const
FileSystemException
(
'Deletion failed'
));
final
CleanCommand
command
=
CleanCommand
();
command
.
deleteFile
(
mockF
ile
);
command
.
deleteFile
(
f
ile
);
expect
(
testLogger
.
errorText
,
contains
(
'A program may still be using a file'
));
verify
(
mockFile
.
deleteSync
(
recursive:
true
)).
called
(
1
);
},
overrides:
<
Type
,
Generator
>{
Platform:
()
=>
windowsPlatform
,
Xcode:
()
=>
xcode
,
FileSystem:
()
=>
fileSystem
,
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
});
testUsingContext
(
'
$CleanCommand
handles missing permissions;'
,
()
async
{
...
...
packages/flutter_tools/test/general.shard/cache_test.dart
View file @
5e614667
...
...
@@ -665,7 +665,8 @@ void main() {
});
testWithoutContext
(
'Cache handles exception thrown if stamp file cannot be parsed'
,
()
{
final
FileSystem
fileSystem
=
MemoryFileSystem
.
test
();
final
FileExceptionHandler
exceptionHandler
=
FileExceptionHandler
();
final
FileSystem
fileSystem
=
MemoryFileSystem
.
test
(
opHandle:
exceptionHandler
.
opHandle
);
final
Logger
logger
=
BufferLogger
.
test
();
final
FakeCache
cache
=
FakeCache
(
fileSystem:
fileSystem
,
...
...
@@ -673,19 +674,33 @@ void main() {
platform:
FakePlatform
(),
osUtils:
MockOperatingSystemUtils
()
);
final
MockFile
file
=
MockFile
(
);
final
File
file
=
fileSystem
.
file
(
'stamp'
);
cache
.
stampFile
=
file
;
when
(
file
.
existsSync
()).
thenReturn
(
false
);
expect
(
cache
.
getStampFor
(
'foo'
),
null
);
when
(
file
.
existsSync
()).
thenReturn
(
true
);
when
(
file
.
readAsStringSync
()).
thenThrow
(
const
FileSystemException
());
file
.
createSync
();
exceptionHandler
.
addError
(
file
,
FileSystemOp
.
read
,
const
FileSystemException
(),
);
expect
(
cache
.
getStampFor
(
'foo'
),
null
);
});
testWithoutContext
(
'Cache parses stamp file'
,
()
{
final
FileSystem
fileSystem
=
MemoryFileSystem
.
test
();
final
Logger
logger
=
BufferLogger
.
test
();
final
FakeCache
cache
=
FakeCache
(
fileSystem:
fileSystem
,
logger:
logger
,
platform:
FakePlatform
(),
osUtils:
MockOperatingSystemUtils
()
);
when
(
file
.
existsSync
()).
thenReturn
(
true
);
when
(
file
.
readAsStringSync
()).
thenReturn
(
'ABC '
)
;
final
File
file
=
fileSystem
.
file
(
'stamp'
)..
writeAsStringSync
(
'ABC '
);
cache
.
stampFile
=
file
;
expect
(
cache
.
getStampFor
(
'foo'
),
'ABC'
);
});
...
...
@@ -860,7 +875,6 @@ class FakeDownloadedArtifact extends CachedArtifact {
}
class
MockArtifactUpdater
extends
Mock
implements
ArtifactUpdater
{}
class
MockFile
extends
Mock
implements
File
{}
class
MockCachedArtifact
extends
Mock
implements
CachedArtifact
{}
class
MockIosUsbArtifacts
extends
Mock
implements
IosUsbArtifacts
{}
class
MockInternetAddress
extends
Mock
implements
InternetAddress
{}
...
...
@@ -868,6 +882,7 @@ class MockCache extends Mock implements Cache {}
class
MockOperatingSystemUtils
extends
Mock
implements
OperatingSystemUtils
{}
class
MockVersionedPackageResolver
extends
Mock
implements
VersionedPackageResolver
{}
class
MockPub
extends
Mock
implements
Pub
{}
class
FakeCache
extends
Cache
{
FakeCache
({
@required
Logger
logger
,
...
...
packages/flutter_tools/test/general.shard/web/chrome_test.dart
View file @
5e614667
...
...
@@ -356,7 +356,6 @@ void main() {
});
}
class
MockFileSystemUtils
extends
Mock
implements
FileSystemUtils
{}
class
MockOperatingSystemUtils
extends
Mock
implements
OperatingSystemUtils
{}
Future
<
Chromium
>
_testLaunchChrome
(
String
userDataDir
,
FakeProcessManager
processManager
,
ChromiumLauncher
chromeLauncher
)
{
...
...
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