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
06a20be5
Unverified
Commit
06a20be5
authored
Mar 12, 2021
by
Jenn Magder
Committed by
GitHub
Mar 12, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove MockBuildSystem from generate_synthetic_packages_test (#77983)
parent
82675474
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
44 additions
and
44 deletions
+44
-44
build_appbundle_test.dart
...s/test/commands.shard/permeable/build_appbundle_test.dart
+4
-4
generate_synthetic_packages_test.dart
.../general.shard/dart/generate_synthetic_packages_test.dart
+39
-39
fakes.dart
packages/flutter_tools/test/src/fakes.dart
+1
-1
No files found.
packages/flutter_tools/test/commands.shard/permeable/build_appbundle_test.dart
View file @
06a20be5
...
...
@@ -95,14 +95,14 @@ void main() {
group
(
'Gradle'
,
()
{
Directory
tempDir
;
FakeProcessManager
processManager
;
FakeAndroidSdk
mock
AndroidSdk
;
FakeAndroidSdk
fake
AndroidSdk
;
TestUsage
testUsage
;
setUp
(()
{
testUsage
=
TestUsage
();
tempDir
=
globals
.
fs
.
systemTempDirectory
.
createTempSync
(
'flutter_tools_packages_test.'
);
processManager
=
FakeProcessManager
.
any
();
mock
AndroidSdk
=
FakeAndroidSdk
(
globals
.
fs
.
directory
(
'irrelevant'
));
fake
AndroidSdk
=
FakeAndroidSdk
(
globals
.
fs
.
directory
(
'irrelevant'
));
});
tearDown
(()
{
...
...
@@ -169,7 +169,7 @@ void main() {
));
},
overrides:
<
Type
,
Generator
>{
AndroidSdk:
()
=>
mock
AndroidSdk
,
AndroidSdk:
()
=>
fake
AndroidSdk
,
FlutterProjectFactory:
()
=>
FakeFlutterProjectFactory
(
tempDir
),
ProcessManager:
()
=>
processManager
,
Usage:
()
=>
testUsage
,
...
...
@@ -209,7 +209,7 @@ void main() {
));
},
overrides:
<
Type
,
Generator
>{
AndroidSdk:
()
=>
mock
AndroidSdk
,
AndroidSdk:
()
=>
fake
AndroidSdk
,
FlutterProjectFactory:
()
=>
FakeFlutterProjectFactory
(
tempDir
),
ProcessManager:
()
=>
processManager
,
Usage:
()
=>
testUsage
,
...
...
packages/flutter_tools/test/general.shard/dart/generate_synthetic_packages_test.dart
View file @
06a20be5
...
...
@@ -4,6 +4,8 @@
// @dart = 2.8
import
'dart:async'
;
import
'package:file/memory.dart'
;
import
'package:flutter_tools/src/artifacts.dart'
;
import
'package:flutter_tools/src/base/file_system.dart'
;
...
...
@@ -11,11 +13,11 @@ import 'package:flutter_tools/src/base/logger.dart';
import
'package:flutter_tools/src/dart/generate_synthetic_packages.dart'
;
import
'package:flutter_tools/src/build_system/build_system.dart'
;
import
'package:flutter_tools/src/build_system/targets/localizations.dart'
;
import
'package:mockito/mockito.dart'
;
import
'../../src/common.dart'
;
import
'../../src/context.dart'
;
import
'../../src/fake_process_manager.dart'
;
import
'../../src/fakes.dart'
;
void
main
(
)
{
testWithoutContext
(
'calls buildSystem.build with blank l10n.yaml file'
,
()
async
{
...
...
@@ -42,7 +44,15 @@ void main() {
artifacts:
artifacts
,
processManager:
FakeProcessManager
.
any
(),
);
final
BuildSystem
buildSystem
=
MockBuildSystem
();
final
Completer
<
void
>
completer
=
Completer
<
void
>();
final
BuildResult
exception
=
BuildResult
(
success:
false
,
exceptions:
<
String
,
ExceptionMeasurement
>{
'hello'
:
ExceptionMeasurement
(
'hello'
,
'bar'
,
null
),
});
final
TestBuildSystem
buildSystem
=
TestBuildSystem
.
all
(
exception
,
(
Target
target
,
Environment
environment
)
{
expect
(
target
,
const
GenerateLocalizationsTarget
());
expect
(
environment
,
environment
);
completer
.
complete
();
});
await
expectLater
(
()
=>
generateLocalizationsSyntheticPackage
(
...
...
@@ -51,11 +61,7 @@ void main() {
),
throwsToolExit
(
message:
'Generating synthetic localizations package has failed.'
),
);
// [BuildSystem] should have called build with [GenerateLocalizationsTarget].
verify
(
buildSystem
.
build
(
const
GenerateLocalizationsTarget
(),
environment
,
)).
called
(
1
);
await
completer
.
future
;
});
testWithoutContext
(
'calls buildSystem.build with l10n.yaml synthetic-package: true'
,
()
async
{
...
...
@@ -83,7 +89,15 @@ void main() {
artifacts:
artifacts
,
processManager:
fakeProcessManager
,
);
final
BuildSystem
buildSystem
=
MockBuildSystem
();
final
Completer
<
void
>
completer
=
Completer
<
void
>();
final
BuildResult
exception
=
BuildResult
(
success:
false
,
exceptions:
<
String
,
ExceptionMeasurement
>{
'hello'
:
ExceptionMeasurement
(
'hello'
,
'bar'
,
null
),
});
final
TestBuildSystem
buildSystem
=
TestBuildSystem
.
all
(
exception
,
(
Target
target
,
Environment
environment
)
{
expect
(
target
,
const
GenerateLocalizationsTarget
());
expect
(
environment
,
environment
);
completer
.
complete
();
});
await
expectLater
(
()
=>
generateLocalizationsSyntheticPackage
(
...
...
@@ -92,11 +106,7 @@ void main() {
),
throwsToolExit
(
message:
'Generating synthetic localizations package has failed.'
),
);
// [BuildSystem] should have called build with [GenerateLocalizationsTarget].
verify
(
buildSystem
.
build
(
const
GenerateLocalizationsTarget
(),
environment
,
)).
called
(
1
);
await
completer
.
future
;
});
testWithoutContext
(
'calls buildSystem.build with l10n.yaml synthetic-package: null'
,
()
async
{
...
...
@@ -122,7 +132,15 @@ void main() {
artifacts:
Artifacts
.
test
(),
processManager:
FakeProcessManager
.
any
(),
);
final
BuildSystem
buildSystem
=
MockBuildSystem
();
final
Completer
<
void
>
completer
=
Completer
<
void
>();
final
BuildResult
exception
=
BuildResult
(
success:
false
,
exceptions:
<
String
,
ExceptionMeasurement
>{
'hello'
:
ExceptionMeasurement
(
'hello'
,
'bar'
,
null
),
});
final
TestBuildSystem
buildSystem
=
TestBuildSystem
.
all
(
exception
,
(
Target
target
,
Environment
environment
)
{
expect
(
target
,
const
GenerateLocalizationsTarget
());
expect
(
environment
,
environment
);
completer
.
complete
();
});
await
expectLater
(
()
=>
generateLocalizationsSyntheticPackage
(
...
...
@@ -131,11 +149,7 @@ void main() {
),
throwsToolExit
(
message:
'Generating synthetic localizations package has failed.'
),
);
// [BuildSystem] should have called build with [GenerateLocalizationsTarget].
verify
(
buildSystem
.
build
(
const
GenerateLocalizationsTarget
(),
environment
,
)).
called
(
1
);
await
completer
.
future
;
});
testWithoutContext
(
'does not call buildSystem.build when l10n.yaml is not present'
,
()
async
{
...
...
@@ -158,17 +172,13 @@ void main() {
artifacts:
Artifacts
.
test
(),
processManager:
FakeProcessManager
.
any
(),
);
final
BuildSystem
buildSystem
=
MockBuildSystem
();
// Will throw if build is called.
final
TestBuildSystem
buildSystem
=
TestBuildSystem
.
all
(
null
);
await
generateLocalizationsSyntheticPackage
(
environment:
environment
,
buildSystem:
buildSystem
,
);
// [BuildSystem] should not be called with [GenerateLocalizationsTarget].
verifyNever
(
buildSystem
.
build
(
const
GenerateLocalizationsTarget
(),
environment
,
));
});
testWithoutContext
(
'does not call buildSystem.build with incorrect l10n.yaml format'
,
()
async
{
...
...
@@ -194,7 +204,8 @@ void main() {
artifacts:
Artifacts
.
test
(),
processManager:
FakeProcessManager
.
any
(),
);
final
BuildSystem
buildSystem
=
MockBuildSystem
();
// Will throw if build is called.
final
TestBuildSystem
buildSystem
=
TestBuildSystem
.
all
(
null
);
await
expectLater
(
()
=>
generateLocalizationsSyntheticPackage
(
...
...
@@ -203,11 +214,6 @@ void main() {
),
throwsToolExit
(
message:
'to contain a map, instead was helloWorld'
),
);
// [BuildSystem] should not be called with [GenerateLocalizationsTarget].
verifyNever
(
buildSystem
.
build
(
const
GenerateLocalizationsTarget
(),
environment
,
));
});
testWithoutContext
(
'does not call buildSystem.build with non-bool "synthetic-package" value'
,
()
async
{
...
...
@@ -233,7 +239,8 @@ void main() {
artifacts:
Artifacts
.
test
(),
processManager:
FakeProcessManager
.
any
(),
);
final
BuildSystem
buildSystem
=
MockBuildSystem
();
// Will throw if build is called.
final
TestBuildSystem
buildSystem
=
TestBuildSystem
.
all
(
null
);
await
expectLater
(
()
=>
generateLocalizationsSyntheticPackage
(
...
...
@@ -242,12 +249,5 @@ void main() {
),
throwsToolExit
(
message:
'to have a bool value, instead was "nonBoolValue"'
),
);
// [BuildSystem] should not be called with [GenerateLocalizationsTarget].
verifyNever
(
buildSystem
.
build
(
const
GenerateLocalizationsTarget
(),
environment
,
));
});
}
class
MockBuildSystem
extends
Mock
implements
BuildSystem
{}
packages/flutter_tools/test/src/fakes.dart
View file @
06a20be5
...
...
@@ -660,7 +660,7 @@ class TestBuildSystem implements BuildSystem {
return
_singleResult
;
}
if
(
_nextResult
>=
_results
.
length
)
{
throw
StateError
(
'Unexpected build
Incremental
request of
${target.name}
'
);
throw
StateError
(
'Unexpected build request of
${target.name}
'
);
}
return
_results
[
_nextResult
++];
}
...
...
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