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
9218f09d
Unverified
Commit
9218f09d
authored
May 14, 2021
by
Jonah Williams
Committed by
GitHub
May 14, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[flutter_tools] remove some mocks from web resident runner tests (#82522)
parent
496acdf5
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
41 additions
and
32 deletions
+41
-32
resident_web_runner_test.dart
...er_tools/test/general.shard/resident_web_runner_test.dart
+41
-32
No files found.
packages/flutter_tools/test/general.shard/resident_web_runner_test.dart
View file @
9218f09d
...
@@ -100,10 +100,8 @@ void main() {
...
@@ -100,10 +100,8 @@ void main() {
MockFlutterDevice
mockFlutterDevice
;
MockFlutterDevice
mockFlutterDevice
;
MockWebDevFS
mockWebDevFS
;
MockWebDevFS
mockWebDevFS
;
MockResidentCompiler
mockResidentCompiler
;
MockResidentCompiler
mockResidentCompiler
;
MockChromeConnection
mockChromeConnection
;
FakeChromeConnection
chromeConnection
;
MockChromeTab
mockChromeTab
;
FakeChromeTab
chromeTab
;
MockWipConnection
mockWipConnection
;
MockWipDebugger
mockWipDebugger
;
MockWebServerDevice
mockWebServerDevice
;
MockWebServerDevice
mockWebServerDevice
;
MockDevice
mockDevice
;
MockDevice
mockDevice
;
FakeVmServiceHost
fakeVmServiceHost
;
FakeVmServiceHost
fakeVmServiceHost
;
...
@@ -121,10 +119,8 @@ void main() {
...
@@ -121,10 +119,8 @@ void main() {
mockFlutterDevice
=
MockFlutterDevice
();
mockFlutterDevice
=
MockFlutterDevice
();
mockWebDevFS
=
MockWebDevFS
();
mockWebDevFS
=
MockWebDevFS
();
mockResidentCompiler
=
MockResidentCompiler
();
mockResidentCompiler
=
MockResidentCompiler
();
mockChromeConnection
=
MockChromeConnection
();
chromeConnection
=
FakeChromeConnection
();
mockChromeTab
=
MockChromeTab
();
chromeTab
=
FakeChromeTab
(
'index.html'
);
mockWipConnection
=
MockWipConnection
();
mockWipDebugger
=
MockWipDebugger
();
mockWebServerDevice
=
MockWebServerDevice
();
mockWebServerDevice
=
MockWebServerDevice
();
when
(
mockFlutterDevice
.
devFS
).
thenReturn
(
mockWebDevFS
);
when
(
mockFlutterDevice
.
devFS
).
thenReturn
(
mockWebDevFS
);
when
(
mockFlutterDevice
.
device
).
thenReturn
(
mockDevice
);
when
(
mockFlutterDevice
.
device
).
thenReturn
(
mockDevice
);
...
@@ -170,13 +166,7 @@ void main() {
...
@@ -170,13 +166,7 @@ void main() {
when
(
mockWebDevFS
.
sources
).
thenReturn
(<
Uri
>[]);
when
(
mockWebDevFS
.
sources
).
thenReturn
(<
Uri
>[]);
when
(
mockWebDevFS
.
baseUri
).
thenReturn
(
Uri
.
parse
(
'http://localhost:12345'
));
when
(
mockWebDevFS
.
baseUri
).
thenReturn
(
Uri
.
parse
(
'http://localhost:12345'
));
when
(
mockFlutterDevice
.
generator
).
thenReturn
(
mockResidentCompiler
);
when
(
mockFlutterDevice
.
generator
).
thenReturn
(
mockResidentCompiler
);
when
(
mockChromeConnection
.
getTab
(
any
)).
thenAnswer
((
Invocation
invocation
)
async
{
chromeConnection
.
tabs
.
add
(
chromeTab
);
return
mockChromeTab
;
});
when
(
mockChromeTab
.
connect
()).
thenAnswer
((
Invocation
invocation
)
async
{
return
mockWipConnection
;
});
when
(
mockWipConnection
.
debugger
).
thenReturn
(
mockWipDebugger
);
}
}
testUsingContext
(
'runner with web server device does not support debugging without --start-paused'
,
()
{
testUsingContext
(
'runner with web server device does not support debugging without --start-paused'
,
()
{
...
@@ -546,7 +536,7 @@ void main() {
...
@@ -546,7 +536,7 @@ void main() {
]);
]);
_setupMocks
();
_setupMocks
();
final
TestChromiumLauncher
chromiumLauncher
=
TestChromiumLauncher
();
final
TestChromiumLauncher
chromiumLauncher
=
TestChromiumLauncher
();
final
Chromium
chrome
=
Chromium
(
1
,
mockC
hromeConnection
,
chromiumLauncher:
chromiumLauncher
);
final
Chromium
chrome
=
Chromium
(
1
,
c
hromeConnection
,
chromiumLauncher:
chromiumLauncher
);
chromiumLauncher
.
instance
=
chrome
;
chromiumLauncher
.
instance
=
chrome
;
when
(
mockFlutterDevice
.
device
).
thenReturn
(
GoogleChromeDevice
(
when
(
mockFlutterDevice
.
device
).
thenReturn
(
GoogleChromeDevice
(
...
@@ -620,7 +610,7 @@ void main() {
...
@@ -620,7 +610,7 @@ void main() {
]);
]);
_setupMocks
();
_setupMocks
();
final
TestChromiumLauncher
chromiumLauncher
=
TestChromiumLauncher
();
final
TestChromiumLauncher
chromiumLauncher
=
TestChromiumLauncher
();
final
Chromium
chrome
=
Chromium
(
1
,
mockC
hromeConnection
,
chromiumLauncher:
chromiumLauncher
);
final
Chromium
chrome
=
Chromium
(
1
,
c
hromeConnection
,
chromiumLauncher:
chromiumLauncher
);
chromiumLauncher
.
instance
=
chrome
;
chromiumLauncher
.
instance
=
chrome
;
when
(
mockFlutterDevice
.
device
).
thenReturn
(
GoogleChromeDevice
(
when
(
mockFlutterDevice
.
device
).
thenReturn
(
GoogleChromeDevice
(
...
@@ -992,9 +982,9 @@ void main() {
...
@@ -992,9 +982,9 @@ void main() {
...
kAttachIsolateExpectations
,
...
kAttachIsolateExpectations
,
]);
]);
_setupMocks
();
_setupMocks
();
final
MockChromeConnection
mockChromeConnection
=
Mock
ChromeConnection
();
final
FakeChromeConnection
chromeConnection
=
Fake
ChromeConnection
();
final
TestChromiumLauncher
chromiumLauncher
=
TestChromiumLauncher
();
final
TestChromiumLauncher
chromiumLauncher
=
TestChromiumLauncher
();
final
Chromium
chrome
=
Chromium
(
1
,
mockC
hromeConnection
,
chromiumLauncher:
chromiumLauncher
);
final
Chromium
chrome
=
Chromium
(
1
,
c
hromeConnection
,
chromiumLauncher:
chromiumLauncher
);
chromiumLauncher
.
instance
=
chrome
;
chromiumLauncher
.
instance
=
chrome
;
when
(
mockFlutterDevice
.
device
).
thenReturn
(
GoogleChromeDevice
(
when
(
mockFlutterDevice
.
device
).
thenReturn
(
GoogleChromeDevice
(
...
@@ -1007,14 +997,8 @@ void main() {
...
@@ -1007,14 +997,8 @@ void main() {
when
(
mockWebDevFS
.
create
()).
thenAnswer
((
Invocation
invocation
)
async
{
when
(
mockWebDevFS
.
create
()).
thenAnswer
((
Invocation
invocation
)
async
{
return
Uri
.
parse
(
'http://localhost:8765/app/'
);
return
Uri
.
parse
(
'http://localhost:8765/app/'
);
});
});
final
MockChromeTab
mockChromeTab
=
MockChromeTab
();
final
FakeChromeTab
chromeTab
=
FakeChromeTab
(
'index.html'
);
final
MockWipConnection
mockWipConnection
=
MockWipConnection
();
chromeConnection
.
tabs
.
add
(
chromeTab
);
when
(
mockChromeConnection
.
getTab
(
any
)).
thenAnswer
((
Invocation
invocation
)
async
{
return
mockChromeTab
;
});
when
(
mockChromeTab
.
connect
()).
thenAnswer
((
Invocation
invocation
)
async
{
return
mockWipConnection
;
});
final
ResidentWebRunner
runner
=
ResidentWebRunner
(
final
ResidentWebRunner
runner
=
ResidentWebRunner
(
mockFlutterDevice
,
mockFlutterDevice
,
...
@@ -1201,11 +1185,36 @@ class MockStatus extends Mock implements Status {}
...
@@ -1201,11 +1185,36 @@ class MockStatus extends Mock implements Status {}
class
MockFlutterDevice
extends
Mock
implements
FlutterDevice
{}
class
MockFlutterDevice
extends
Mock
implements
FlutterDevice
{}
class
MockWebDevFS
extends
Mock
implements
WebDevFS
{}
class
MockWebDevFS
extends
Mock
implements
WebDevFS
{}
class
MockResidentCompiler
extends
Mock
implements
ResidentCompiler
{}
class
MockResidentCompiler
extends
Mock
implements
ResidentCompiler
{}
class
MockChrome
extends
Mock
implements
Chromium
{}
class
MockChromeConnection
extends
Mock
implements
ChromeConnection
{}
class
FakeChromeConnection
extends
Fake
implements
ChromeConnection
{
class
MockChromeTab
extends
Mock
implements
ChromeTab
{}
final
List
<
ChromeTab
>
tabs
=
<
ChromeTab
>[];
class
MockWipConnection
extends
Mock
implements
WipConnection
{}
class
MockWipDebugger
extends
Mock
implements
WipDebugger
{}
@override
Future
<
ChromeTab
>
getTab
(
bool
Function
(
ChromeTab
tab
)
accept
,
{
Duration
retryFor
})
async
{
return
tabs
.
firstWhere
(
accept
);
}
}
class
FakeChromeTab
extends
Fake
implements
ChromeTab
{
FakeChromeTab
(
this
.
url
);
@override
final
String
url
;
final
FakeWipConnection
connection
=
FakeWipConnection
();
@override
Future
<
WipConnection
>
connect
()
async
{
return
connection
;
}
}
class
FakeWipConnection
extends
Fake
implements
WipConnection
{
@override
final
WipDebugger
debugger
=
FakeWipDebugger
();
}
class
FakeWipDebugger
extends
Fake
implements
WipDebugger
{}
class
MockWebServerDevice
extends
Mock
implements
WebServerDevice
{}
class
MockWebServerDevice
extends
Mock
implements
WebServerDevice
{}
class
MockDevice
extends
Mock
implements
Device
{}
class
MockDevice
extends
Mock
implements
Device
{}
...
...
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