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
36203142
Unverified
Commit
36203142
authored
Feb 18, 2021
by
Jenn Magder
Committed by
GitHub
Feb 18, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Delete MockResidentCompiler (#76280)
parent
5e614667
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
89 deletions
+11
-89
cold_test.dart
packages/flutter_tools/test/general.shard/cold_test.dart
+3
-2
hot_test.dart
packages/flutter_tools/test/general.shard/hot_test.dart
+8
-3
mocks.dart
packages/flutter_tools/test/src/mocks.dart
+0
-84
No files found.
packages/flutter_tools/test/general.shard/cold_test.dart
View file @
36203142
...
...
@@ -18,12 +18,11 @@ import 'package:mockito/mockito.dart';
import
'../src/common.dart'
;
import
'../src/context.dart'
;
import
'../src/mocks.dart'
;
void
main
(
)
{
testUsingContext
(
'Exits with code 2 when when HttpException is thrown '
'during VM service connection'
,
()
async
{
final
MockResidentCompiler
residentCompiler
=
Mock
ResidentCompiler
();
final
FakeResidentCompiler
residentCompiler
=
Fake
ResidentCompiler
();
final
MockDevice
mockDevice
=
MockDevice
();
when
(
mockDevice
.
supportsHotReload
).
thenReturn
(
true
);
when
(
mockDevice
.
supportsHotRestart
).
thenReturn
(
false
);
...
...
@@ -140,3 +139,5 @@ class TestFlutterDevice extends FlutterDevice {
throw
exception
;
}
}
class
FakeResidentCompiler
extends
Fake
implements
ResidentCompiler
{}
packages/flutter_tools/test/general.shard/hot_test.dart
View file @
36203142
...
...
@@ -23,7 +23,6 @@ import 'package:mockito/mockito.dart';
import
'../src/common.dart'
;
import
'../src/context.dart'
;
import
'../src/mocks.dart'
;
final
vm_service
.
Isolate
fakeUnpausedIsolate
=
vm_service
.
Isolate
(
id:
'1'
,
...
...
@@ -57,6 +56,7 @@ final FakeVmServiceRequest listViews = FakeVmServiceRequest(
],
},
);
void
main
(
)
{
group
(
'validateReloadReport'
,
()
{
testUsingContext
(
'invalid'
,
()
async
{
...
...
@@ -142,7 +142,7 @@ void main() {
});
group
(
'hotRestart'
,
()
{
final
MockResidentCompiler
residentCompiler
=
Mock
ResidentCompiler
();
final
FakeResidentCompiler
residentCompiler
=
Fake
ResidentCompiler
();
final
MockDevFs
mockDevFs
=
MockDevFs
();
FileSystem
fileSystem
;
...
...
@@ -511,7 +511,7 @@ void main() {
..
createSync
(
recursive:
true
)
..
writeAsStringSync
(
'
\n
'
);
final
MockResidentCompiler
residentCompiler
=
Mock
ResidentCompiler
();
final
FakeResidentCompiler
residentCompiler
=
Fake
ResidentCompiler
();
final
MockDevice
mockDevice
=
MockDevice
();
when
(
mockDevice
.
supportsHotReload
).
thenReturn
(
true
);
when
(
mockDevice
.
supportsHotRestart
).
thenReturn
(
false
);
...
...
@@ -629,3 +629,8 @@ class TestHotRunnerConfig extends HotRunnerConfig {
shutdownHookCalled
=
true
;
}
}
class
FakeResidentCompiler
extends
Fake
implements
ResidentCompiler
{
@override
void
accept
()
{}
}
packages/flutter_tools/test/src/mocks.dart
View file @
36203142
...
...
@@ -10,29 +10,17 @@ 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/context.dart'
;
import
'package:flutter_tools/src/base/file_system.dart'
hide
IOSink
;
import
'package:flutter_tools/src/base/io.dart'
;
import
'package:flutter_tools/src/base/platform.dart'
;
import
'package:flutter_tools/src/build_info.dart'
;
import
'package:flutter_tools/src/compile.dart'
;
import
'package:flutter_tools/src/globals.dart'
as
globals
;
import
'package:flutter_tools/src/ios/devices.dart'
;
import
'package:flutter_tools/src/project.dart'
;
import
'package:mockito/mockito.dart'
;
import
'package:package_config/package_config.dart'
;
import
'package:process/process.dart'
;
import
'common.dart'
;
import
'fakes.dart'
;
// TODO(fujino): replace FakePlatform.fromPlatform() with FakePlatform()
final
Generator
kNoColorTerminalPlatform
=
()
{
return
FakePlatform
.
fromPlatform
(
const
LocalPlatform
()
)..
stdoutSupportsAnsi
=
false
;
};
/// An SDK installation with several SDK levels (19, 22, 23).
class
MockAndroidSdk
extends
Mock
implements
AndroidSdk
{
static
Directory
createSdkDirectory
({
...
...
@@ -251,78 +239,6 @@ class MockIOSDevice extends Mock implements IOSDevice {
bool
isSupportedForProject
(
FlutterProject
flutterProject
)
=>
true
;
}
/// Common functionality for tracking mock interaction.
class
_BasicMock
{
final
List
<
String
>
messages
=
<
String
>[];
void
expectMessages
(
List
<
String
>
expectedMessages
)
{
final
List
<
String
>
actualMessages
=
List
<
String
>.
of
(
messages
);
messages
.
clear
();
expect
(
actualMessages
,
unorderedEquals
(
expectedMessages
));
}
bool
contains
(
String
match
)
{
print
(
'Checking for `
$match
` in:'
);
print
(
messages
);
final
bool
result
=
messages
.
contains
(
match
);
messages
.
clear
();
return
result
;
}
}
class
MockResidentCompiler
extends
_BasicMock
implements
ResidentCompiler
{
@override
void
accept
()
{
}
@override
Future
<
CompilerOutput
>
reject
()
async
{
return
null
;
}
@override
void
reset
()
{
}
@override
Future
<
dynamic
>
shutdown
()
async
{
}
@override
Future
<
CompilerOutput
>
compileExpression
(
String
expression
,
List
<
String
>
definitions
,
List
<
String
>
typeDefinitions
,
String
libraryUri
,
String
klass
,
bool
isStatic
,
)
async
{
return
null
;
}
@override
Future
<
CompilerOutput
>
compileExpressionToJs
(
String
libraryUri
,
int
line
,
int
column
,
Map
<
String
,
String
>
jsModules
,
Map
<
String
,
String
>
jsFrameValues
,
String
moduleName
,
String
expression
,
)
async
{
return
null
;
}
@override
Future
<
CompilerOutput
>
recompile
(
Uri
mainPath
,
List
<
Uri
>
invalidatedFiles
,
{
String
outputPath
,
PackageConfig
packageConfig
,
bool
suppressErrors
=
false
,
})
async
{
globals
.
fs
.
file
(
outputPath
).
createSync
(
recursive:
true
);
globals
.
fs
.
file
(
outputPath
).
writeAsStringSync
(
'compiled_kernel_output'
);
return
CompilerOutput
(
outputPath
,
0
,
<
Uri
>[]);
}
@override
void
addFileSystemRoot
(
String
root
)
{
}
}
class
MockStdIn
extends
Mock
implements
IOSink
{
final
StringBuffer
stdInWrites
=
StringBuffer
();
...
...
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