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
f0fca7de
Unverified
Commit
f0fca7de
authored
Mar 13, 2021
by
Jenn Magder
Committed by
GitHub
Mar 13, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove mocks from build_windows_test (#77986)
parent
d018c24b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
21 deletions
+26
-21
build_windows_test.dart
...ools/test/commands.shard/hermetic/build_windows_test.dart
+26
-21
No files found.
packages/flutter_tools/test/commands.shard/hermetic/build_windows_test.dart
View file @
f0fca7de
...
...
@@ -13,7 +13,7 @@ import 'package:flutter_tools/src/commands/build_windows.dart';
import
'package:flutter_tools/src/features.dart'
;
import
'package:flutter_tools/src/reporting/reporting.dart'
;
import
'package:flutter_tools/src/windows/visual_studio.dart'
;
import
'package:
mockito/mockito
.dart'
;
import
'package:
test/fake
.dart'
;
import
'package:process/process.dart'
;
import
'../../src/common.dart'
;
...
...
@@ -45,7 +45,7 @@ void main() {
FileSystem
fileSystem
;
ProcessManager
processManager
;
MockVisualStudio
mock
VisualStudio
;
FakeVisualStudio
fake
VisualStudio
;
TestUsage
usage
;
setUpAll
(()
{
...
...
@@ -55,7 +55,7 @@ void main() {
setUp
(()
{
fileSystem
=
MemoryFileSystem
.
test
(
style:
FileSystemStyle
.
windows
);
Cache
.
flutterRoot
=
flutterRoot
;
mockVisualStudio
=
Mock
VisualStudio
();
fakeVisualStudio
=
Fake
VisualStudio
();
usage
=
TestUsage
();
});
...
...
@@ -118,7 +118,7 @@ void main() {
testUsingContext
(
'Windows build fails when there is no vcvars64.bat'
,
()
async
{
final
BuildWindowsCommand
command
=
BuildWindowsCommand
()
..
visualStudioOverride
=
mock
VisualStudio
;
..
visualStudioOverride
=
fake
VisualStudio
;
setUpMockProjectFilesForBuild
();
expect
(
createTestCommandRunner
(
command
).
run
(
...
...
@@ -132,10 +132,10 @@ void main() {
});
testUsingContext
(
'Windows build fails when there is no windows project'
,
()
async
{
final
FakeVisualStudio
fakeVisualStudio
=
FakeVisualStudio
(
cmakePath
);
final
BuildWindowsCommand
command
=
BuildWindowsCommand
()
..
visualStudioOverride
=
mock
VisualStudio
;
..
visualStudioOverride
=
fake
VisualStudio
;
setUpMockCoreProjectFiles
();
when
(
mockVisualStudio
.
cmakePath
).
thenReturn
(
cmakePath
);
expect
(
createTestCommandRunner
(
command
).
run
(
const
<
String
>[
'windows'
,
'--no-pub'
]
...
...
@@ -150,10 +150,10 @@ void main() {
});
testUsingContext
(
'Windows build fails on non windows platform'
,
()
async
{
final
FakeVisualStudio
fakeVisualStudio
=
FakeVisualStudio
(
cmakePath
);
final
BuildWindowsCommand
command
=
BuildWindowsCommand
()
..
visualStudioOverride
=
mock
VisualStudio
;
..
visualStudioOverride
=
fake
VisualStudio
;
setUpMockProjectFilesForBuild
();
when
(
mockVisualStudio
.
cmakePath
).
thenReturn
(
cmakePath
);
expect
(
createTestCommandRunner
(
command
).
run
(
const
<
String
>[
'windows'
,
'--no-pub'
]
...
...
@@ -166,10 +166,10 @@ void main() {
});
testUsingContext
(
'Windows build does not spew stdout to status logger'
,
()
async
{
final
FakeVisualStudio
fakeVisualStudio
=
FakeVisualStudio
(
cmakePath
);
final
BuildWindowsCommand
command
=
BuildWindowsCommand
()
..
visualStudioOverride
=
mock
VisualStudio
;
..
visualStudioOverride
=
fake
VisualStudio
;
setUpMockProjectFilesForBuild
();
when
(
mockVisualStudio
.
cmakePath
).
thenReturn
(
cmakePath
);
processManager
=
FakeProcessManager
.
list
(<
FakeCommand
>[
cmakeGenerationCommand
(),
...
...
@@ -191,10 +191,10 @@ void main() {
});
testUsingContext
(
'Windows build extracts errors from stdout'
,
()
async
{
final
FakeVisualStudio
fakeVisualStudio
=
FakeVisualStudio
(
cmakePath
);
final
BuildWindowsCommand
command
=
BuildWindowsCommand
()
..
visualStudioOverride
=
mock
VisualStudio
;
..
visualStudioOverride
=
fake
VisualStudio
;
setUpMockProjectFilesForBuild
();
when
(
mockVisualStudio
.
cmakePath
).
thenReturn
(
cmakePath
);
// This contains a mix of routine build output and various types of errors
// (compile error, link error, warning treated as an error) from MSBuild,
...
...
@@ -249,10 +249,10 @@ C:\foo\windows\runner\main.cpp(17,1): error C2065: 'Baz': undeclared identifier
});
testUsingContext
(
'Windows verbose build sets VERBOSE_SCRIPT_LOGGING'
,
()
async
{
final
FakeVisualStudio
fakeVisualStudio
=
FakeVisualStudio
(
cmakePath
);
final
BuildWindowsCommand
command
=
BuildWindowsCommand
()
..
visualStudioOverride
=
mock
VisualStudio
;
..
visualStudioOverride
=
fake
VisualStudio
;
setUpMockProjectFilesForBuild
();
when
(
mockVisualStudio
.
cmakePath
).
thenReturn
(
cmakePath
);
processManager
=
FakeProcessManager
.
list
(<
FakeCommand
>[
cmakeGenerationCommand
(),
...
...
@@ -275,10 +275,10 @@ C:\foo\windows\runner\main.cpp(17,1): error C2065: 'Baz': undeclared identifier
});
testUsingContext
(
'Windows build invokes build and writes generated files'
,
()
async
{
final
FakeVisualStudio
fakeVisualStudio
=
FakeVisualStudio
(
cmakePath
);
final
BuildWindowsCommand
command
=
BuildWindowsCommand
()
..
visualStudioOverride
=
mock
VisualStudio
;
..
visualStudioOverride
=
fake
VisualStudio
;
setUpMockProjectFilesForBuild
();
when
(
mockVisualStudio
.
cmakePath
).
thenReturn
(
cmakePath
);
processManager
=
FakeProcessManager
.
list
(<
FakeCommand
>[
cmakeGenerationCommand
(),
...
...
@@ -340,10 +340,10 @@ C:\foo\windows\runner\main.cpp(17,1): error C2065: 'Baz': undeclared identifier
});
testUsingContext
(
'Windows profile build passes Profile configuration'
,
()
async
{
final
FakeVisualStudio
fakeVisualStudio
=
FakeVisualStudio
(
cmakePath
);
final
BuildWindowsCommand
command
=
BuildWindowsCommand
()
..
visualStudioOverride
=
mock
VisualStudio
;
..
visualStudioOverride
=
fake
VisualStudio
;
setUpMockProjectFilesForBuild
();
when
(
mockVisualStudio
.
cmakePath
).
thenReturn
(
cmakePath
);
processManager
=
FakeProcessManager
.
list
(<
FakeCommand
>[
cmakeGenerationCommand
(),
...
...
@@ -375,10 +375,10 @@ C:\foo\windows\runner\main.cpp(17,1): error C2065: 'Baz': undeclared identifier
});
testUsingContext
(
'Performs code size analysis and sends analytics'
,
()
async
{
final
FakeVisualStudio
fakeVisualStudio
=
FakeVisualStudio
(
cmakePath
);
final
BuildWindowsCommand
command
=
BuildWindowsCommand
()
..
visualStudioOverride
=
mock
VisualStudio
;
..
visualStudioOverride
=
fake
VisualStudio
;
setUpMockProjectFilesForBuild
();
when
(
mockVisualStudio
.
cmakePath
).
thenReturn
(
cmakePath
);
fileSystem
.
file
(
r'build\windows\runner\Release\app.so'
)
..
createSync
(
recursive:
true
)
...
...
@@ -423,4 +423,9 @@ C:\foo\windows\runner\main.cpp(17,1): error C2065: 'Baz': undeclared identifier
});
}
class
MockVisualStudio
extends
Mock
implements
VisualStudio
{}
class
FakeVisualStudio
extends
Fake
implements
VisualStudio
{
FakeVisualStudio
([
this
.
cmakePath
]);
@override
final
String
cmakePath
;
}
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