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
a42d38a2
Unverified
Commit
a42d38a2
authored
Mar 06, 2020
by
Dan Field
Committed by
GitHub
Mar 06, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix flaky test (#52088)
parent
e7d70fbf
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
30 additions
and
19 deletions
+30
-19
packages_test.dart
...er_tools/test/commands.shard/permeable/packages_test.dart
+1
-17
devfs_test.dart
packages/flutter_tools/test/general.shard/devfs_test.dart
+2
-2
context.dart
packages/flutter_tools/test/src/context.dart
+11
-0
mocks.dart
packages/flutter_tools/test/src/mocks.dart
+16
-0
No files found.
packages/flutter_tools/test/commands.shard/permeable/packages_test.dart
View file @
a42d38a2
...
...
@@ -18,25 +18,9 @@ import 'package:flutter_tools/src/globals.dart' as globals;
import
'../../src/common.dart'
;
import
'../../src/context.dart'
;
import
'../../src/mocks.dart'
show
MockProcessManager
,
MockStdio
,
PromptingProcess
;
import
'../../src/mocks.dart'
show
MockProcessManager
,
MockStdio
,
PromptingProcess
,
AlwaysTrueBotDetector
,
AlwaysFalseBotDetector
;
import
'../../src/testbed.dart'
;
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
;
}
void
main
(
)
{
Cache
.
disableLocking
();
group
(
'packages get/upgrade'
,
()
{
...
...
packages/flutter_tools/test/general.shard/devfs_test.dart
View file @
a42d38a2
...
...
@@ -28,7 +28,7 @@ void main() {
String
basePath
;
setUpAll
(()
{
fs
=
MemoryFileSystem
();
fs
=
MemoryFileSystem
.
test
();
filePath
=
fs
.
path
.
join
(
'lib'
,
'foo.txt'
);
});
...
...
@@ -69,7 +69,7 @@ void main() {
file
.
parent
.
createSync
(
recursive:
true
);
file
.
writeAsBytesSync
(<
int
>[
1
,
2
,
3
],
flush:
true
);
final
DateTime
fiveSecondsAgo
=
DateTime
.
now
().
subtract
(
const
Duration
(
seconds:
5
));
final
DateTime
fiveSecondsAgo
=
file
.
statSync
().
modified
.
subtract
(
const
Duration
(
seconds:
5
));
expect
(
content
.
isModifiedAfter
(
fiveSecondsAgo
),
isTrue
);
expect
(
content
.
isModifiedAfter
(
fiveSecondsAgo
),
isTrue
);
expect
(
content
.
isModifiedAfter
(
null
),
isTrue
);
...
...
packages/flutter_tools/test/src/context.dart
View file @
a42d38a2
...
...
@@ -6,6 +6,7 @@ import 'dart:async';
import
'dart:io'
as
io
;
import
'package:flutter_tools/src/android/android_workflow.dart'
;
import
'package:flutter_tools/src/base/bot_detector.dart'
;
import
'package:flutter_tools/src/base/config.dart'
;
import
'package:flutter_tools/src/base/context.dart'
;
import
'package:flutter_tools/src/base/file_system.dart'
;
...
...
@@ -37,6 +38,7 @@ import 'package:mockito/mockito.dart';
import
'common.dart'
;
import
'fake_process_manager.dart'
;
import
'mocks.dart'
;
import
'throwing_pub.dart'
;
export
'package:flutter_tools/src/base/context.dart'
show
Generator
;
...
...
@@ -164,6 +166,15 @@ void testUsingContext(
});
},
);
},
overrides:
<
Type
,
Generator
>{
// This has to go here so that runInContext will pick it up when it tries
// to do bot detection before running the closure. This is important
// because the test may be giving us a fake HttpClientFactory, which may
// throw in unexpected/abnormal ways.
// 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
(),
});
},
testOn:
testOn
,
skip:
skip
);
}
...
...
packages/flutter_tools/test/src/mocks.dart
View file @
a42d38a2
...
...
@@ -11,6 +11,7 @@ import 'package:platform/platform.dart';
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/application_package.dart'
;
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'
;
...
...
@@ -761,3 +762,18 @@ 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