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() {
...
@@ -95,14 +95,14 @@ void main() {
group
(
'Gradle'
,
()
{
group
(
'Gradle'
,
()
{
Directory
tempDir
;
Directory
tempDir
;
FakeProcessManager
processManager
;
FakeProcessManager
processManager
;
FakeAndroidSdk
mock
AndroidSdk
;
FakeAndroidSdk
fake
AndroidSdk
;
TestUsage
testUsage
;
TestUsage
testUsage
;
setUp
(()
{
setUp
(()
{
testUsage
=
TestUsage
();
testUsage
=
TestUsage
();
tempDir
=
globals
.
fs
.
systemTempDirectory
.
createTempSync
(
'flutter_tools_packages_test.'
);
tempDir
=
globals
.
fs
.
systemTempDirectory
.
createTempSync
(
'flutter_tools_packages_test.'
);
processManager
=
FakeProcessManager
.
any
();
processManager
=
FakeProcessManager
.
any
();
mock
AndroidSdk
=
FakeAndroidSdk
(
globals
.
fs
.
directory
(
'irrelevant'
));
fake
AndroidSdk
=
FakeAndroidSdk
(
globals
.
fs
.
directory
(
'irrelevant'
));
});
});
tearDown
(()
{
tearDown
(()
{
...
@@ -169,7 +169,7 @@ void main() {
...
@@ -169,7 +169,7 @@ void main() {
));
));
},
},
overrides:
<
Type
,
Generator
>{
overrides:
<
Type
,
Generator
>{
AndroidSdk:
()
=>
mock
AndroidSdk
,
AndroidSdk:
()
=>
fake
AndroidSdk
,
FlutterProjectFactory:
()
=>
FakeFlutterProjectFactory
(
tempDir
),
FlutterProjectFactory:
()
=>
FakeFlutterProjectFactory
(
tempDir
),
ProcessManager:
()
=>
processManager
,
ProcessManager:
()
=>
processManager
,
Usage:
()
=>
testUsage
,
Usage:
()
=>
testUsage
,
...
@@ -209,7 +209,7 @@ void main() {
...
@@ -209,7 +209,7 @@ void main() {
));
));
},
},
overrides:
<
Type
,
Generator
>{
overrides:
<
Type
,
Generator
>{
AndroidSdk:
()
=>
mock
AndroidSdk
,
AndroidSdk:
()
=>
fake
AndroidSdk
,
FlutterProjectFactory:
()
=>
FakeFlutterProjectFactory
(
tempDir
),
FlutterProjectFactory:
()
=>
FakeFlutterProjectFactory
(
tempDir
),
ProcessManager:
()
=>
processManager
,
ProcessManager:
()
=>
processManager
,
Usage:
()
=>
testUsage
,
Usage:
()
=>
testUsage
,
...
...
packages/flutter_tools/test/general.shard/dart/generate_synthetic_packages_test.dart
View file @
06a20be5
...
@@ -4,6 +4,8 @@
...
@@ -4,6 +4,8 @@
// @dart = 2.8
// @dart = 2.8
import
'dart:async'
;
import
'package:file/memory.dart'
;
import
'package:file/memory.dart'
;
import
'package:flutter_tools/src/artifacts.dart'
;
import
'package:flutter_tools/src/artifacts.dart'
;
import
'package:flutter_tools/src/base/file_system.dart'
;
import
'package:flutter_tools/src/base/file_system.dart'
;
...
@@ -11,11 +13,11 @@ import 'package:flutter_tools/src/base/logger.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/dart/generate_synthetic_packages.dart'
;
import
'package:flutter_tools/src/build_system/build_system.dart'
;
import
'package:flutter_tools/src/build_system/build_system.dart'
;
import
'package:flutter_tools/src/build_system/targets/localizations.dart'
;
import
'package:flutter_tools/src/build_system/targets/localizations.dart'
;
import
'package:mockito/mockito.dart'
;
import
'../../src/common.dart'
;
import
'../../src/common.dart'
;
import
'../../src/context.dart'
;
import
'../../src/context.dart'
;
import
'../../src/fake_process_manager.dart'
;
import
'../../src/fake_process_manager.dart'
;
import
'../../src/fakes.dart'
;
void
main
(
)
{
void
main
(
)
{
testWithoutContext
(
'calls buildSystem.build with blank l10n.yaml file'
,
()
async
{
testWithoutContext
(
'calls buildSystem.build with blank l10n.yaml file'
,
()
async
{
...
@@ -42,7 +44,15 @@ void main() {
...
@@ -42,7 +44,15 @@ void main() {
artifacts:
artifacts
,
artifacts:
artifacts
,
processManager:
FakeProcessManager
.
any
(),
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
(
await
expectLater
(
()
=>
generateLocalizationsSyntheticPackage
(
()
=>
generateLocalizationsSyntheticPackage
(
...
@@ -51,11 +61,7 @@ void main() {
...
@@ -51,11 +61,7 @@ void main() {
),
),
throwsToolExit
(
message:
'Generating synthetic localizations package has failed.'
),
throwsToolExit
(
message:
'Generating synthetic localizations package has failed.'
),
);
);
// [BuildSystem] should have called build with [GenerateLocalizationsTarget].
await
completer
.
future
;
verify
(
buildSystem
.
build
(
const
GenerateLocalizationsTarget
(),
environment
,
)).
called
(
1
);
});
});
testWithoutContext
(
'calls buildSystem.build with l10n.yaml synthetic-package: true'
,
()
async
{
testWithoutContext
(
'calls buildSystem.build with l10n.yaml synthetic-package: true'
,
()
async
{
...
@@ -83,7 +89,15 @@ void main() {
...
@@ -83,7 +89,15 @@ void main() {
artifacts:
artifacts
,
artifacts:
artifacts
,
processManager:
fakeProcessManager
,
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
(
await
expectLater
(
()
=>
generateLocalizationsSyntheticPackage
(
()
=>
generateLocalizationsSyntheticPackage
(
...
@@ -92,11 +106,7 @@ void main() {
...
@@ -92,11 +106,7 @@ void main() {
),
),
throwsToolExit
(
message:
'Generating synthetic localizations package has failed.'
),
throwsToolExit
(
message:
'Generating synthetic localizations package has failed.'
),
);
);
// [BuildSystem] should have called build with [GenerateLocalizationsTarget].
await
completer
.
future
;
verify
(
buildSystem
.
build
(
const
GenerateLocalizationsTarget
(),
environment
,
)).
called
(
1
);
});
});
testWithoutContext
(
'calls buildSystem.build with l10n.yaml synthetic-package: null'
,
()
async
{
testWithoutContext
(
'calls buildSystem.build with l10n.yaml synthetic-package: null'
,
()
async
{
...
@@ -122,7 +132,15 @@ void main() {
...
@@ -122,7 +132,15 @@ void main() {
artifacts:
Artifacts
.
test
(),
artifacts:
Artifacts
.
test
(),
processManager:
FakeProcessManager
.
any
(),
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
(
await
expectLater
(
()
=>
generateLocalizationsSyntheticPackage
(
()
=>
generateLocalizationsSyntheticPackage
(
...
@@ -131,11 +149,7 @@ void main() {
...
@@ -131,11 +149,7 @@ void main() {
),
),
throwsToolExit
(
message:
'Generating synthetic localizations package has failed.'
),
throwsToolExit
(
message:
'Generating synthetic localizations package has failed.'
),
);
);
// [BuildSystem] should have called build with [GenerateLocalizationsTarget].
await
completer
.
future
;
verify
(
buildSystem
.
build
(
const
GenerateLocalizationsTarget
(),
environment
,
)).
called
(
1
);
});
});
testWithoutContext
(
'does not call buildSystem.build when l10n.yaml is not present'
,
()
async
{
testWithoutContext
(
'does not call buildSystem.build when l10n.yaml is not present'
,
()
async
{
...
@@ -158,17 +172,13 @@ void main() {
...
@@ -158,17 +172,13 @@ void main() {
artifacts:
Artifacts
.
test
(),
artifacts:
Artifacts
.
test
(),
processManager:
FakeProcessManager
.
any
(),
processManager:
FakeProcessManager
.
any
(),
);
);
final
BuildSystem
buildSystem
=
MockBuildSystem
();
// Will throw if build is called.
final
TestBuildSystem
buildSystem
=
TestBuildSystem
.
all
(
null
);
await
generateLocalizationsSyntheticPackage
(
await
generateLocalizationsSyntheticPackage
(
environment:
environment
,
environment:
environment
,
buildSystem:
buildSystem
,
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
{
testWithoutContext
(
'does not call buildSystem.build with incorrect l10n.yaml format'
,
()
async
{
...
@@ -194,7 +204,8 @@ void main() {
...
@@ -194,7 +204,8 @@ void main() {
artifacts:
Artifacts
.
test
(),
artifacts:
Artifacts
.
test
(),
processManager:
FakeProcessManager
.
any
(),
processManager:
FakeProcessManager
.
any
(),
);
);
final
BuildSystem
buildSystem
=
MockBuildSystem
();
// Will throw if build is called.
final
TestBuildSystem
buildSystem
=
TestBuildSystem
.
all
(
null
);
await
expectLater
(
await
expectLater
(
()
=>
generateLocalizationsSyntheticPackage
(
()
=>
generateLocalizationsSyntheticPackage
(
...
@@ -203,11 +214,6 @@ void main() {
...
@@ -203,11 +214,6 @@ void main() {
),
),
throwsToolExit
(
message:
'to contain a map, instead was helloWorld'
),
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
{
testWithoutContext
(
'does not call buildSystem.build with non-bool "synthetic-package" value'
,
()
async
{
...
@@ -233,7 +239,8 @@ void main() {
...
@@ -233,7 +239,8 @@ void main() {
artifacts:
Artifacts
.
test
(),
artifacts:
Artifacts
.
test
(),
processManager:
FakeProcessManager
.
any
(),
processManager:
FakeProcessManager
.
any
(),
);
);
final
BuildSystem
buildSystem
=
MockBuildSystem
();
// Will throw if build is called.
final
TestBuildSystem
buildSystem
=
TestBuildSystem
.
all
(
null
);
await
expectLater
(
await
expectLater
(
()
=>
generateLocalizationsSyntheticPackage
(
()
=>
generateLocalizationsSyntheticPackage
(
...
@@ -242,12 +249,5 @@ void main() {
...
@@ -242,12 +249,5 @@ void main() {
),
),
throwsToolExit
(
message:
'to have a bool value, instead was "nonBoolValue"'
),
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 {
...
@@ -660,7 +660,7 @@ class TestBuildSystem implements BuildSystem {
return
_singleResult
;
return
_singleResult
;
}
}
if
(
_nextResult
>=
_results
.
length
)
{
if
(
_nextResult
>=
_results
.
length
)
{
throw
StateError
(
'Unexpected build
Incremental
request of
${target.name}
'
);
throw
StateError
(
'Unexpected build request of
${target.name}
'
);
}
}
return
_results
[
_nextResult
++];
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