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
5ac54a6b
Unverified
Commit
5ac54a6b
authored
Apr 29, 2021
by
Jonah Williams
Committed by
GitHub
Apr 29, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[flutter_tools] remove mocks from simcontrol and context (#81433)
parent
ba4177f6
Changes
2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
84 additions
and
61 deletions
+84
-61
simulators_test.dart
...flutter_tools/test/general.shard/ios/simulators_test.dart
+70
-46
context.dart
packages/flutter_tools/test/src/context.dart
+14
-15
No files found.
packages/flutter_tools/test/general.shard/ios/simulators_test.dart
View file @
5ac54a6b
This diff is collapsed.
Click to expand it.
packages/flutter_tools/test/src/context.dart
View file @
5ac54a6b
...
...
@@ -36,7 +36,6 @@ import 'package:flutter_tools/src/reporting/crash_reporting.dart';
import
'package:flutter_tools/src/reporting/reporting.dart'
;
import
'package:flutter_tools/src/version.dart'
;
import
'package:meta/meta.dart'
;
import
'package:mockito/mockito.dart'
;
import
'common.dart'
;
import
'fake_http_client.dart'
;
...
...
@@ -113,11 +112,7 @@ void testUsingContext(
Doctor:
()
=>
FakeDoctor
(
globals
.
logger
),
FlutterVersion:
()
=>
FakeFlutterVersion
(),
HttpClient:
()
=>
FakeHttpClient
.
any
(),
IOSSimulatorUtils:
()
{
final
MockIOSSimulatorUtils
mock
=
MockIOSSimulatorUtils
();
when
(
mock
.
getAttachedDevices
()).
thenAnswer
((
Invocation
_
)
async
=>
<
IOSSimulator
>[]);
return
mock
;
},
IOSSimulatorUtils:
()
=>
const
NoopIOSSimulatorUtils
(),
OutputPreferences:
()
=>
OutputPreferences
.
test
(),
Logger:
()
=>
BufferLogger
(
terminal:
globals
.
terminal
,
...
...
@@ -125,14 +120,13 @@ void testUsingContext(
),
OperatingSystemUtils:
()
=>
FakeOperatingSystemUtils
(),
PersistentToolState:
()
=>
buildPersistentToolState
(
globals
.
fs
),
SimControl:
()
=>
MockSimControl
(),
Usage:
()
=>
TestUsage
(),
XcodeProjectInterpreter:
()
=>
FakeXcodeProjectInterpreter
(),
FileSystem:
()
=>
LocalFileSystemBlockingSetCurrentDirectory
(),
PlistParser:
()
=>
FakePlistParser
(),
Signals:
()
=>
FakeSignals
(),
Pub:
()
=>
ThrowingPub
(),
// prevent accidentally using pub.
CrashReporter:
()
=>
Mock
CrashReporter
(),
CrashReporter:
()
=>
const
Noop
CrashReporter
(),
TemplateRenderer:
()
=>
const
MustacheTemplateRenderer
(),
},
body:
()
{
...
...
@@ -286,13 +280,12 @@ class FakeDoctor extends Doctor {
}
}
class
MockSimControl
extends
Mock
implements
SimControl
{
MockSimControl
()
{
when
(
getConnectedDevices
()).
thenAnswer
((
Invocation
_
)
async
=>
<
SimDevice
>[]);
}
}
class
NoopIOSSimulatorUtils
implements
IOSSimulatorUtils
{
const
NoopIOSSimulatorUtils
();
class
MockIOSSimulatorUtils
extends
Mock
implements
IOSSimulatorUtils
{}
@override
Future
<
List
<
IOSSimulator
>>
getAttachedDevices
()
async
=>
<
IOSSimulator
>[];
}
class
FakeXcodeProjectInterpreter
implements
XcodeProjectInterpreter
{
@override
...
...
@@ -332,7 +325,13 @@ class FakeXcodeProjectInterpreter implements XcodeProjectInterpreter {
List
<
String
>
xcrunCommand
()
=>
<
String
>[
'xcrun'
];
}
class
MockCrashReporter
extends
Mock
implements
CrashReporter
{}
/// Prevent test crashest from being reported to the crash backend.
class
NoopCrashReporter
implements
CrashReporter
{
const
NoopCrashReporter
();
@override
Future
<
void
>
informUser
(
CrashDetails
details
,
File
crashFile
)
async
{
}
}
class
LocalFileSystemBlockingSetCurrentDirectory
extends
LocalFileSystem
{
LocalFileSystemBlockingSetCurrentDirectory
()
:
super
.
test
(
...
...
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