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
36fca52c
Unverified
Commit
36fca52c
authored
Sep 30, 2020
by
Jenn Magder
Committed by
GitHub
Sep 30, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Replace MockArtifacts with Artifacts.test() (#67012)
parent
b92bb62d
Changes
16
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
231 additions
and
296 deletions
+231
-296
doctor_test.dart
...utter_tools/test/commands.shard/hermetic/doctor_test.dart
+8
-9
run_test.dart
.../flutter_tools/test/commands.shard/hermetic/run_test.dart
+3
-10
build_test.dart
...ges/flutter_tools/test/general.shard/base/build_test.dart
+48
-43
build_system_test.dart
...ls/test/general.shard/build_system/build_system_test.dart
+8
-12
file_store_test.dart
...ools/test/general.shard/build_system/file_store_test.dart
+0
-2
assets_test.dart
.../test/general.shard/build_system/targets/assets_test.dart
+1
-4
icon_tree_shaker_test.dart
...ral.shard/build_system/targets/icon_tree_shaker_test.dart
+48
-47
linux_test.dart
...s/test/general.shard/build_system/targets/linux_test.dart
+21
-31
web_test.dart
...ols/test/general.shard/build_system/targets/web_test.dart
+1
-2
windows_test.dart
...test/general.shard/build_system/targets/windows_test.dart
+36
-52
generate_synthetic_packages_test.dart
.../general.shard/dart/generate_synthetic_packages_test.dart
+8
-12
fuchsia_device_test.dart
...tools/test/general.shard/fuchsia/fuchsia_device_test.dart
+32
-43
devices_test.dart
...es/flutter_tools/test/general.shard/ios/devices_test.dart
+7
-12
ios_device_logger_test.dart
..._tools/test/general.shard/ios/ios_device_logger_test.dart
+10
-11
ios_device_project_test.dart
...tools/test/general.shard/ios/ios_device_project_test.dart
+0
-5
mac_test.dart
packages/flutter_tools/test/general.shard/ios/mac_test.dart
+0
-1
No files found.
packages/flutter_tools/test/commands.shard/hermetic/doctor_test.dart
View file @
36fca52c
...
...
@@ -424,14 +424,14 @@ void main() {
});
group
(
'doctor with fake validators'
,
()
{
MockArtifacts
mockA
rtifacts
;
const
String
genSnapshotPath
=
'/path/to/gen_snapshot'
;
Artifacts
a
rtifacts
;
String
genSnapshotPath
;
FileSystem
memoryFileSystem
;
setUp
(()
{
memoryFileSystem
=
MemoryFileSystem
.
test
();
mockArtifacts
=
MockArtifacts
();
when
(
mockArtifacts
.
getArtifactPath
(
Artifact
.
genSnapshot
)).
thenReturn
(
genSnapshotPath
);
artifacts
=
Artifacts
.
test
();
genSnapshotPath
=
artifacts
.
getArtifactPath
(
Artifact
.
genSnapshot
);
});
testUsingContext
(
'validate non-verbose output format for run without issues'
,
()
async
{
...
...
@@ -594,7 +594,7 @@ void main() {
}
}
},
overrides:
<
Type
,
Generator
>{
Artifacts:
()
=>
mockA
rtifacts
,
Artifacts:
()
=>
a
rtifacts
,
FileSystem:
()
=>
memoryFileSystem
,
OutputPreferences:
()
=>
OutputPreferences
(
wrapText:
false
),
ProcessManager:
()
=>
mockProcessManager
,
...
...
@@ -607,7 +607,7 @@ void main() {
// fail if the gen_snapshot binary is not present.
expect
(
logger
.
statusText
,
contains
(
'No issues found!'
));
},
overrides:
<
Type
,
Generator
>{
Artifacts:
()
=>
mockA
rtifacts
,
Artifacts:
()
=>
a
rtifacts
,
FileSystem:
()
=>
MemoryFileSystem
.
test
(),
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
});
...
...
@@ -635,7 +635,7 @@ void main() {
'! Doctor found issues in 1 category.
\n
'
));
},
overrides:
<
Type
,
Generator
>{
Artifacts:
()
=>
mockA
rtifacts
,
Artifacts:
()
=>
a
rtifacts
,
FileSystem:
()
=>
memoryFileSystem
,
OutputPreferences:
()
=>
OutputPreferences
(
wrapText:
false
),
ProcessManager:
()
=>
mockProcessManager
,
...
...
@@ -653,7 +653,7 @@ void main() {
expect
(
logger
.
statusText
,
contains
(
'Pub download mirror https://example.com/pub'
));
expect
(
logger
.
statusText
,
contains
(
'Flutter download mirror https://example.com/flutter'
));
},
overrides:
<
Type
,
Generator
>{
Artifacts:
()
=>
mockA
rtifacts
,
Artifacts:
()
=>
a
rtifacts
,
FileSystem:
()
=>
memoryFileSystem
,
OutputPreferences:
()
=>
OutputPreferences
(
wrapText:
false
),
ProcessManager:
()
=>
mockProcessManager
,
...
...
@@ -1239,7 +1239,6 @@ class VsCodeValidatorTestTargets extends VsCodeValidator {
}
class
MockProcessManager
extends
Mock
implements
ProcessManager
{}
class
MockArtifacts
extends
Mock
implements
Artifacts
{}
class
MockPlistParser
extends
Mock
implements
PlistParser
{}
class
MockDeviceManager
extends
Mock
implements
DeviceManager
{}
class
MockDevice
extends
Mock
implements
Device
{
...
...
packages/flutter_tools/test/commands.shard/hermetic/run_test.dart
View file @
36fca52c
...
...
@@ -140,14 +140,14 @@ void main() {
group
(
'run app'
,
()
{
MemoryFileSystem
fs
;
MockArtifacts
mockA
rtifacts
;
Artifacts
a
rtifacts
;
MockCache
mockCache
;
MockProcessManager
mockProcessManager
;
MockUsage
mockUsage
;
Directory
tempDir
;
setUp
(()
{
mockArtifacts
=
MockArtifacts
();
artifacts
=
Artifacts
.
test
();
mockCache
=
MockCache
();
mockUsage
=
MockUsage
();
fs
=
MemoryFileSystem
.
test
();
...
...
@@ -357,12 +357,6 @@ void main() {
userIdentifier:
anyNamed
(
'userIdentifier'
),
)).
thenAnswer
((
Invocation
invocation
)
=>
Future
<
LaunchResult
>.
value
(
LaunchResult
.
failed
()));
when
(
mockArtifacts
.
getArtifactPath
(
Artifact
.
flutterPatchedSdkPath
,
platform:
anyNamed
(
'platform'
),
mode:
anyNamed
(
'mode'
),
)).
thenReturn
(
'/path/to/sdk'
);
when
(
mockDeviceManager
.
getDevices
()).
thenAnswer
(
(
Invocation
invocation
)
=>
Future
<
List
<
Device
>>.
value
(<
Device
>[
mockDevice
])
);
...
...
@@ -409,7 +403,7 @@ void main() {
expect
(
parameters
.
containsKey
(
cdKey
(
CustomDimensions
.
commandRunAndroidEmbeddingVersion
)),
false
);
},
overrides:
<
Type
,
Generator
>{
ApplicationPackageFactory:
()
=>
mockApplicationPackageFactory
,
Artifacts:
()
=>
mockA
rtifacts
,
Artifacts:
()
=>
a
rtifacts
,
Cache:
()
=>
mockCache
,
DeviceManager:
()
=>
mockDeviceManager
,
FileSystem:
()
=>
fs
,
...
...
@@ -541,7 +535,6 @@ void main() {
});
}
class
MockArtifacts
extends
Mock
implements
Artifacts
{}
class
MockCache
extends
Mock
implements
Cache
{}
class
MockUsage
extends
Mock
implements
Usage
{}
...
...
packages/flutter_tools/test/general.shard/base/build_test.dart
View file @
36fca52c
...
...
@@ -12,7 +12,6 @@ import 'package:flutter_tools/src/build_info.dart';
import
'package:flutter_tools/src/ios/xcodeproj.dart'
;
import
'package:flutter_tools/src/macos/xcode.dart'
;
import
'package:flutter_tools/src/reporting/reporting.dart'
;
import
'package:mockito/mockito.dart'
;
import
'../../src/common.dart'
;
import
'../../src/context.dart'
;
...
...
@@ -82,30 +81,30 @@ void main() {
group
(
'GenSnapshot'
,
()
{
GenSnapshot
genSnapshot
;
MockArtifacts
mockA
rtifacts
;
Artifacts
a
rtifacts
;
FakeProcessManager
processManager
;
BufferLogger
logger
;
setUp
(()
async
{
mockArtifacts
=
MockArtifacts
();
artifacts
=
Artifacts
.
test
();
logger
=
BufferLogger
.
test
();
processManager
=
FakeProcessManager
.
list
(<
FakeCommand
>[]);
genSnapshot
=
GenSnapshot
(
artifacts:
mockA
rtifacts
,
artifacts:
a
rtifacts
,
logger:
logger
,
processManager:
processManager
,
);
when
(
mockArtifacts
.
getArtifactPath
(
any
,
platform:
anyNamed
(
'platform'
),
mode:
anyNamed
(
'mode'
),
)).
thenReturn
(
'gen_snapshot'
);
});
testWithoutContext
(
'android_x64'
,
()
async
{
processManager
.
addCommand
(
const
FakeCommand
(
command:
<
String
>[
'gen_snapshot'
,
'--additional_arg'
]
));
processManager
.
addCommand
(
FakeCommand
(
command:
<
String
>[
artifacts
.
getArtifactPath
(
Artifact
.
genSnapshot
,
platform:
TargetPlatform
.
android_x64
,
mode:
BuildMode
.
release
),
'--additional_arg'
],
),
);
final
int
result
=
await
genSnapshot
.
run
(
snapshotType:
SnapshotType
(
TargetPlatform
.
android_x64
,
BuildMode
.
release
),
...
...
@@ -116,9 +115,14 @@ void main() {
});
testWithoutContext
(
'iOS armv7'
,
()
async
{
processManager
.
addCommand
(
const
FakeCommand
(
command:
<
String
>[
'gen_snapshot_armv7'
,
'--additional_arg'
]
));
processManager
.
addCommand
(
FakeCommand
(
command:
<
String
>[
artifacts
.
getArtifactPath
(
Artifact
.
genSnapshot
,
platform:
TargetPlatform
.
ios
,
mode:
BuildMode
.
release
)
+
'_armv7'
,
'--additional_arg'
],
),
);
final
int
result
=
await
genSnapshot
.
run
(
snapshotType:
SnapshotType
(
TargetPlatform
.
ios
,
BuildMode
.
release
),
...
...
@@ -129,9 +133,14 @@ void main() {
});
testWithoutContext
(
'iOS arm64'
,
()
async
{
processManager
.
addCommand
(
const
FakeCommand
(
command:
<
String
>[
'gen_snapshot_arm64'
,
'--additional_arg'
]
));
processManager
.
addCommand
(
FakeCommand
(
command:
<
String
>[
artifacts
.
getArtifactPath
(
Artifact
.
genSnapshot
,
platform:
TargetPlatform
.
ios
,
mode:
BuildMode
.
release
)
+
'_arm64'
,
'--additional_arg'
,
],
),
);
final
int
result
=
await
genSnapshot
.
run
(
snapshotType:
SnapshotType
(
TargetPlatform
.
ios
,
BuildMode
.
release
),
...
...
@@ -143,7 +152,10 @@ void main() {
testWithoutContext
(
'--strip filters error output from gen_snapshot'
,
()
async
{
processManager
.
addCommand
(
FakeCommand
(
command:
const
<
String
>[
'gen_snapshot'
,
'--strip'
],
command:
<
String
>[
artifacts
.
getArtifactPath
(
Artifact
.
genSnapshot
,
platform:
TargetPlatform
.
android_x64
,
mode:
BuildMode
.
release
),
'--strip'
,
],
stderr:
'ABC
\n
${GenSnapshot.kIgnoredWarnings.join('\n')}
\n
XYZ
\n
'
));
...
...
@@ -165,7 +177,7 @@ void main() {
group
(
'AOTSnapshotter'
,
()
{
MemoryFileSystem
fileSystem
;
AOTSnapshotter
snapshotter
;
MockArtifacts
mockA
rtifacts
;
Artifacts
a
rtifacts
;
FakeProcessManager
processManager
;
Logger
logger
;
...
...
@@ -173,7 +185,7 @@ void main() {
final
Platform
platform
=
FakePlatform
(
operatingSystem:
'macos'
);
logger
=
BufferLogger
.
test
();
fileSystem
=
MemoryFileSystem
.
test
();
mockArtifacts
=
MockArtifacts
();
artifacts
=
Artifacts
.
test
();
processManager
=
FakeProcessManager
.
list
(<
FakeCommand
>[]);
snapshotter
=
AOTSnapshotter
(
fileSystem:
fileSystem
,
...
...
@@ -192,14 +204,9 @@ void main() {
usage:
Usage
.
test
(),
),
),
artifacts:
mockA
rtifacts
,
artifacts:
a
rtifacts
,
processManager:
processManager
,
);
when
(
mockArtifacts
.
getArtifactPath
(
Artifact
.
genSnapshot
,
platform:
anyNamed
(
'platform'
),
mode:
anyNamed
(
'mode'
)),
).
thenReturn
(
'gen_snapshot'
);
});
testWithoutContext
(
'does not build iOS with debug build mode'
,
()
async
{
...
...
@@ -253,7 +260,7 @@ void main() {
final
String
assembly
=
fileSystem
.
path
.
join
(
outputPath
,
'snapshot_assembly.S'
);
processManager
.
addCommand
(
FakeCommand
(
command:
<
String
>[
'gen_snapshot
_armv7'
,
artifacts
.
getArtifactPath
(
Artifact
.
genSnapshot
,
platform:
TargetPlatform
.
ios
,
mode:
BuildMode
.
profile
)
+
'
_armv7'
,
'--deterministic'
,
'--snapshot_kind=app-aot-assembly'
,
'--assembly=
$assembly
'
,
...
...
@@ -313,7 +320,7 @@ void main() {
final
String
debugPath
=
fileSystem
.
path
.
join
(
'foo'
,
'app.ios-armv7.symbols'
);
processManager
.
addCommand
(
FakeCommand
(
command:
<
String
>[
'gen_snapshot
_armv7'
,
artifacts
.
getArtifactPath
(
Artifact
.
genSnapshot
,
platform:
TargetPlatform
.
ios
,
mode:
BuildMode
.
profile
)
+
'
_armv7'
,
'--deterministic'
,
'--snapshot_kind=app-aot-assembly'
,
'--assembly=
$assembly
'
,
...
...
@@ -373,7 +380,7 @@ void main() {
final
String
assembly
=
fileSystem
.
path
.
join
(
outputPath
,
'snapshot_assembly.S'
);
processManager
.
addCommand
(
FakeCommand
(
command:
<
String
>[
'gen_snapshot
_armv7'
,
artifacts
.
getArtifactPath
(
Artifact
.
genSnapshot
,
platform:
TargetPlatform
.
ios
,
mode:
BuildMode
.
profile
)
+
'
_armv7'
,
'--deterministic'
,
'--snapshot_kind=app-aot-assembly'
,
'--assembly=
$assembly
'
,
...
...
@@ -432,7 +439,7 @@ void main() {
final
String
outputPath
=
fileSystem
.
path
.
join
(
'build'
,
'foo'
);
processManager
.
addCommand
(
FakeCommand
(
command:
<
String
>[
'gen_snapshot
_armv7'
,
artifacts
.
getArtifactPath
(
Artifact
.
genSnapshot
,
platform:
TargetPlatform
.
ios
,
mode:
BuildMode
.
release
)
+
'
_armv7'
,
'--deterministic'
,
'--snapshot_kind=app-aot-assembly'
,
'--assembly=
${fileSystem.path.join(outputPath, 'snapshot_assembly.S')}
'
,
...
...
@@ -489,7 +496,7 @@ void main() {
final
String
outputPath
=
fileSystem
.
path
.
join
(
'build'
,
'foo'
);
processManager
.
addCommand
(
FakeCommand
(
command:
<
String
>[
'gen_snapshot
_arm64'
,
artifacts
.
getArtifactPath
(
Artifact
.
genSnapshot
,
platform:
TargetPlatform
.
ios
,
mode:
BuildMode
.
release
)
+
'
_arm64'
,
'--deterministic'
,
'--snapshot_kind=app-aot-assembly'
,
'--assembly=
${fileSystem.path.join(outputPath, 'snapshot_assembly.S')}
'
,
...
...
@@ -542,9 +549,9 @@ void main() {
testWithoutContext
(
'builds shared library for android-arm (32bit)'
,
()
async
{
final
String
outputPath
=
fileSystem
.
path
.
join
(
'build'
,
'foo'
);
processManager
.
addCommand
(
const
FakeCommand
(
processManager
.
addCommand
(
FakeCommand
(
command:
<
String
>[
'gen_snapshot'
,
artifacts
.
getArtifactPath
(
Artifact
.
genSnapshot
,
platform:
TargetPlatform
.
android_arm
,
mode:
BuildMode
.
release
)
,
'--deterministic'
,
'--snapshot_kind=app-aot-elf'
,
'--elf=build/foo/app.so'
,
...
...
@@ -577,7 +584,7 @@ void main() {
final
String
debugPath
=
fileSystem
.
path
.
join
(
'foo'
,
'app.android-arm.symbols'
);
processManager
.
addCommand
(
FakeCommand
(
command:
<
String
>[
'gen_snapshot'
,
artifacts
.
getArtifactPath
(
Artifact
.
genSnapshot
,
platform:
TargetPlatform
.
android_arm
,
mode:
BuildMode
.
release
)
,
'--deterministic'
,
'--snapshot_kind=app-aot-elf'
,
'--elf=build/foo/app.so'
,
...
...
@@ -609,9 +616,9 @@ void main() {
testWithoutContext
(
'builds shared library for android-arm with obfuscate'
,
()
async
{
final
String
outputPath
=
fileSystem
.
path
.
join
(
'build'
,
'foo'
);
processManager
.
addCommand
(
const
FakeCommand
(
processManager
.
addCommand
(
FakeCommand
(
command:
<
String
>[
'gen_snapshot'
,
artifacts
.
getArtifactPath
(
Artifact
.
genSnapshot
,
platform:
TargetPlatform
.
android_arm
,
mode:
BuildMode
.
release
)
,
'--deterministic'
,
'--snapshot_kind=app-aot-elf'
,
'--elf=build/foo/app.so'
,
...
...
@@ -642,9 +649,9 @@ void main() {
testWithoutContext
(
'builds shared library for android-arm without dwarf stack traces due to empty string'
,
()
async
{
final
String
outputPath
=
fileSystem
.
path
.
join
(
'build'
,
'foo'
);
processManager
.
addCommand
(
const
FakeCommand
(
processManager
.
addCommand
(
FakeCommand
(
command:
<
String
>[
'gen_snapshot'
,
artifacts
.
getArtifactPath
(
Artifact
.
genSnapshot
,
platform:
TargetPlatform
.
android_arm
,
mode:
BuildMode
.
release
)
,
'--deterministic'
,
'--snapshot_kind=app-aot-elf'
,
'--elf=build/foo/app.so'
,
...
...
@@ -674,9 +681,9 @@ void main() {
testWithoutContext
(
'builds shared library for android-arm64'
,
()
async
{
final
String
outputPath
=
fileSystem
.
path
.
join
(
'build'
,
'foo'
);
processManager
.
addCommand
(
const
FakeCommand
(
processManager
.
addCommand
(
FakeCommand
(
command:
<
String
>[
'gen_snapshot'
,
artifacts
.
getArtifactPath
(
Artifact
.
genSnapshot
,
platform:
TargetPlatform
.
android_arm64
,
mode:
BuildMode
.
release
)
,
'--deterministic'
,
'--snapshot_kind=app-aot-elf'
,
'--elf=build/foo/app.so'
,
...
...
@@ -703,5 +710,3 @@ void main() {
});
});
}
class
MockArtifacts
extends
Mock
implements
Artifacts
{}
packages/flutter_tools/test/general.shard/build_system/build_system_test.dart
View file @
36fca52c
...
...
@@ -12,7 +12,6 @@ import 'package:flutter_tools/src/base/utils.dart';
import
'package:flutter_tools/src/build_system/build_system.dart'
;
import
'package:flutter_tools/src/build_system/exceptions.dart'
;
import
'package:flutter_tools/src/convert.dart'
;
import
'package:mockito/mockito.dart'
;
import
'../../src/common.dart'
;
import
'../../src/context.dart'
;
...
...
@@ -84,8 +83,7 @@ void main() {
..
inputs
=
const
<
Source
>[
Source
.
pattern
(
'{PROJECT_DIR}/foo.dart'
),
];
final
MockArtifacts
artifacts
=
MockArtifacts
();
when
(
artifacts
.
isLocalEngine
).
thenReturn
(
false
);
final
Artifacts
artifacts
=
Artifacts
.
test
();
environment
=
Environment
.
test
(
fileSystem
.
currentDirectory
,
artifacts:
artifacts
,
...
...
@@ -386,7 +384,7 @@ void main() {
final
Environment
environmentA
=
Environment
.
test
(
fileSystem
.
currentDirectory
,
outputDir:
fileSystem
.
directory
(
'a'
),
artifacts:
MockArtifacts
(),
artifacts:
Artifacts
.
test
(),
processManager:
FakeProcessManager
.
any
(),
fileSystem:
fileSystem
,
logger:
BufferLogger
.
test
(),
...
...
@@ -394,7 +392,7 @@ void main() {
final
Environment
environmentB
=
Environment
.
test
(
fileSystem
.
currentDirectory
,
outputDir:
fileSystem
.
directory
(
'b'
),
artifacts:
MockArtifacts
(),
artifacts:
Artifacts
.
test
(),
processManager:
FakeProcessManager
.
any
(),
fileSystem:
fileSystem
,
logger:
BufferLogger
.
test
(),
...
...
@@ -406,7 +404,7 @@ void main() {
testWithoutContext
(
'Additional inputs do not change the build configuration'
,
()
async
{
final
Environment
environmentA
=
Environment
.
test
(
fileSystem
.
currentDirectory
,
artifacts:
MockArtifacts
(),
artifacts:
Artifacts
.
test
(),
processManager:
FakeProcessManager
.
any
(),
fileSystem:
fileSystem
,
logger:
BufferLogger
.
test
(),
...
...
@@ -416,7 +414,7 @@ void main() {
);
final
Environment
environmentB
=
Environment
.
test
(
fileSystem
.
currentDirectory
,
artifacts:
MockArtifacts
(),
artifacts:
Artifacts
.
test
(),
processManager:
FakeProcessManager
.
any
(),
fileSystem:
fileSystem
,
logger:
BufferLogger
.
test
(),
...
...
@@ -479,7 +477,7 @@ void main() {
final
Environment
environment
=
Environment
.
test
(
fileSystem
.
currentDirectory
,
outputDir:
fileSystem
.
directory
(
'a/b/c/d'
),
artifacts:
MockArtifacts
(),
artifacts:
Artifacts
.
test
(),
processManager:
FakeProcessManager
.
any
(),
fileSystem:
fileSystem
,
logger:
BufferLogger
.
test
(),
...
...
@@ -561,7 +559,7 @@ void main() {
defines:
<
String
,
String
>{
'config'
:
'debug'
,
},
artifacts:
MockArtifacts
(),
artifacts:
Artifacts
.
test
(),
processManager:
FakeProcessManager
.
any
(),
logger:
BufferLogger
.
test
(),
fileSystem:
fileSystem
,
...
...
@@ -572,7 +570,7 @@ void main() {
defines:
<
String
,
String
>{
'config'
:
'profile'
,
},
artifacts:
MockArtifacts
(),
artifacts:
Artifacts
.
test
(),
processManager:
FakeProcessManager
.
any
(),
logger:
BufferLogger
.
test
(),
fileSystem:
fileSystem
,
...
...
@@ -688,5 +686,3 @@ class TestTarget extends Target {
@override
List
<
Source
>
outputs
=
<
Source
>[];
}
class
MockArtifacts
extends
Mock
implements
Artifacts
{}
packages/flutter_tools/test/general.shard/build_system/file_store_test.dart
View file @
36fca52c
...
...
@@ -7,7 +7,6 @@ import 'dart:typed_data';
import
'package:crypto/crypto.dart'
;
import
'package:file/memory.dart'
;
import
'package:file_testing/file_testing.dart'
;
import
'package:flutter_tools/src/artifacts.dart'
;
import
'package:flutter_tools/src/base/file_system.dart'
;
import
'package:flutter_tools/src/base/logger.dart'
;
import
'package:flutter_tools/src/build_system/file_store.dart'
;
...
...
@@ -202,4 +201,3 @@ void main() {
}
class
MockFile
extends
Mock
implements
File
{}
class
MockArtifacts
extends
Mock
implements
Artifacts
{}
packages/flutter_tools/test/general.shard/build_system/targets/assets_test.dart
View file @
36fca52c
...
...
@@ -14,7 +14,6 @@ import 'package:flutter_tools/src/build_system/depfile.dart';
import
'package:flutter_tools/src/build_system/targets/assets.dart'
;
import
'package:flutter_tools/src/convert.dart'
;
import
'package:flutter_tools/src/devfs.dart'
;
import
'package:mockito/mockito.dart'
;
import
'../../../src/common.dart'
;
import
'../../../src/context.dart'
;
...
...
@@ -30,7 +29,7 @@ void main() {
environment
=
Environment
.
test
(
fileSystem
.
currentDirectory
,
processManager:
FakeProcessManager
.
any
(),
artifacts:
MockArtifacts
(),
artifacts:
Artifacts
.
test
(),
fileSystem:
fileSystem
,
logger:
BufferLogger
.
test
(),
);
...
...
@@ -248,5 +247,3 @@ flutter:
expect
(
logger
.
errorText
,
isEmpty
);
});
}
class
MockArtifacts
extends
Mock
implements
Artifacts
{}
packages/flutter_tools/test/general.shard/build_system/targets/icon_tree_shaker_test.dart
View file @
36fca52c
...
...
@@ -25,44 +25,39 @@ import '../../../src/mocks.dart' as mocks;
final
Platform
kNoAnsiPlatform
=
FakePlatform
(
stdoutSupportsAnsi:
false
);
const
List
<
int
>
_kTtfHeaderBytes
=
<
int
>[
0
,
1
,
0
,
0
,
0
,
15
,
0
,
128
,
0
,
3
,
0
,
112
];
const
String
dartPath
=
'/flutter/dart'
;
const
String
constFinderPath
=
'/flutter/const_finder.snapshot.dart'
;
const
String
fontSubsetPath
=
'/flutter/font-subset'
;
const
String
inputPath
=
'/input/fonts/MaterialIcons-Regular.otf'
;
const
String
outputPath
=
'/output/fonts/MaterialIcons-Regular.otf'
;
const
String
relativePath
=
'fonts/MaterialIcons-Regular.otf'
;
List
<
String
>
getConstFinderArgs
(
String
appDillPath
)
=>
<
String
>[
dartPath
,
'--disable-dart-dev'
,
constFinderPath
,
'--kernel-file'
,
appDillPath
,
'--class-library-uri'
,
'package:flutter/src/widgets/icon_data.dart'
,
'--class-name'
,
'IconData'
,
];
const
List
<
String
>
fontSubsetArgs
=
<
String
>[
fontSubsetPath
,
outputPath
,
inputPath
,
];
void
main
(
)
{
BufferLogger
logger
;
MemoryFileSystem
fileSystem
;
MockProcessManager
mockProcessManager
;
MockProcess
fontSubsetProcess
;
MockArtifacts
mockA
rtifacts
;
Artifacts
a
rtifacts
;
DevFSStringContent
fontManifestContent
;
String
dartPath
;
String
constFinderPath
;
String
fontSubsetPath
;
List
<
String
>
fontSubsetArgs
;
List
<
String
>
_getConstFinderArgs
(
String
appDillPath
)
=>
<
String
>[
dartPath
,
'--disable-dart-dev'
,
constFinderPath
,
'--kernel-file'
,
appDillPath
,
'--class-library-uri'
,
'package:flutter/src/widgets/icon_data.dart'
,
'--class-name'
,
'IconData'
,
];
void
_addConstFinderInvocation
(
String
appDillPath
,
{
int
exitCode
=
0
,
String
stdout
=
''
,
String
stderr
=
''
,
})
{
when
(
mockProcessManager
.
run
(
getConstFinderArgs
(
appDillPath
))).
thenAnswer
((
_
)
async
{
when
(
mockProcessManager
.
run
(
_
getConstFinderArgs
(
appDillPath
))).
thenAnswer
((
_
)
async
{
return
ProcessResult
(
0
,
exitCode
,
stdout
,
stderr
);
});
}
...
...
@@ -89,7 +84,7 @@ void main() {
mockProcessManager
=
MockProcessManager
();
fontSubsetProcess
=
MockProcess
();
mockArtifacts
=
MockArtifacts
();
artifacts
=
Artifacts
.
test
();
fileSystem
=
MemoryFileSystem
.
test
();
logger
=
BufferLogger
(
terminal:
AnsiTerminal
(
...
...
@@ -99,22 +94,29 @@ void main() {
outputPreferences:
OutputPreferences
.
test
(
showColor:
false
),
);
dartPath
=
artifacts
.
getArtifactPath
(
Artifact
.
engineDartBinary
);
constFinderPath
=
artifacts
.
getArtifactPath
(
Artifact
.
constFinder
);
fontSubsetPath
=
artifacts
.
getArtifactPath
(
Artifact
.
fontSubset
);
fontSubsetArgs
=
<
String
>[
fontSubsetPath
,
outputPath
,
inputPath
,
];
fileSystem
.
file
(
constFinderPath
).
createSync
(
recursive:
true
);
fileSystem
.
file
(
dartPath
).
createSync
(
recursive:
true
);
fileSystem
.
file
(
fontSubsetPath
).
createSync
(
recursive:
true
);
fileSystem
.
file
(
inputPath
)
..
createSync
(
recursive:
true
)
..
writeAsBytesSync
(
_kTtfHeaderBytes
);
when
(
mockArtifacts
.
getArtifactPath
(
Artifact
.
constFinder
)).
thenReturn
(
constFinderPath
);
when
(
mockArtifacts
.
getArtifactPath
(
Artifact
.
fontSubset
)).
thenReturn
(
fontSubsetPath
);
when
(
mockArtifacts
.
getArtifactPath
(
Artifact
.
engineDartBinary
)).
thenReturn
(
dartPath
);
});
Environment
_createEnvironment
(
Map
<
String
,
String
>
defines
)
{
return
Environment
.
test
(
fileSystem
.
directory
(
'/icon_test'
)..
createSync
(
recursive:
true
),
defines:
defines
,
artifacts:
mockA
rtifacts
,
artifacts:
a
rtifacts
,
processManager:
FakeProcessManager
.
any
(),
fileSystem:
fileSystem
,
logger:
BufferLogger
.
test
(),
...
...
@@ -133,7 +135,7 @@ void main() {
logger:
logger
,
processManager:
mockProcessManager
,
fileSystem:
fileSystem
,
artifacts:
mockA
rtifacts
,
artifacts:
a
rtifacts
,
);
expect
(
...
...
@@ -166,7 +168,7 @@ void main() {
logger:
logger
,
processManager:
mockProcessManager
,
fileSystem:
fileSystem
,
artifacts:
mockA
rtifacts
,
artifacts:
a
rtifacts
,
);
expect
(
...
...
@@ -190,7 +192,7 @@ void main() {
logger:
logger
,
processManager:
mockProcessManager
,
fileSystem:
fileSystem
,
artifacts:
mockA
rtifacts
,
artifacts:
a
rtifacts
,
);
expect
(
...
...
@@ -214,7 +216,7 @@ void main() {
logger:
logger
,
processManager:
mockProcessManager
,
fileSystem:
fileSystem
,
artifacts:
mockA
rtifacts
,
artifacts:
a
rtifacts
,
);
expect
(
...
...
@@ -241,7 +243,7 @@ void main() {
logger:
logger
,
processManager:
mockProcessManager
,
fileSystem:
fileSystem
,
artifacts:
mockA
rtifacts
,
artifacts:
a
rtifacts
,
);
final
mocks
.
CompleterIOSink
stdinSink
=
mocks
.
CompleterIOSink
();
...
...
@@ -265,7 +267,7 @@ void main() {
expect
(
subsetted
,
true
);
expect
(
stdinSink
.
writes
,
<
List
<
int
>>[
utf8
.
encode
(
'59470
\n
'
)]);
verify
(
mockProcessManager
.
run
(
getConstFinderArgs
(
appDill
.
path
))).
called
(
1
);
verify
(
mockProcessManager
.
run
(
_
getConstFinderArgs
(
appDill
.
path
))).
called
(
1
);
verify
(
mockProcessManager
.
start
(
fontSubsetArgs
)).
called
(
2
);
});
...
...
@@ -283,7 +285,7 @@ void main() {
logger:
logger
,
processManager:
mockProcessManager
,
fileSystem:
fileSystem
,
artifacts:
mockA
rtifacts
,
artifacts:
a
rtifacts
,
);
final
mocks
.
CompleterIOSink
stdinSink
=
mocks
.
CompleterIOSink
();
...
...
@@ -300,7 +302,7 @@ void main() {
);
expect
(
subsetted
,
false
);
verifyNever
(
mockProcessManager
.
run
(
getConstFinderArgs
(
appDill
.
path
)));
verifyNever
(
mockProcessManager
.
run
(
_
getConstFinderArgs
(
appDill
.
path
)));
verifyNever
(
mockProcessManager
.
start
(
fontSubsetArgs
));
});
...
...
@@ -318,7 +320,7 @@ void main() {
logger:
logger
,
processManager:
mockProcessManager
,
fileSystem:
fileSystem
,
artifacts:
mockA
rtifacts
,
artifacts:
a
rtifacts
,
);
final
mocks
.
CompleterIOSink
stdinSink
=
mocks
.
CompleterIOSink
();
...
...
@@ -334,7 +336,7 @@ void main() {
);
expect
(
subsetted
,
false
);
verifyNever
(
mockProcessManager
.
run
(
getConstFinderArgs
(
appDill
.
path
)));
verifyNever
(
mockProcessManager
.
run
(
_
getConstFinderArgs
(
appDill
.
path
)));
verifyNever
(
mockProcessManager
.
start
(
fontSubsetArgs
));
});
...
...
@@ -352,7 +354,7 @@ void main() {
logger:
logger
,
processManager:
mockProcessManager
,
fileSystem:
fileSystem
,
artifacts:
mockA
rtifacts
,
artifacts:
a
rtifacts
,
);
_addConstFinderInvocation
(
appDill
.
path
,
stdout:
constFinderResultWithInvalid
);
...
...
@@ -370,7 +372,7 @@ void main() {
),
);
verify
(
mockProcessManager
.
run
(
getConstFinderArgs
(
appDill
.
path
))).
called
(
1
);
verify
(
mockProcessManager
.
run
(
_
getConstFinderArgs
(
appDill
.
path
))).
called
(
1
);
verifyNever
(
mockProcessManager
.
start
(
fontSubsetArgs
));
});
...
...
@@ -389,7 +391,7 @@ void main() {
logger:
logger
,
processManager:
mockProcessManager
,
fileSystem:
fileSystem
,
artifacts:
mockA
rtifacts
,
artifacts:
a
rtifacts
,
);
final
mocks
.
CompleterIOSink
stdinSink
=
mocks
.
CompleterIOSink
();
...
...
@@ -405,7 +407,7 @@ void main() {
throwsA
(
isA
<
IconTreeShakerException
>()),
);
verify
(
mockProcessManager
.
run
(
getConstFinderArgs
(
appDill
.
path
))).
called
(
1
);
verify
(
mockProcessManager
.
run
(
_
getConstFinderArgs
(
appDill
.
path
))).
called
(
1
);
verify
(
mockProcessManager
.
start
(
fontSubsetArgs
)).
called
(
1
);
});
...
...
@@ -423,7 +425,7 @@ void main() {
logger:
logger
,
processManager:
mockProcessManager
,
fileSystem:
fileSystem
,
artifacts:
mockA
rtifacts
,
artifacts:
a
rtifacts
,
);
final
mocks
.
CompleterIOSink
stdinSink
=
mocks
.
CompleterIOSink
(
throwOnAdd:
true
);
...
...
@@ -439,7 +441,7 @@ void main() {
throwsA
(
isA
<
IconTreeShakerException
>()),
);
verify
(
mockProcessManager
.
run
(
getConstFinderArgs
(
appDill
.
path
))).
called
(
1
);
verify
(
mockProcessManager
.
run
(
_
getConstFinderArgs
(
appDill
.
path
))).
called
(
1
);
verify
(
mockProcessManager
.
start
(
fontSubsetArgs
)).
called
(
1
);
});
...
...
@@ -459,7 +461,7 @@ void main() {
logger:
logger
,
processManager:
mockProcessManager
,
fileSystem:
fileSystem
,
artifacts:
mockA
rtifacts
,
artifacts:
a
rtifacts
,
);
_addConstFinderInvocation
(
appDill
.
path
,
stdout:
validConstFinderResult
);
...
...
@@ -473,7 +475,7 @@ void main() {
throwsA
(
isA
<
IconTreeShakerException
>()),
);
verify
(
mockProcessManager
.
run
(
getConstFinderArgs
(
appDill
.
path
))).
called
(
1
);
verify
(
mockProcessManager
.
run
(
_
getConstFinderArgs
(
appDill
.
path
))).
called
(
1
);
verifyNever
(
mockProcessManager
.
start
(
fontSubsetArgs
));
});
...
...
@@ -493,7 +495,7 @@ void main() {
logger:
logger
,
processManager:
mockProcessManager
,
fileSystem:
fileSystem
,
artifacts:
mockA
rtifacts
,
artifacts:
a
rtifacts
,
);
_addConstFinderInvocation
(
appDill
.
path
,
exitCode:
-
1
);
...
...
@@ -507,7 +509,7 @@ void main() {
throwsA
(
isA
<
IconTreeShakerException
>()),
);
verify
(
mockProcessManager
.
run
(
getConstFinderArgs
(
appDill
.
path
))).
called
(
1
);
verify
(
mockProcessManager
.
run
(
_
getConstFinderArgs
(
appDill
.
path
))).
called
(
1
);
verifyNever
(
mockProcessManager
.
start
(
fontSubsetArgs
));
});
}
...
...
@@ -588,4 +590,3 @@ const String invalidFontManifestJson = '''
class
MockProcessManager
extends
Mock
implements
ProcessManager
{}
class
MockProcess
extends
Mock
implements
Process
{}
class
MockArtifacts
extends
Mock
implements
Artifacts
{}
packages/flutter_tools/test/general.shard/build_system/targets/linux_test.dart
View file @
36fca52c
...
...
@@ -13,7 +13,6 @@ import 'package:flutter_tools/src/build_system/targets/assets.dart';
import
'package:flutter_tools/src/build_system/targets/common.dart'
;
import
'package:flutter_tools/src/build_system/targets/linux.dart'
;
import
'package:flutter_tools/src/convert.dart'
;
import
'package:mockito/mockito.dart'
;
import
'../../../src/common.dart'
;
import
'../../../src/context.dart'
;
...
...
@@ -21,30 +20,15 @@ import '../../../src/context.dart';
void
main
(
)
{
testWithoutContext
(
'Copies files to correct cache directory, excluding unrelated code'
,
()
async
{
final
FileSystem
fileSystem
=
MemoryFileSystem
.
test
();
setUpCacheDirectory
(
fileSystem
);
final
MockArtifacts
mockArtifacts
=
MockArtifacts
();
when
(
mockArtifacts
.
getArtifactPath
(
Artifact
.
linuxDesktopPath
,
mode:
anyNamed
(
'mode'
),
platform:
anyNamed
(
'platform'
),
)).
thenReturn
(
'linux-x64'
);
when
(
mockArtifacts
.
getArtifactPath
(
Artifact
.
linuxHeaders
,
mode:
anyNamed
(
'mode'
),
platform:
anyNamed
(
'platform'
),
)).
thenReturn
(
'linux-x64/flutter_linux'
);
when
(
mockArtifacts
.
getArtifactPath
(
Artifact
.
icuData
,
mode:
anyNamed
(
'mode'
),
platform:
anyNamed
(
'platform'
),
)).
thenReturn
(
r'linux-x64/icudtl.dat'
);
final
Artifacts
artifacts
=
Artifacts
.
test
();
setUpCacheDirectory
(
fileSystem
,
artifacts
);
final
Environment
testEnvironment
=
Environment
.
test
(
fileSystem
.
currentDirectory
,
defines:
<
String
,
String
>{
kBuildMode:
'debug'
,
},
artifacts:
mockA
rtifacts
,
artifacts:
a
rtifacts
,
processManager:
FakeProcessManager
.
any
(),
fileSystem:
fileSystem
,
logger:
BufferLogger
.
test
(),
...
...
@@ -54,8 +38,12 @@ void main() {
await
const
UnpackLinux
().
build
(
testEnvironment
);
expect
(
fileSystem
.
file
(
'linux/flutter/ephemeral/libflutter_linux_gtk.so'
),
exists
);
expect
(
fileSystem
.
file
(
'linux/flutter/ephemeral/flutter_linux/foo.h'
),
exists
);
expect
(
fileSystem
.
file
(
'linux/flutter/ephemeral/icudtl.dat'
),
exists
);
final
String
headersPath
=
artifacts
.
getArtifactPath
(
Artifact
.
linuxHeaders
,
platform:
TargetPlatform
.
linux_x64
,
mode:
BuildMode
.
debug
);
expect
(
fileSystem
.
file
(
'linux/flutter/ephemeral/
$headersPath
/foo.h'
),
exists
);
final
String
icuDataPath
=
artifacts
.
getArtifactPath
(
Artifact
.
icuData
,
platform:
TargetPlatform
.
linux_x64
);
expect
(
fileSystem
.
file
(
'linux/flutter/ephemeral/
$icuDataPath
'
),
exists
);
expect
(
fileSystem
.
file
(
'linux/flutter/ephemeral/unrelated-stuff'
),
isNot
(
exists
));
});
...
...
@@ -74,7 +62,7 @@ void main() {
inputs:
<
String
,
String
>{
kBundleSkSLPath:
'bundle.sksl'
,
},
artifacts:
MockArtifacts
(),
artifacts:
Artifacts
.
test
(),
processManager:
FakeProcessManager
.
any
(),
fileSystem:
fileSystem
,
logger:
BufferLogger
.
test
(),
...
...
@@ -118,7 +106,7 @@ void main() {
defines:
<
String
,
String
>{
kBuildMode:
'profile'
,
},
artifacts:
MockArtifacts
(),
artifacts:
Artifacts
.
test
(),
processManager:
FakeProcessManager
.
any
(),
fileSystem:
fileSystem
,
logger:
BufferLogger
.
test
(),
...
...
@@ -151,7 +139,7 @@ void main() {
defines:
<
String
,
String
>{
kBuildMode:
'release'
,
},
artifacts:
MockArtifacts
(),
artifacts:
Artifacts
.
test
(),
processManager:
FakeProcessManager
.
any
(),
fileSystem:
fileSystem
,
logger:
BufferLogger
.
test
(),
...
...
@@ -179,12 +167,14 @@ void main() {
});
}
void
setUpCacheDirectory
(
FileSystem
fileSystem
)
{
fileSystem
.
file
(
'linux-x64/unrelated-stuff'
).
createSync
(
recursive:
true
);
fileSystem
.
file
(
'linux-x64/libflutter_linux_gtk.so'
).
createSync
(
recursive:
true
);
fileSystem
.
file
(
'linux-x64/flutter_linux/foo.h'
).
createSync
(
recursive:
true
);
fileSystem
.
file
(
'linux-x64/icudtl.dat'
).
createSync
();
void
setUpCacheDirectory
(
FileSystem
fileSystem
,
Artifacts
artifacts
)
{
final
String
desktopPath
=
artifacts
.
getArtifactPath
(
Artifact
.
linuxDesktopPath
,
platform:
TargetPlatform
.
linux_x64
,
mode:
BuildMode
.
debug
);
fileSystem
.
file
(
'
$desktopPath
/unrelated-stuff'
).
createSync
(
recursive:
true
);
fileSystem
.
file
(
'
$desktopPath
/libflutter_linux_gtk.so'
).
createSync
(
recursive:
true
);
final
String
headersPath
=
artifacts
.
getArtifactPath
(
Artifact
.
linuxHeaders
,
platform:
TargetPlatform
.
linux_x64
,
mode:
BuildMode
.
debug
);
fileSystem
.
file
(
'
$headersPath
/foo.h'
).
createSync
(
recursive:
true
);
fileSystem
.
file
(
artifacts
.
getArtifactPath
(
Artifact
.
icuData
,
platform:
TargetPlatform
.
linux_x64
)).
createSync
();
fileSystem
.
file
(
'packages/flutter_tools/lib/src/build_system/targets/linux.dart'
).
createSync
(
recursive:
true
);
}
class
MockArtifacts
extends
Mock
implements
Artifacts
{}
packages/flutter_tools/test/general.shard/build_system/targets/web_test.dart
View file @
36fca52c
...
...
@@ -56,7 +56,7 @@ void main() {
defines:
<
String
,
String
>{
kTargetFile:
globals
.
fs
.
path
.
join
(
'foo'
,
'lib'
,
'main.dart'
),
},
artifacts:
MockArtifacts
(),
artifacts:
Artifacts
.
test
(),
processManager:
FakeProcessManager
.
any
(),
logger:
globals
.
logger
,
fileSystem:
globals
.
fs
,
...
...
@@ -557,4 +557,3 @@ void main() {
}
class
MockProcessManager
extends
Mock
implements
ProcessManager
{}
class
MockArtifacts
extends
Mock
implements
Artifacts
{}
packages/flutter_tools/test/general.shard/build_system/targets/windows_test.dart
View file @
36fca52c
...
...
@@ -15,7 +15,6 @@ import 'package:flutter_tools/src/build_system/targets/assets.dart';
import
'package:flutter_tools/src/build_system/targets/common.dart'
;
import
'package:flutter_tools/src/build_system/targets/windows.dart'
;
import
'package:flutter_tools/src/convert.dart'
;
import
'package:mockito/mockito.dart'
;
import
'../../../src/common.dart'
;
import
'../../../src/context.dart'
;
...
...
@@ -26,23 +25,9 @@ final Platform kWindowsPlatform = FakePlatform(
environment:
<
String
,
String
>{},
);
const
List
<
String
>
kRequiredFiles
=
<
String
>[
r'C:\bin\cache\artifacts\engine\windows-x64\flutter_export.h'
,
r'C:\bin\cache\artifacts\engine\windows-x64\flutter_messenger.h'
,
r'C:\bin\cache\artifacts\engine\windows-x64\flutter_windows.dll'
,
r'C:\bin\cache\artifacts\engine\windows-x64\flutter_windows.dll.exp'
,
r'C:\bin\cache\artifacts\engine\windows-x64\flutter_windows.dll.lib'
,
r'C:\bin\cache\artifacts\engine\windows-x64\flutter_windows.dll.pdb'
,
r'C:\bin\cache\artifacts\engine\windows-x64\flutter_plugin_registrar.h'
,
r'C:\bin\cache\artifacts\engine\windows-x64\flutter_windows.h'
,
r'C:\bin\cache\artifacts\engine\windows-x64\icudtl.dat'
,
r'C:\bin\cache\artifacts\engine\windows-x64\cpp_client_wrapper\foo'
,
r'C:\packages\flutter_tools\lib\src\build_system\targets\windows.dart'
,
];
void
main
(
)
{
testWithoutContext
(
'UnpackWindows copies files to the correct cache directory'
,
()
async
{
final
MockArtifacts
artifacts
=
MockArtifacts
();
final
Artifacts
artifacts
=
Artifacts
.
test
();
final
FileSystem
fileSystem
=
MemoryFileSystem
.
test
(
style:
FileSystemStyle
.
windows
);
final
Environment
environment
=
Environment
.
test
(
fileSystem
.
currentDirectory
,
...
...
@@ -60,22 +45,24 @@ void main() {
);
environment
.
buildDir
.
createSync
(
recursive:
true
);
when
(
artifacts
.
getArtifactPath
(
Artifact
.
windowsDesktopPath
,
mode:
anyNamed
(
'mode'
),
platform:
anyNamed
(
'platform'
)
)).
thenReturn
(
r'C:\bin\cache\artifacts\engine\windows-x64\'
);
when
(
artifacts
.
getArtifactPath
(
Artifact
.
windowsCppClientWrapper
,
mode:
anyNamed
(
'mode'
),
platform:
anyNamed
(
'platform'
)
)).
thenReturn
(
r'C:\bin\cache\artifacts\engine\windows-x64\cpp_client_wrapper\'
);
when
(
artifacts
.
getArtifactPath
(
Artifact
.
icuData
,
mode:
anyNamed
(
'mode'
),
platform:
anyNamed
(
'platform'
)
)).
thenReturn
(
r'C:\bin\cache\artifacts\engine\windows-x64\icudtl.dat'
);
for
(
final
String
path
in
kRequiredFiles
)
{
final
String
windowsDesktopPath
=
artifacts
.
getArtifactPath
(
Artifact
.
windowsDesktopPath
,
platform:
TargetPlatform
.
windows_x64
,
mode:
BuildMode
.
debug
);
final
String
windowsCppClientWrapper
=
artifacts
.
getArtifactPath
(
Artifact
.
windowsCppClientWrapper
,
platform:
TargetPlatform
.
windows_x64
,
mode:
BuildMode
.
debug
);
final
String
icuData
=
artifacts
.
getArtifactPath
(
Artifact
.
icuData
,
platform:
TargetPlatform
.
windows_x64
);
final
List
<
String
>
requiredFiles
=
<
String
>[
'
$windowsDesktopPath
\\
flutter_export.h'
,
'
$windowsDesktopPath
\\
flutter_messenger.h'
,
'
$windowsDesktopPath
\\
flutter_windows.dll'
,
'
$windowsDesktopPath
\\
flutter_windows.dll.exp'
,
'
$windowsDesktopPath
\\
flutter_windows.dll.lib'
,
'
$windowsDesktopPath
\\
flutter_windows.dll.pdb'
,
'
$windowsDesktopPath
\\
flutter_plugin_registrar.h'
,
'
$windowsDesktopPath
\\
flutter_windows.h'
,
icuData
,
'
$windowsCppClientWrapper
\\
foo'
,
r'C:\packages\flutter_tools\lib\src\build_system\targets\windows.dart'
,
];
for
(
final
String
path
in
requiredFiles
)
{
fileSystem
.
file
(
path
).
createSync
(
recursive:
true
);
}
fileSystem
.
directory
(
'windows'
).
createSync
();
...
...
@@ -93,9 +80,8 @@ void main() {
expect
(
fileSystem
.
file
(
r'C:\windows\flutter\ephemeral\flutter_messenger.h'
),
exists
);
expect
(
fileSystem
.
file
(
r'C:\windows\flutter\ephemeral\flutter_plugin_registrar.h'
),
exists
);
expect
(
fileSystem
.
file
(
r'C:\windows\flutter\ephemeral\flutter_windows.h'
),
exists
);
expect
(
fileSystem
.
file
(
r'C:\windows\flutter\ephemeral\icudtl.dat'
),
exists
);
expect
(
fileSystem
.
file
(
r'C:\windows\flutter\ephemeral\cpp_client_wrapper\foo'
),
exists
);
expect
(
fileSystem
.
file
(
'C:
\\
windows
\\
flutter
\\
ephemeral
\\
$icuData
'
),
exists
);
expect
(
fileSystem
.
file
(
'C:
\\
windows
\\
flutter
\\
ephemeral
\\
$windowsCppClientWrapper
\\
foo'
),
exists
);
final
File
outputDepfile
=
environment
.
buildDir
.
childFile
(
'windows_engine_sources.d'
);
...
...
@@ -110,16 +96,16 @@ void main() {
// Depfile has expected sources.
expect
(
inputPaths
,
unorderedEquals
(<
String
>[
r'C:\bin\cache\artifacts\engine\windows-x64
\flutter_export.h'
,
r'C:\bin\cache\artifacts\engine\windows-x64
\flutter_messenger.h'
,
r'C:\bin\cache\artifacts\engine\windows-x64
\flutter_windows.dll'
,
r'C:\bin\cache\artifacts\engine\windows-x64
\flutter_windows.dll.exp'
,
r'C:\bin\cache\artifacts\engine\windows-x64
\flutter_windows.dll.lib'
,
r'C:\bin\cache\artifacts\engine\windows-x64
\flutter_windows.dll.pdb'
,
r'C:\bin\cache\artifacts\engine\windows-x64
\flutter_plugin_registrar.h'
,
r'C:\bin\cache\artifacts\engine\windows-x64
\flutter_windows.h'
,
r'C:\bin\cache\artifacts\engine\windows-x64\icudtl.dat'
,
r'C:\bin\cache\artifacts\engine\windows-x64\cpp_client_wrapper
\foo'
,
'
$windowsDesktopPath
\
\
flutter_export.h'
,
'
$windowsDesktopPath
\
\
flutter_messenger.h'
,
'
$windowsDesktopPath
\
\
flutter_windows.dll'
,
'
$windowsDesktopPath
\
\
flutter_windows.dll.exp'
,
'
$windowsDesktopPath
\
\
flutter_windows.dll.lib'
,
'
$windowsDesktopPath
\
\
flutter_windows.dll.pdb'
,
'
$windowsDesktopPath
\
\
flutter_plugin_registrar.h'
,
'
$windowsDesktopPath
\
\
flutter_windows.h'
,
icuData
,
'
$windowsCppClientWrapper
\
\
foo'
,
]));
expect
(
outputPaths
,
unorderedEquals
(<
String
>[
r'C:\windows\flutter\ephemeral\flutter_export.h'
,
...
...
@@ -130,8 +116,8 @@ void main() {
r'C:\windows\flutter\ephemeral\flutter_windows.dll.pdb'
,
r'C:\windows\flutter\ephemeral\flutter_plugin_registrar.h'
,
r'C:\windows\flutter\ephemeral\flutter_windows.h'
,
r'C:\windows\flutter\ephemeral\icudtl.dat
'
,
r'C:\windows\flutter\ephemeral\cpp_client_wrapper
\foo'
,
'C:
\\
windows
\\
flutter
\\
ephemeral
\\
$icuData
'
,
'C:
\\
windows
\\
flutter
\\
ephemeral
\\
$windowsCppClientWrapper
\
\
foo'
,
]));
});
...
...
@@ -145,7 +131,7 @@ void main() {
testUsingContext
(
'DebugBundleWindowsAssets creates correct bundle structure'
,
()
async
{
final
Environment
environment
=
Environment
.
test
(
fileSystem
.
currentDirectory
,
artifacts:
MockArtifacts
(),
artifacts:
Artifacts
.
test
(),
processManager:
FakeProcessManager
.
any
(),
fileSystem:
fileSystem
,
logger:
BufferLogger
.
test
(),
...
...
@@ -186,7 +172,7 @@ void main() {
testUsingContext
(
'ProfileBundleWindowsAssets creates correct bundle structure'
,
()
async
{
final
Environment
environment
=
Environment
.
test
(
fileSystem
.
currentDirectory
,
artifacts:
MockArtifacts
(),
artifacts:
Artifacts
.
test
(),
processManager:
FakeProcessManager
.
any
(),
fileSystem:
fileSystem
,
logger:
BufferLogger
.
test
(),
...
...
@@ -213,7 +199,7 @@ void main() {
testUsingContext
(
'ReleaseBundleWindowsAssets creates correct bundle structure'
,
()
async
{
final
Environment
environment
=
Environment
.
test
(
fileSystem
.
currentDirectory
,
artifacts:
MockArtifacts
(),
artifacts:
Artifacts
.
test
(),
processManager:
FakeProcessManager
.
any
(),
fileSystem:
fileSystem
,
logger:
BufferLogger
.
test
(),
...
...
@@ -237,5 +223,3 @@ void main() {
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
});
}
class
MockArtifacts
extends
Mock
implements
Artifacts
{}
packages/flutter_tools/test/general.shard/dart/generate_synthetic_packages_test.dart
View file @
36fca52c
...
...
@@ -33,12 +33,12 @@ void main() {
final
FakeProcessManager
mockProcessManager
=
FakeProcessManager
.
any
();
final
BufferLogger
mockBufferLogger
=
BufferLogger
.
test
();
final
Artifacts
mockA
rtifacts
=
Artifacts
.
test
();
final
Artifacts
a
rtifacts
=
Artifacts
.
test
();
final
Environment
environment
=
Environment
.
test
(
fileSystem
.
currentDirectory
,
fileSystem:
fileSystem
,
logger:
mockBufferLogger
,
artifacts:
mockA
rtifacts
,
artifacts:
a
rtifacts
,
processManager:
mockProcessManager
,
);
final
BuildSystem
buildSystem
=
MockBuildSystem
();
...
...
@@ -74,12 +74,12 @@ void main() {
final
FakeProcessManager
mockProcessManager
=
FakeProcessManager
.
any
();
final
BufferLogger
mockBufferLogger
=
BufferLogger
.
test
();
final
Artifacts
mockA
rtifacts
=
Artifacts
.
test
();
final
Artifacts
a
rtifacts
=
Artifacts
.
test
();
final
Environment
environment
=
Environment
.
test
(
fileSystem
.
currentDirectory
,
fileSystem:
fileSystem
,
logger:
mockBufferLogger
,
artifacts:
mockA
rtifacts
,
artifacts:
a
rtifacts
,
processManager:
mockProcessManager
,
);
final
BuildSystem
buildSystem
=
MockBuildSystem
();
...
...
@@ -115,12 +115,11 @@ void main() {
final
FakeProcessManager
mockProcessManager
=
FakeProcessManager
.
any
();
final
BufferLogger
mockBufferLogger
=
BufferLogger
.
test
();
final
Artifacts
mockArtifacts
=
Artifacts
.
test
();
final
Environment
environment
=
Environment
.
test
(
fileSystem
.
currentDirectory
,
fileSystem:
fileSystem
,
logger:
mockBufferLogger
,
artifacts:
mockArtifacts
,
artifacts:
Artifacts
.
test
()
,
processManager:
mockProcessManager
,
);
final
BuildSystem
buildSystem
=
MockBuildSystem
();
...
...
@@ -153,12 +152,11 @@ void main() {
final
FakeProcessManager
mockProcessManager
=
FakeProcessManager
.
any
();
final
BufferLogger
mockBufferLogger
=
BufferLogger
.
test
();
final
Artifacts
mockArtifacts
=
Artifacts
.
test
();
final
Environment
environment
=
Environment
.
test
(
fileSystem
.
currentDirectory
,
fileSystem:
fileSystem
,
logger:
mockBufferLogger
,
artifacts:
mockArtifacts
,
artifacts:
Artifacts
.
test
()
,
processManager:
mockProcessManager
,
);
final
BuildSystem
buildSystem
=
MockBuildSystem
();
...
...
@@ -191,12 +189,11 @@ void main() {
final
FakeProcessManager
mockProcessManager
=
FakeProcessManager
.
any
();
final
BufferLogger
mockBufferLogger
=
BufferLogger
.
test
();
final
Artifacts
mockArtifacts
=
Artifacts
.
test
();
final
Environment
environment
=
Environment
.
test
(
fileSystem
.
currentDirectory
,
fileSystem:
fileSystem
,
logger:
mockBufferLogger
,
artifacts:
mockArtifacts
,
artifacts:
Artifacts
.
test
()
,
processManager:
mockProcessManager
,
);
final
BuildSystem
buildSystem
=
MockBuildSystem
();
...
...
@@ -232,12 +229,11 @@ void main() {
final
FakeProcessManager
mockProcessManager
=
FakeProcessManager
.
any
();
final
BufferLogger
mockBufferLogger
=
BufferLogger
.
test
();
final
Artifacts
mockArtifacts
=
Artifacts
.
test
();
final
Environment
environment
=
Environment
.
test
(
fileSystem
.
currentDirectory
,
fileSystem:
fileSystem
,
logger:
mockBufferLogger
,
artifacts:
mockArtifacts
,
artifacts:
Artifacts
.
test
()
,
processManager:
mockProcessManager
,
);
final
BuildSystem
buildSystem
=
MockBuildSystem
();
...
...
packages/flutter_tools/test/general.shard/fuchsia/fuchsia_device_test.dart
View file @
36fca52c
...
...
@@ -872,12 +872,7 @@ void main() {
FakeFuchsiaDeviceTools
fuchsiaDeviceTools
;
MockFuchsiaSdk
fuchsiaSdk
;
MockFuchsiaArtifacts
fuchsiaArtifacts
;
MockArtifacts
mockArtifacts
;
File
compilerSnapshot
;
File
platformDill
;
File
patchedSdk
;
File
runner
;
Artifacts
artifacts
;
setUp
(()
{
memoryFileSystem
=
MemoryFileSystem
.
test
();
...
...
@@ -886,32 +881,28 @@ void main() {
fuchsiaSdk
=
MockFuchsiaSdk
();
fuchsiaArtifacts
=
MockFuchsiaArtifacts
();
compilerSnapshot
=
memoryFileSystem
.
file
(
'kernel_compiler.snapshot'
)..
createSync
();
platformDill
=
memoryFileSystem
.
file
(
'platform_strong.dill'
)..
createSync
();
patchedSdk
=
memoryFileSystem
.
file
(
'flutter_runner_patched_sdk'
)..
createSync
();
runner
=
memoryFileSystem
.
file
(
'flutter_jit_runner'
)..
createSync
();
mockArtifacts
=
MockArtifacts
();
when
(
mockArtifacts
.
getArtifactPath
(
Artifact
.
fuchsiaKernelCompiler
,
platform:
anyNamed
(
'platform'
),
mode:
anyNamed
(
'mode'
),
)).
thenReturn
(
compilerSnapshot
.
path
);
when
(
mockArtifacts
.
getArtifactPath
(
Artifact
.
platformKernelDill
,
platform:
anyNamed
(
'platform'
),
mode:
anyNamed
(
'mode'
),
)).
thenReturn
(
platformDill
.
path
);
when
(
mockArtifacts
.
getArtifactPath
(
Artifact
.
flutterPatchedSdkPath
,
platform:
anyNamed
(
'platform'
),
mode:
anyNamed
(
'mode'
),
)).
thenReturn
(
patchedSdk
.
path
);
when
(
mockArtifacts
.
getArtifactPath
(
Artifact
.
fuchsiaFlutterRunner
,
platform:
anyNamed
(
'platform'
),
mode:
anyNamed
(
'mode'
),
)).
thenReturn
(
runner
.
path
);
artifacts
=
Artifacts
.
test
();
for
(
final
BuildMode
mode
in
<
BuildMode
>[
BuildMode
.
debug
,
BuildMode
.
release
])
{
memoryFileSystem
.
file
(
artifacts
.
getArtifactPath
(
Artifact
.
fuchsiaKernelCompiler
,
platform:
TargetPlatform
.
fuchsia_arm64
,
mode:
mode
),
).
createSync
();
memoryFileSystem
.
file
(
artifacts
.
getArtifactPath
(
Artifact
.
platformKernelDill
,
platform:
TargetPlatform
.
fuchsia_arm64
,
mode:
mode
),
).
createSync
();
memoryFileSystem
.
file
(
artifacts
.
getArtifactPath
(
Artifact
.
flutterPatchedSdkPath
,
platform:
TargetPlatform
.
fuchsia_arm64
,
mode:
mode
),
).
createSync
();
memoryFileSystem
.
file
(
artifacts
.
getArtifactPath
(
Artifact
.
fuchsiaFlutterRunner
,
platform:
TargetPlatform
.
fuchsia_arm64
,
mode:
mode
),
).
createSync
();
}
});
Future
<
LaunchResult
>
setupAndStartApp
({
...
...
@@ -951,7 +942,7 @@ void main() {
expect
(
launchResult
.
started
,
isTrue
);
expect
(
launchResult
.
hasObservatory
,
isFalse
);
},
overrides:
<
Type
,
Generator
>{
Artifacts:
()
=>
mockA
rtifacts
,
Artifacts:
()
=>
a
rtifacts
,
FileSystem:
()
=>
memoryFileSystem
,
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
FuchsiaDeviceTools:
()
=>
fuchsiaDeviceTools
,
...
...
@@ -978,7 +969,7 @@ void main() {
expect
(
launchResult
.
hasObservatory
,
isFalse
);
expect
(
await
device
.
stopApp
(
app
),
isTrue
);
},
overrides:
<
Type
,
Generator
>{
Artifacts:
()
=>
mockA
rtifacts
,
Artifacts:
()
=>
a
rtifacts
,
FileSystem:
()
=>
memoryFileSystem
,
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
FuchsiaDeviceTools:
()
=>
fuchsiaDeviceTools
,
...
...
@@ -993,7 +984,7 @@ void main() {
expect
(
launchResult
.
started
,
isTrue
);
expect
(
launchResult
.
hasObservatory
,
isTrue
);
},
overrides:
<
Type
,
Generator
>{
Artifacts:
()
=>
mockA
rtifacts
,
Artifacts:
()
=>
a
rtifacts
,
FileSystem:
()
=>
memoryFileSystem
,
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
FuchsiaDeviceTools:
()
=>
fuchsiaDeviceTools
,
...
...
@@ -1008,7 +999,7 @@ void main() {
expect
(
launchResult
.
started
,
isTrue
);
expect
(
launchResult
.
hasObservatory
,
isFalse
);
},
overrides:
<
Type
,
Generator
>{
Artifacts:
()
=>
mockA
rtifacts
,
Artifacts:
()
=>
a
rtifacts
,
FileSystem:
()
=>
memoryFileSystem
,
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
FuchsiaDeviceTools:
()
=>
fuchsiaDeviceTools
,
...
...
@@ -1023,7 +1014,7 @@ void main() {
expect
(
launchResult
.
started
,
isTrue
);
expect
(
launchResult
.
hasObservatory
,
isTrue
);
},
overrides:
<
Type
,
Generator
>{
Artifacts:
()
=>
mockA
rtifacts
,
Artifacts:
()
=>
a
rtifacts
,
FileSystem:
()
=>
memoryFileSystem
,
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
FuchsiaDeviceTools:
()
=>
fuchsiaDeviceTools
,
...
...
@@ -1038,7 +1029,7 @@ void main() {
expect
(
launchResult
.
started
,
isFalse
);
expect
(
launchResult
.
hasObservatory
,
isFalse
);
},
overrides:
<
Type
,
Generator
>{
Artifacts:
()
=>
mockA
rtifacts
,
Artifacts:
()
=>
a
rtifacts
,
FileSystem:
()
=>
memoryFileSystem
,
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
FuchsiaDeviceTools:
()
=>
fuchsiaDeviceTools
,
...
...
@@ -1053,7 +1044,7 @@ void main() {
expect
(
launchResult
.
started
,
isFalse
);
expect
(
launchResult
.
hasObservatory
,
isFalse
);
},
overrides:
<
Type
,
Generator
>{
Artifacts:
()
=>
mockA
rtifacts
,
Artifacts:
()
=>
a
rtifacts
,
FileSystem:
()
=>
memoryFileSystem
,
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
FuchsiaDeviceTools:
()
=>
fuchsiaDeviceTools
,
...
...
@@ -1068,7 +1059,7 @@ void main() {
expect
(
launchResult
.
started
,
isFalse
);
expect
(
launchResult
.
hasObservatory
,
isFalse
);
},
overrides:
<
Type
,
Generator
>{
Artifacts:
()
=>
mockA
rtifacts
,
Artifacts:
()
=>
a
rtifacts
,
FileSystem:
()
=>
memoryFileSystem
,
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
FuchsiaDeviceTools:
()
=>
FakeFuchsiaDeviceTools
(
amber:
FailingAmberCtl
()),
...
...
@@ -1083,7 +1074,7 @@ void main() {
expect
(
launchResult
.
started
,
isFalse
);
expect
(
launchResult
.
hasObservatory
,
isFalse
);
},
overrides:
<
Type
,
Generator
>{
Artifacts:
()
=>
mockA
rtifacts
,
Artifacts:
()
=>
a
rtifacts
,
FileSystem:
()
=>
memoryFileSystem
,
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
FuchsiaDeviceTools:
()
=>
FakeFuchsiaDeviceTools
(
tiles:
FailingTilesCtl
()),
...
...
@@ -1176,8 +1167,6 @@ class FuchsiaModulePackage extends ApplicationPackage {
final
String
name
;
}
class
MockArtifacts
extends
Mock
implements
Artifacts
{}
class
MockFuchsiaArtifacts
extends
Mock
implements
FuchsiaArtifacts
{}
class
MockProcessManager
extends
Mock
implements
ProcessManager
{}
...
...
packages/flutter_tools/test/general.shard/ios/devices_test.dart
View file @
36fca52c
...
...
@@ -36,7 +36,6 @@ void main() {
group
(
'IOSDevice'
,
()
{
final
List
<
Platform
>
unsupportedPlatforms
=
<
Platform
>[
linuxPlatform
,
windowsPlatform
];
Artifacts
mockArtifacts
;
Cache
cache
;
MockVmService
mockVmService
;
Logger
logger
;
...
...
@@ -45,19 +44,19 @@ void main() {
FileSystem
nullFileSystem
;
setUp
(()
{
mockArtifacts
=
MockArtifacts
();
final
Artifacts
artifacts
=
Artifacts
.
test
();
cache
=
Cache
.
test
();
mockVmService
=
MockVmService
();
logger
=
BufferLogger
.
test
();
iosDeploy
=
IOSDeploy
(
artifacts:
mockA
rtifacts
,
artifacts:
a
rtifacts
,
cache:
cache
,
logger:
logger
,
platform:
macPlatform
,
processManager:
FakeProcessManager
.
any
(),
);
iMobileDevice
=
IMobileDevice
(
artifacts:
mockA
rtifacts
,
artifacts:
a
rtifacts
,
cache:
cache
,
logger:
logger
,
processManager:
FakeProcessManager
.
any
(),
...
...
@@ -211,7 +210,6 @@ void main() {
MockProcess
mockProcess3
;
IOSDevicePortForwarder
portForwarder
;
ForwardedPort
forwardedPort
;
Artifacts
mockArtifacts
;
Cache
cache
;
Logger
logger
;
IOSDeploy
iosDeploy
;
...
...
@@ -259,10 +257,9 @@ void main() {
mockProcess2
=
MockProcess
();
mockProcess3
=
MockProcess
();
forwardedPort
=
ForwardedPort
.
withContext
(
123
,
456
,
mockProcess3
);
mockArtifacts
=
MockArtifacts
();
cache
=
Cache
.
test
();
iosDeploy
=
IOSDeploy
(
artifacts:
mockArtifacts
,
artifacts:
Artifacts
.
test
()
,
cache:
cache
,
logger:
logger
,
platform:
macPlatform
,
...
...
@@ -303,7 +300,6 @@ void main() {
group
(
'polling'
,
()
{
MockXcdevice
mockXcdevice
;
MockArtifacts
mockArtifacts
;
Cache
cache
;
MockVmService
mockVmService1
;
MockVmService
mockVmService2
;
...
...
@@ -317,7 +313,7 @@ void main() {
setUp
(()
{
mockXcdevice
=
MockXcdevice
();
mockArtifacts
=
MockArtifacts
();
final
Artifacts
artifacts
=
Artifacts
.
test
();
cache
=
Cache
.
test
();
mockVmService1
=
MockVmService
();
mockVmService2
=
MockVmService
();
...
...
@@ -325,14 +321,14 @@ void main() {
mockIosWorkflow
=
MockIOSWorkflow
();
fakeProcessManager
=
FakeProcessManager
.
any
();
iosDeploy
=
IOSDeploy
(
artifacts:
mockA
rtifacts
,
artifacts:
a
rtifacts
,
cache:
cache
,
logger:
logger
,
platform:
macPlatform
,
processManager:
fakeProcessManager
,
);
iMobileDevice
=
IMobileDevice
(
artifacts:
mockA
rtifacts
,
artifacts:
a
rtifacts
,
cache:
cache
,
processManager:
fakeProcessManager
,
logger:
logger
,
...
...
@@ -602,7 +598,6 @@ void main() {
}
class
MockIOSApp
extends
Mock
implements
IOSApp
{}
class
MockArtifacts
extends
Mock
implements
Artifacts
{}
class
MockIMobileDevice
extends
Mock
implements
IMobileDevice
{}
class
MockIOSDeploy
extends
Mock
implements
IOSDeploy
{}
class
MockIOSWorkflow
extends
Mock
implements
IOSWorkflow
{}
...
...
packages/flutter_tools/test/general.shard/ios/ios_device_logger_test.dart
View file @
36fca52c
...
...
@@ -21,17 +21,17 @@ import '../../src/testbed.dart';
void
main
(
)
{
FakeProcessManager
processManager
;
Mock
Artifacts
artifacts
;
Artifacts
artifacts
;
FakeCache
fakeCache
;
BufferLogger
logger
;
String
ideviceSyslogPath
;
setUp
(()
{
processManager
=
FakeProcessManager
.
list
(<
FakeCommand
>[]);
fakeCache
=
FakeCache
();
artifacts
=
MockArtifacts
();
artifacts
=
Artifacts
.
test
();
logger
=
BufferLogger
.
test
();
when
(
artifacts
.
getArtifactPath
(
Artifact
.
idevicesyslog
,
platform:
TargetPlatform
.
ios
))
.
thenReturn
(
'idevice-syslog'
);
ideviceSyslogPath
=
artifacts
.
getArtifactPath
(
Artifact
.
idevicesyslog
,
platform:
TargetPlatform
.
ios
);
});
group
(
'syslog stream'
,
()
{
...
...
@@ -51,9 +51,9 @@ void main() {
testWithoutContext
(
'IOSDeviceLogReader suppresses non-Flutter lines from output with syslog'
,
()
async
{
processManager
.
addCommand
(
const
FakeCommand
(
FakeCommand
(
command:
<
String
>[
'idevice-syslog'
,
'-u'
,
'1234'
,
ideviceSyslogPath
,
'-u'
,
'1234'
,
],
stdout:
'''
Runner(Flutter)[297] <Notice>: A is for ari
...
...
@@ -79,9 +79,9 @@ Runner(UIKit)[297] <Notice>: E is for enpitsu"
testWithoutContext
(
'IOSDeviceLogReader includes multi-line Flutter logs in the output with syslog'
,
()
async
{
processManager
.
addCommand
(
const
FakeCommand
(
FakeCommand
(
command:
<
String
>[
'idevice-syslog'
,
'-u'
,
'1234'
,
ideviceSyslogPath
,
'-u'
,
'1234'
,
],
stdout:
'''
Runner(Flutter)[297] <Notice>: This is a multi-line message,
...
...
@@ -112,9 +112,9 @@ Runner(libsystem_asl.dylib)[297] <Notice>: libMobileGestalt
testWithoutContext
(
'includes multi-line Flutter logs in the output'
,
()
async
{
processManager
.
addCommand
(
const
FakeCommand
(
FakeCommand
(
command:
<
String
>[
'idevice-syslog'
,
'-u'
,
'1234'
,
ideviceSyslogPath
,
'-u'
,
'1234'
,
],
stdout:
'''
Runner(Flutter)[297] <Notice>: This is a multi-line message,
...
...
@@ -325,6 +325,5 @@ Runner(libsystem_asl.dylib)[297] <Notice>: libMobileGestalt
});
}
class
MockArtifacts
extends
Mock
implements
Artifacts
{}
class
MockVmService
extends
Mock
implements
VmService
{}
class
MockIOSDeployDebugger
extends
Mock
implements
IOSDeployDebugger
{}
packages/flutter_tools/test/general.shard/ios/ios_device_project_test.dart
View file @
36fca52c
...
...
@@ -3,7 +3,6 @@
// found in the LICENSE file.
import
'package:file/memory.dart'
;
import
'package:flutter_tools/src/artifacts.dart'
;
import
'package:flutter_tools/src/base/file_system.dart'
;
import
'package:flutter_tools/src/base/logger.dart'
;
import
'package:flutter_tools/src/base/platform.dart'
;
...
...
@@ -77,9 +76,6 @@ flutter:
}
IOSDevice
setUpIOSDevice
(
FileSystem
fileSystem
)
{
final
MockArtifacts
artifacts
=
MockArtifacts
();
when
(
artifacts
.
getArtifactPath
(
Artifact
.
iosDeploy
,
platform:
anyNamed
(
'platform'
)))
.
thenReturn
(
'ios-deploy'
);
return
IOSDevice
(
'test'
,
fileSystem:
fileSystem
,
...
...
@@ -96,5 +92,4 @@ IOSDevice setUpIOSDevice(FileSystem fileSystem) {
);
}
class
MockArtifacts
extends
Mock
implements
Artifacts
{}
class
MockVmService
extends
Mock
implements
VmService
{}
packages/flutter_tools/test/general.shard/ios/mac_test.dart
View file @
36fca52c
...
...
@@ -58,7 +58,6 @@ void main() {
setUp
(()
{
mockProcessManager
=
MockProcessManager
();
outputFile
=
MemoryFileSystem
.
test
().
file
(
'image.png'
);
// when(mockArtifacts.getArtifactPath(Artifact.idevicescreenshot, platform: anyNamed('platform'))).thenReturn(idevicescreenshotPath);
});
testWithoutContext
(
'error if idevicescreenshot is not installed'
,
()
async
{
...
...
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