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
716a672b
Unverified
Commit
716a672b
authored
Sep 27, 2019
by
Zachary Anderson
Committed by
GitHub
Sep 27, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[flutter_tools] Adds tests of mdns analytics events (#41410)
parent
8a2f8adf
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
0 deletions
+8
-0
devices_test.dart
...es/flutter_tools/test/general.shard/ios/devices_test.dart
+8
-0
No files found.
packages/flutter_tools/test/general.shard/ios/devices_test.dart
View file @
716a672b
...
...
@@ -23,6 +23,7 @@ import 'package:flutter_tools/src/ios/ios_workflow.dart';
import
'package:flutter_tools/src/macos/xcode.dart'
;
import
'package:flutter_tools/src/mdns_discovery.dart'
;
import
'package:flutter_tools/src/project.dart'
;
import
'package:flutter_tools/src/reporting/reporting.dart'
;
import
'package:meta/meta.dart'
;
import
'package:mockito/mockito.dart'
;
import
'package:platform/platform.dart'
;
...
...
@@ -44,6 +45,7 @@ class MockMDnsObservatoryDiscovery extends Mock implements MDnsObservatoryDiscov
class
MockXcode
extends
Mock
implements
Xcode
{}
class
MockFile
extends
Mock
implements
File
{}
class
MockPortForwarder
extends
Mock
implements
DevicePortForwarder
{}
class
MockUsage
extends
Mock
implements
Usage
{}
void
main
(
)
{
final
FakePlatform
macPlatform
=
FakePlatform
.
fromPlatform
(
const
LocalPlatform
());
...
...
@@ -84,6 +86,7 @@ void main() {
MockPortForwarder
mockPortForwarder
;
MockIMobileDevice
mockIMobileDevice
;
MockIOSDeploy
mockIosDeploy
;
MockUsage
mockUsage
;
Directory
tempDir
;
Directory
projectDir
;
...
...
@@ -115,6 +118,7 @@ void main() {
mockPortForwarder
=
MockPortForwarder
();
mockIMobileDevice
=
MockIMobileDevice
();
mockIosDeploy
=
MockIOSDeploy
();
mockUsage
=
MockUsage
();
tempDir
=
fs
.
systemTempDirectory
.
createTempSync
(
'flutter_tools_create_test.'
);
projectDir
=
tempDir
.
childDirectory
(
'flutter_project'
);
...
...
@@ -183,6 +187,7 @@ void main() {
debuggingOptions:
DebuggingOptions
.
enabled
(
const
BuildInfo
(
BuildMode
.
debug
,
null
)),
platformArgs:
<
String
,
dynamic
>{},
);
verify
(
mockUsage
.
sendEvent
(
'ios-mdns'
,
'success'
)).
called
(
1
);
expect
(
launchResult
.
started
,
isTrue
);
expect
(
launchResult
.
hasObservatory
,
isTrue
);
expect
(
await
device
.
stopApp
(
mockApp
),
isFalse
);
...
...
@@ -193,6 +198,7 @@ void main() {
MDnsObservatoryDiscovery:
()
=>
mockMDnsObservatoryDiscovery
,
Platform:
()
=>
macPlatform
,
ProcessManager:
()
=>
mockProcessManager
,
Usage:
()
=>
mockUsage
,
});
testUsingContext
(
' succeeds in debug mode when mDNS fails by falling back to manual protocol discovery'
,
()
async
{
...
...
@@ -212,6 +218,7 @@ void main() {
debuggingOptions:
DebuggingOptions
.
enabled
(
const
BuildInfo
(
BuildMode
.
debug
,
null
)),
platformArgs:
<
String
,
dynamic
>{},
);
verify
(
mockUsage
.
sendEvent
(
'ios-mdns'
,
'failure'
)).
called
(
1
);
expect
(
launchResult
.
started
,
isTrue
);
expect
(
launchResult
.
hasObservatory
,
isTrue
);
expect
(
await
device
.
stopApp
(
mockApp
),
isFalse
);
...
...
@@ -222,6 +229,7 @@ void main() {
MDnsObservatoryDiscovery:
()
=>
mockMDnsObservatoryDiscovery
,
Platform:
()
=>
macPlatform
,
ProcessManager:
()
=>
mockProcessManager
,
Usage:
()
=>
mockUsage
,
});
testUsingContext
(
' fails in debug mode when mDNS fails and when Observatory URI is malformed'
,
()
async
{
...
...
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