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
0f2e50bb
Unverified
Commit
0f2e50bb
authored
Jun 20, 2018
by
Andrew Davies
Committed by
GitHub
Jun 20, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[frdb] Added env test (#18485)
parent
bb23a110
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
16 deletions
+28
-16
fuchsia_remote_connection_test.dart
...e_debug_protocol/test/fuchsia_remote_connection_test.dart
+28
-16
No files found.
packages/fuchsia_remote_debug_protocol/test/fuchsia_remote_connection_test.dart
View file @
0f2e50bb
...
...
@@ -13,30 +13,22 @@ import 'package:fuchsia_remote_debug_protocol/fuchsia_remote_debug_protocol.dart
void
main
(
)
{
group
(
'FuchsiaRemoteConnection.connect'
,
()
{
MockSshCommandRunner
mockRunner
;
List
<
MockPortForwarder
>
forwardedPorts
;
List
<
MockPeer
>
mockPeerConnections
;
List
<
Uri
>
uriConnections
;
setUp
(()
{
mockRunner
=
new
MockSshCommandRunner
();
});
tearDown
(()
{
/// Most tests will mock out the port forwarding and connection
/// functions.
restoreFuchsiaPortForwardingFunction
();
restoreVmServiceConnectionFunction
();
});
test
(
'end-to-end with three vm connections and flutter view query'
,
()
async
{
const
String
address
=
'fe80::8eae:4cff:fef4:9247'
;
const
String
interface
=
'
eno1
';
// Adds some extra junk to make sure the strings will be cleaned up.
when
(
mockRunner
.
run
(
typed
(
any
))).
thenAnswer
((
_
)
=>
new
Future
<
List
<
String
>>.
value
(
<
String
>[
'123
\n\n\n
'
,
'456 '
,
'789'
]));
const
String
address
=
'fe80::8eae:4cff:fef4:9247'
;
const
String
interface
=
'
eno1
';
when(mockRunner.address).thenReturn(address);
when(mockRunner.interface).thenReturn(interface);
forwardedPorts = <MockPortForwarder>[];
int port = 0;
final List<MockPortForwarder> forwardedPorts = <MockPortForwarder>[];
Future<PortForwarder> mockPortForwardingFunction(
String address, int remotePort,
[String interface = '', String configFile]) {
...
...
@@ -91,8 +83,8 @@ void main() {
},
];
final
List
<
MockPeer
>
mockPeerConnections
=
<
MockPeer
>[];
final
List
<
Uri
>
uriConnections
=
<
Uri
>[];
mockPeerConnections
=
<
MockPeer
>[];
uriConnections
=
<
Uri
>[];
Future
<
json_rpc
.
Peer
>
mockVmConnectionFunction
(
Uri
uri
)
{
return
new
Future
<
json_rpc
.
Peer
>(()
async
{
final
MockPeer
mp
=
new
MockPeer
();
...
...
@@ -109,7 +101,17 @@ void main() {
fuchsiaPortForwardingFunction
=
mockPortForwardingFunction
;
fuchsiaVmServiceConnectionFunction
=
mockVmConnectionFunction
;
});
tearDown
(()
{
/// Most tests will mock out the port forwarding and connection
/// functions.
restoreFuchsiaPortForwardingFunction
();
restoreVmServiceConnectionFunction
();
});
test
(
'end-to-end with three vm connections and flutter view query'
,
()
async
{
final
FuchsiaRemoteConnection
connection
=
await
FuchsiaRemoteConnection
.
connectWithSshCommandRunner
(
mockRunner
);
...
...
@@ -142,6 +144,16 @@ void main() {
verify
(
forwardedPorts
[
1
].
stop
());
verify
(
forwardedPorts
[
2
].
stop
());
});
test
(
'env variable test without remote addr'
,
()
async
{
Future
<
Null
>
failingFunction
()
async
{
await
FuchsiaRemoteConnection
.
connect
();
}
// Should fail as no env variable has been passed.
expect
(
failingFunction
,
throwsA
(
const
isInstanceOf
<
FuchsiaRemoteConnectionError
>()));
});
});
}
...
...
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