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
faa1a251
Unverified
Commit
faa1a251
authored
Feb 09, 2021
by
Jenn Magder
Committed by
GitHub
Feb 09, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move FakeBotDetector to fakes (#75543)
parent
65671284
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
27 additions
and
39 deletions
+27
-39
packages_test.dart
...er_tools/test/commands.shard/permeable/packages_test.dart
+11
-11
ios_device_start_prebuilt_test.dart
...est/general.shard/ios/ios_device_start_prebuilt_test.dart
+0
-6
context.dart
packages/flutter_tools/test/src/context.dart
+1
-2
fakes.dart
packages/flutter_tools/test/src/fakes.dart
+11
-0
mocks.dart
packages/flutter_tools/test/src/mocks.dart
+4
-20
No files found.
packages/flutter_tools/test/commands.shard/permeable/packages_test.dart
View file @
faa1a251
...
...
@@ -21,7 +21,7 @@ import 'package:flutter_tools/src/globals.dart' as globals;
import
'../../src/common.dart'
;
import
'../../src/context.dart'
;
import
'../../src/fakes.dart'
;
import
'../../src/mocks.dart'
show
MockProcessManager
,
AlwaysTrueBotDetector
,
AlwaysFalseBotDetector
;
import
'../../src/mocks.dart'
show
MockProcessManager
;
import
'../../src/testbed.dart'
;
void
main
(
)
{
...
...
@@ -456,7 +456,7 @@ void main() {
},
overrides:
<
Type
,
Generator
>{
ProcessManager:
()
=>
mockProcessManager
,
Stdio:
()
=>
mockStdio
,
BotDetector:
()
=>
const
AlwaysFalseBotDetector
(
),
BotDetector:
()
=>
const
FakeBotDetector
(
false
),
Pub:
()
=>
Pub
(
fileSystem:
globals
.
fs
,
logger:
globals
.
logger
,
...
...
@@ -478,7 +478,7 @@ void main() {
},
overrides:
<
Type
,
Generator
>{
ProcessManager:
()
=>
mockProcessManager
,
Stdio:
()
=>
mockStdio
,
BotDetector:
()
=>
const
AlwaysTrueBotDetector
(
),
BotDetector:
()
=>
const
FakeBotDetector
(
true
),
Pub:
()
=>
Pub
(
fileSystem:
globals
.
fs
,
logger:
globals
.
logger
,
...
...
@@ -579,7 +579,7 @@ void main() {
},
overrides:
<
Type
,
Generator
>{
ProcessManager:
()
=>
mockProcessManager
,
Stdio:
()
=>
mockStdio
,
BotDetector:
()
=>
const
AlwaysTrueBotDetector
(
),
BotDetector:
()
=>
const
FakeBotDetector
(
true
),
Pub:
()
=>
Pub
(
fileSystem:
globals
.
fs
,
logger:
globals
.
logger
,
...
...
@@ -599,7 +599,7 @@ void main() {
},
overrides:
<
Type
,
Generator
>{
ProcessManager:
()
=>
mockProcessManager
,
Stdio:
()
=>
mockStdio
,
BotDetector:
()
=>
const
AlwaysTrueBotDetector
(
),
BotDetector:
()
=>
const
FakeBotDetector
(
true
),
Pub:
()
=>
Pub
(
fileSystem:
globals
.
fs
,
logger:
globals
.
logger
,
...
...
@@ -619,7 +619,7 @@ void main() {
},
overrides:
<
Type
,
Generator
>{
ProcessManager:
()
=>
mockProcessManager
,
Stdio:
()
=>
mockStdio
,
BotDetector:
()
=>
const
AlwaysTrueBotDetector
(
),
BotDetector:
()
=>
const
FakeBotDetector
(
true
),
Pub:
()
=>
Pub
(
fileSystem:
globals
.
fs
,
logger:
globals
.
logger
,
...
...
@@ -639,7 +639,7 @@ void main() {
},
overrides:
<
Type
,
Generator
>{
ProcessManager:
()
=>
mockProcessManager
,
Stdio:
()
=>
mockStdio
,
BotDetector:
()
=>
const
AlwaysTrueBotDetector
(
),
BotDetector:
()
=>
const
FakeBotDetector
(
true
),
Pub:
()
=>
Pub
(
fileSystem:
globals
.
fs
,
logger:
globals
.
logger
,
...
...
@@ -659,7 +659,7 @@ void main() {
},
overrides:
<
Type
,
Generator
>{
ProcessManager:
()
=>
mockProcessManager
,
Stdio:
()
=>
mockStdio
,
BotDetector:
()
=>
const
AlwaysTrueBotDetector
(
),
BotDetector:
()
=>
const
FakeBotDetector
(
true
),
Pub:
()
=>
Pub
(
fileSystem:
globals
.
fs
,
logger:
globals
.
logger
,
...
...
@@ -679,7 +679,7 @@ void main() {
},
overrides:
<
Type
,
Generator
>{
ProcessManager:
()
=>
mockProcessManager
,
Stdio:
()
=>
mockStdio
,
BotDetector:
()
=>
const
AlwaysTrueBotDetector
(
),
BotDetector:
()
=>
const
FakeBotDetector
(
true
),
Pub:
()
=>
Pub
(
fileSystem:
globals
.
fs
,
logger:
globals
.
logger
,
...
...
@@ -700,7 +700,7 @@ void main() {
},
overrides:
<
Type
,
Generator
>{
ProcessManager:
()
=>
mockProcessManager
,
Stdio:
()
=>
mockStdio
,
BotDetector:
()
=>
const
AlwaysTrueBotDetector
(
),
BotDetector:
()
=>
const
FakeBotDetector
(
true
),
Pub:
()
=>
Pub
(
fileSystem:
globals
.
fs
,
logger:
globals
.
logger
,
...
...
@@ -720,7 +720,7 @@ void main() {
},
overrides:
<
Type
,
Generator
>{
ProcessManager:
()
=>
mockProcessManager
,
Stdio:
()
=>
mockStdio
,
BotDetector:
()
=>
const
AlwaysTrueBotDetector
(
),
BotDetector:
()
=>
const
FakeBotDetector
(
true
),
Pub:
()
=>
Pub
(
fileSystem:
globals
.
fs
,
logger:
globals
.
logger
,
...
...
packages/flutter_tools/test/general.shard/ios/ios_device_start_prebuilt_test.dart
View file @
faa1a251
...
...
@@ -9,7 +9,6 @@ import 'dart:async';
import
'package:file/memory.dart'
;
import
'package:flutter_tools/src/application_package.dart'
;
import
'package:flutter_tools/src/artifacts.dart'
;
import
'package:flutter_tools/src/base/dds.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'
;
...
...
@@ -21,7 +20,6 @@ import 'package:flutter_tools/src/ios/ios_deploy.dart';
import
'package:flutter_tools/src/ios/iproxy.dart'
;
import
'package:flutter_tools/src/ios/mac.dart'
;
import
'package:mockito/mockito.dart'
;
import
'package:vm_service/vm_service.dart'
;
import
'../../src/common.dart'
;
import
'../../src/context.dart'
;
...
...
@@ -344,7 +342,3 @@ IOSDevice setUpIOSDevice({
class
MockDevicePortForwarder
extends
Mock
implements
DevicePortForwarder
{}
class
MockDeviceLogReader
extends
Mock
implements
DeviceLogReader
{}
class
MockVmService
extends
Mock
implements
VmService
{}
class
MockDartDevelopmentService
extends
Mock
implements
DartDevelopmentService
{}
class
MockIOSDeployDebugger
extends
Mock
implements
IOSDeployDebugger
{}
class
MockIOSDeploy
extends
Mock
implements
IOSDeploy
{}
packages/flutter_tools/test/src/context.dart
View file @
faa1a251
...
...
@@ -39,7 +39,6 @@ import 'package:mockito/mockito.dart';
import
'common.dart'
;
import
'fake_process_manager.dart'
;
import
'fakes.dart'
;
import
'mocks.dart'
;
import
'throwing_pub.dart'
;
export
'package:flutter_tools/src/base/context.dart'
show
Generator
;
...
...
@@ -175,7 +174,7 @@ void testUsingContext(
// If a test needs a BotDetector that does not always return true, it
// can provide the AlwaysFalseBotDetector in the overrides, or its own
// BotDetector implementation in the overrides.
BotDetector:
overrides
[
BotDetector
]
??
()
=>
const
AlwaysTrueBotDetector
(
),
BotDetector:
overrides
[
BotDetector
]
??
()
=>
const
FakeBotDetector
(
true
),
});
},
testOn:
testOn
,
skip:
skip
,
timeout:
timeout
);
}
...
...
packages/flutter_tools/test/src/fakes.dart
View file @
faa1a251
...
...
@@ -7,6 +7,7 @@
import
'dart:async'
;
import
'dart:io'
as
io
show
IOSink
,
ProcessSignal
,
Stdout
,
StdoutException
;
import
'package:flutter_tools/src/base/bot_detector.dart'
;
import
'package:flutter_tools/src/base/file_system.dart'
;
import
'package:flutter_tools/src/base/io.dart'
;
import
'package:flutter_tools/src/base/logger.dart'
;
...
...
@@ -416,3 +417,13 @@ class FakePlistParser implements PlistParser {
return
_underlyingValues
[
key
]
as
String
;
}
}
class
FakeBotDetector
implements
BotDetector
{
const
FakeBotDetector
(
bool
isRunningOnBot
)
:
_isRunningOnBot
=
isRunningOnBot
;
@override
Future
<
bool
>
get
isRunningOnBot
async
=>
_isRunningOnBot
;
final
bool
_isRunningOnBot
;
}
packages/flutter_tools/test/src/mocks.dart
View file @
faa1a251
...
...
@@ -10,7 +10,6 @@ import 'dart:io' as io show IOSink;
import
'package:flutter_tools/src/android/android_device.dart'
;
import
'package:flutter_tools/src/android/android_sdk.dart'
show
AndroidSdk
;
import
'package:flutter_tools/src/base/bot_detector.dart'
;
import
'package:flutter_tools/src/base/context.dart'
;
import
'package:flutter_tools/src/base/file_system.dart'
hide
IOSink
;
import
'package:flutter_tools/src/base/io.dart'
;
...
...
@@ -176,7 +175,7 @@ Process createMockProcess({ int exitCode = 0, String stdout = '', String stderr
final
Stream
<
List
<
int
>>
stderrStream
=
Stream
<
List
<
int
>>.
fromIterable
(<
List
<
int
>>[
utf8
.
encode
(
stderr
),
]);
final
Process
process
=
MockBasicProcess
();
final
Process
process
=
_
MockBasicProcess
();
when
(
process
.
stdout
).
thenAnswer
((
_
)
=>
stdoutStream
);
when
(
process
.
stderr
).
thenAnswer
((
_
)
=>
stderrStream
);
...
...
@@ -184,7 +183,7 @@ Process createMockProcess({ int exitCode = 0, String stdout = '', String stderr
return
process
;
}
class
MockBasicProcess
extends
Mock
implements
Process
{}
class
_
MockBasicProcess
extends
Mock
implements
Process
{}
/// A process that exits successfully with no output and ignores all input.
class
MockProcess
extends
Mock
implements
Process
{
...
...
@@ -253,7 +252,7 @@ class MockIOSDevice extends Mock implements IOSDevice {
}
/// Common functionality for tracking mock interaction.
class
BasicMock
{
class
_
BasicMock
{
final
List
<
String
>
messages
=
<
String
>[];
void
expectMessages
(
List
<
String
>
expectedMessages
)
{
...
...
@@ -271,7 +270,7 @@ class BasicMock {
}
}
class
MockResidentCompiler
extends
BasicMock
implements
ResidentCompiler
{
class
MockResidentCompiler
extends
_
BasicMock
implements
ResidentCompiler
{
@override
void
accept
()
{
}
...
...
@@ -370,18 +369,3 @@ class MockStdIn extends Mock implements IOSink {
}
class
MockStream
extends
Mock
implements
Stream
<
List
<
int
>>
{}
class
AlwaysTrueBotDetector
implements
BotDetector
{
const
AlwaysTrueBotDetector
();
@override
Future
<
bool
>
get
isRunningOnBot
async
=>
true
;
}
class
AlwaysFalseBotDetector
implements
BotDetector
{
const
AlwaysFalseBotDetector
();
@override
Future
<
bool
>
get
isRunningOnBot
async
=>
false
;
}
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