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
75a44a29
Unverified
Commit
75a44a29
authored
Apr 03, 2021
by
Ben Konyi
Committed by
GitHub
Apr 03, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[ Web ] Register service extensions with DDS, not DWDS (#79479)
parent
437e32b9
Changes
7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
353 additions
and
172 deletions
+353
-172
devfs_web.dart
packages/flutter_tools/lib/src/isolated/devfs_web.dart
+9
-2
resident_web_runner.dart
...s/flutter_tools/lib/src/isolated/resident_web_runner.dart
+2
-2
vmservice.dart
packages/flutter_tools/lib/src/vmservice.dart
+18
-8
resident_web_runner_test.dart
...er_tools/test/general.shard/resident_web_runner_test.dart
+5
-1
test_driver.dart
...ges/flutter_tools/test/integration.shard/test_driver.dart
+4
-3
expression_evaluation_web_test.dart
..._tools/test/web.shard/expression_evaluation_web_test.dart
+176
-156
vm_service_web_test.dart
...ges/flutter_tools/test/web.shard/vm_service_web_test.dart
+139
-0
No files found.
packages/flutter_tools/lib/src/isolated/devfs_web.dart
View file @
75a44a29
...
...
@@ -17,6 +17,7 @@ import 'package:mime/mime.dart' as mime;
import
'package:package_config/package_config.dart'
;
import
'package:shelf/shelf.dart'
as
shelf
;
import
'package:shelf/shelf_io.dart'
as
shelf
;
import
'package:vm_service/vm_service.dart'
as
vm_service
;
import
'../artifacts.dart'
;
import
'../asset.dart'
;
...
...
@@ -35,6 +36,7 @@ import '../dart/package_map.dart';
import
'../devfs.dart'
;
import
'../globals.dart'
as
globals
;
import
'../project.dart'
;
import
'../vmservice.dart'
;
import
'../web/bootstrap.dart'
;
import
'../web/chrome.dart'
;
import
'../web/compile.dart'
;
...
...
@@ -592,10 +594,11 @@ class WebAssetServer implements AssetReader {
}
class
ConnectionResult
{
ConnectionResult
(
this
.
appConnection
,
this
.
debugConnection
);
ConnectionResult
(
this
.
appConnection
,
this
.
debugConnection
,
this
.
vmService
);
final
AppConnection
appConnection
;
final
DebugConnection
debugConnection
;
final
vm_service
.
VmService
vmService
;
}
/// The web specific DevFS implementation.
...
...
@@ -665,8 +668,12 @@ class WebDevFS implements DevFS {
if
(
firstConnection
.
isCompleted
)
{
appConnection
.
runMain
();
}
else
{
final
vm_service
.
VmService
vmService
=
await
createVmServiceDelegate
(
Uri
.
parse
(
debugConnection
.
uri
),
logger:
globals
.
logger
,
);
firstConnection
.
complete
(
ConnectionResult
(
appConnection
,
debugConnection
));
.
complete
(
ConnectionResult
(
appConnection
,
debugConnection
,
vmService
));
}
}
on
Exception
catch
(
error
,
stackTrace
)
{
if
(!
firstConnection
.
isCompleted
)
{
...
...
packages/flutter_tools/lib/src/isolated/resident_web_runner.dart
View file @
75a44a29
...
...
@@ -155,7 +155,7 @@ class ResidentWebRunner extends ResidentRunner {
if
(
_instance
!=
null
)
{
return
_instance
;
}
final
vmservice
.
VmService
service
=
_connectionResult
?.
debugConnection
?.
vmService
;
final
vmservice
.
VmService
service
=
_connectionResult
?.
vmService
;
final
Uri
websocketUri
=
Uri
.
parse
(
_connectionResult
.
debugConnection
.
uri
);
final
Uri
httpUri
=
_httpUriFromWebsocketUri
(
websocketUri
);
return
_instance
??=
FlutterVmService
(
service
,
wsAddress:
websocketUri
,
httpAddress:
httpUri
);
...
...
@@ -835,7 +835,7 @@ class ResidentWebRunner extends ResidentRunner {
_connectionResult
.
appConnection
.
runMain
();
}
else
{
StreamSubscription
<
void
>
resumeSub
;
resumeSub
=
_
connectionResult
.
debugConnection
.
vmS
ervice
.
onDebugEvent
resumeSub
=
_
vmService
.
s
ervice
.
onDebugEvent
.
listen
((
vmservice
.
Event
event
)
{
if
(
event
.
type
==
vmservice
.
EventKind
.
kResume
)
{
_connectionResult
.
appConnection
.
runMain
();
...
...
packages/flutter_tools/lib/src/vmservice.dart
View file @
75a44a29
...
...
@@ -326,6 +326,22 @@ Future<FlutterVmService> connectToVmService(
);
}
Future
<
vm_service
.
VmService
>
createVmServiceDelegate
(
Uri
wsUri
,
{
io
.
CompressionOptions
compression
=
io
.
CompressionOptions
.
compressionDefault
,
@required
Logger
logger
,
})
async
{
final
io
.
WebSocket
channel
=
await
_openChannel
(
wsUri
.
toString
(),
compression:
compression
,
logger:
logger
);
return
vm_service
.
VmService
(
channel
,
channel
.
add
,
log:
null
,
disposeHandler:
()
async
{
await
channel
.
close
();
},
);
}
Future
<
FlutterVmService
>
_connect
(
Uri
httpUri
,
{
ReloadSources
reloadSources
,
...
...
@@ -338,14 +354,8 @@ Future<FlutterVmService> _connect(
@required
Logger
logger
,
})
async
{
final
Uri
wsUri
=
httpUri
.
replace
(
scheme:
'ws'
,
path:
urlContext
.
join
(
httpUri
.
path
,
'ws'
));
final
io
.
WebSocket
channel
=
await
_openChannel
(
wsUri
.
toString
(),
compression:
compression
,
logger:
logger
);
final
vm_service
.
VmService
delegateService
=
vm_service
.
VmService
(
channel
,
channel
.
add
,
log:
null
,
disposeHandler:
()
async
{
await
channel
.
close
();
},
final
vm_service
.
VmService
delegateService
=
await
createVmServiceDelegate
(
wsUri
,
compression:
compression
,
logger:
logger
,
);
final
vm_service
.
VmService
service
=
await
setUpVmService
(
...
...
packages/flutter_tools/test/general.shard/resident_web_runner_test.dart
View file @
75a44a29
...
...
@@ -130,7 +130,11 @@ void main() {
when
(
mockFlutterDevice
.
devFS
).
thenReturn
(
mockWebDevFS
);
when
(
mockFlutterDevice
.
device
).
thenReturn
(
mockDevice
);
when
(
mockWebDevFS
.
connect
(
any
)).
thenAnswer
((
Invocation
invocation
)
async
{
return
ConnectionResult
(
mockAppConnection
,
mockDebugConnection
);
return
ConnectionResult
(
mockAppConnection
,
mockDebugConnection
,
mockDebugConnection
.
vmService
,
);
});
fileSystem
.
file
(
'.packages'
).
writeAsStringSync
(
'
\n
'
);
});
...
...
packages/flutter_tools/test/integration.shard/test_driver.dart
View file @
75a44a29
...
...
@@ -63,6 +63,7 @@ abstract class FlutterTestDriver {
Stream
<
String
>
get
stdout
=>
_stdout
.
stream
;
int
get
vmServicePort
=>
_vmServiceWsUri
.
port
;
bool
get
hasExited
=>
_hasExited
;
Uri
get
vmServiceWsUri
=>
_vmServiceWsUri
;
String
lastTime
=
''
;
void
_debugPrint
(
String
message
,
{
String
topic
=
''
})
{
...
...
@@ -219,7 +220,7 @@ abstract class FlutterTestDriver {
return
_flutterIsolateId
;
}
Future
<
Isolate
>
_
getFlutterIsolate
()
async
{
Future
<
Isolate
>
getFlutterIsolate
()
async
{
final
Isolate
isolate
=
await
_vmService
.
getIsolate
(
await
_getFlutterIsolateId
());
return
isolate
;
}
...
...
@@ -281,7 +282,7 @@ abstract class FlutterTestDriver {
// Cancel the subscription on either of the above.
await
pauseSubscription
.
cancel
();
return
_
getFlutterIsolate
();
return
getFlutterIsolate
();
},
task:
'Waiting for isolate to pause'
,
);
...
...
@@ -294,7 +295,7 @@ abstract class FlutterTestDriver {
Future
<
Isolate
>
stepOut
({
bool
waitForNextPause
=
true
})
=>
_resume
(
StepOption
.
kOut
,
waitForNextPause
);
Future
<
bool
>
isAtAsyncSuspension
()
async
{
final
Isolate
isolate
=
await
_
getFlutterIsolate
();
final
Isolate
isolate
=
await
getFlutterIsolate
();
return
isolate
.
pauseEvent
.
atAsyncSuspension
==
true
;
}
...
...
packages/flutter_tools/test/web.shard/expression_evaluation_web_test.dart
View file @
75a44a29
This diff is collapsed.
Click to expand it.
packages/flutter_tools/test/web.shard/vm_service_web_test.dart
0 → 100644
View file @
75a44a29
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// @dart = 2.8
import
'dart:async'
;
import
'package:file/file.dart'
;
import
'package:flutter_tools/src/base/file_system.dart'
;
import
'package:vm_service/vm_service.dart'
;
import
'package:vm_service/vm_service_io.dart'
;
import
'../integration.shard/test_data/basic_project.dart'
;
import
'../integration.shard/test_driver.dart'
;
import
'../integration.shard/test_utils.dart'
;
import
'../src/common.dart'
;
void
main
(
)
{
Directory
tempDir
;
final
BasicProjectWithUnaryMain
project
=
BasicProjectWithUnaryMain
();
FlutterRunTestDriver
flutter
;
group
(
'Clients of flutter run on web with DDS enabled'
,
()
{
setUp
(()
async
{
tempDir
=
createResolvedTempDirectorySync
(
'run_test.'
);
await
project
.
setUpIn
(
tempDir
);
flutter
=
FlutterRunTestDriver
(
tempDir
,
spawnDdsInstance:
true
);
});
tearDown
(()
async
{
await
flutter
.
stop
();
tryToDelete
(
tempDir
);
});
testWithoutContext
(
'can validate flutter version'
,
()
async
{
await
flutter
.
run
(
withDebugger:
true
,
chrome:
true
,
additionalCommandArgs:
<
String
>[
'--verbose'
]);
expect
(
flutter
.
vmServiceWsUri
,
isNotNull
);
final
VmService
client
=
await
vmServiceConnectUri
(
'
${flutter.vmServiceWsUri}
'
);
await
validateFlutterVersion
(
client
);
});
testWithoutContext
(
'can validate flutter version in parallel'
,
()
async
{
await
flutter
.
run
(
withDebugger:
true
,
chrome:
true
,
additionalCommandArgs:
<
String
>[
'--verbose'
]);
expect
(
flutter
.
vmServiceWsUri
,
isNotNull
);
final
VmService
client1
=
await
vmServiceConnectUri
(
'
${flutter.vmServiceWsUri}
'
);
final
VmService
client2
=
await
vmServiceConnectUri
(
'
${flutter.vmServiceWsUri}
'
);
await
Future
.
wait
(<
Future
<
void
>>[
validateFlutterVersion
(
client1
),
validateFlutterVersion
(
client2
)]
);
},
skip:
'DDS failure: https://github.com/dart-lang/sdk/issues/45569'
);
});
group
(
'Clients of flutter run on web with DDS disabled'
,
()
{
setUp
(()
async
{
tempDir
=
createResolvedTempDirectorySync
(
'run_test.'
);
await
project
.
setUpIn
(
tempDir
);
flutter
=
FlutterRunTestDriver
(
tempDir
,
spawnDdsInstance:
false
);
});
tearDown
(()
async
{
await
flutter
.
stop
();
tryToDelete
(
tempDir
);
});
testWithoutContext
(
'can validate flutter version'
,
()
async
{
await
flutter
.
run
(
withDebugger:
true
,
chrome:
true
,
additionalCommandArgs:
<
String
>[
'--verbose'
]);
expect
(
flutter
.
vmServiceWsUri
,
isNotNull
);
final
VmService
client
=
await
vmServiceConnectUri
(
'
${flutter.vmServiceWsUri}
'
);
await
validateFlutterVersion
(
client
);
});
testWithoutContext
(
'can validate flutter version in parallel'
,
()
async
{
await
flutter
.
run
(
withDebugger:
true
,
chrome:
true
,
additionalCommandArgs:
<
String
>[
'--verbose'
]);
expect
(
flutter
.
vmServiceWsUri
,
isNotNull
);
final
VmService
client1
=
await
vmServiceConnectUri
(
'
${flutter.vmServiceWsUri}
'
);
final
VmService
client2
=
await
vmServiceConnectUri
(
'
${flutter.vmServiceWsUri}
'
);
await
Future
.
wait
(<
Future
<
void
>>[
validateFlutterVersion
(
client1
),
validateFlutterVersion
(
client2
)]
);
});
});
}
Future
<
void
>
validateFlutterVersion
(
VmService
client
)
async
{
String
method
;
final
Future
<
dynamic
>
registration
=
expectLater
(
client
.
onEvent
(
'Service'
),
emitsThrough
(
predicate
((
Event
e
)
{
if
(
e
.
kind
==
EventKind
.
kServiceRegistered
&&
e
.
service
==
'flutterVersion'
)
{
method
=
e
.
method
;
return
true
;
}
return
false
;
}))
);
await
client
.
streamListen
(
'Service'
);
await
registration
;
await
client
.
streamCancel
(
'Service'
);
final
dynamic
version1
=
await
client
.
callServiceExtension
(
method
);
expect
(
version1
,
const
TypeMatcher
<
Success
>()
.
having
((
Success
r
)
=>
r
.
type
,
'type'
,
'Success'
)
.
having
((
Success
r
)
=>
r
.
json
[
'frameworkVersion'
],
'frameworkVersion'
,
isNotNull
));
await
client
.
dispose
();
}
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