-
Notifications
You must be signed in to change notification settings - Fork 85
Added support for some debugging APIs with the DDC library bundle format #2564
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 18 commits
Commits
Show all changes
30 commits
Select commit
Hold shift + click to select a range
7caa652
Added support for getClassMetadata with the DDc library bundle format
jyameo 5f29674
Merge branch 'main' into yj-dartdevembedder-3
jyameo 17a9775
Merge branch 'main' into yj-dartdevembedder-3
jyameo f3b2bd7
Added support for some debugging APIs with the DDC library bundle for…
jyameo a1f017c
Update pattern test to account for new DDC JS variable naming
jyameo 58b8762
reverting change to pattern test
jyameo c781e5f
Added support for debugging API with the DDC library bundle format.
jyameo 8a9006a
Merge branch 'main' into yj-dartdevembedder-4
jyameo 0b235e6
updated licenses
jyameo 607c7e4
updated licenses and remove new line from changelog
jyameo 067ab27
Merge branch 'main' into yj-dartdevembedder-5
jyameo b9a8c2f
Added support for some debugging APIs with the DDC library bundle for…
jyameo b220536
Merge branch 'main' into yj-dartdevembedder-5
jyameo 75f57a9
Merge branch 'main' into yj-dartdevembedder-5
jyameo 3401d30
Merge branch 'main' into yj-dartdevembedder-5
jyameo 1e44766
Added support for some debugging APIs with the DDC library bundle format
jyameo 62c3cea
Merge branch 'main' into yj-dartdevembedder-6
jyameo c537b7b
updated CHANGELOG
jyameo 0e35c5e
refactored test to use common file
jyameo 344867d
delete main_ddc_library_bundle.dart
jyameo 22cdf34
Merge branch 'main' into yj-dartdevembedder-6
jyameo db9abfb
fixed broken test - decoded response body to match source and renamed…
jyameo c7b0632
Merge branch 'main' into yj-dartdevembedder-6
jyameo 1bc9d5c
updated changelog
jyameo 32c12a5
updated dart_scope to not renamed wildcard and skipped related test case
jyameo aa38d3a
formatted test/common/chrome_proxy_service_common.dart
jyameo d4ec13f
replaced wildcard with timer
jyameo f5758a2
updated call to DartUri and removed unecessary check
jyameo 7a601a1
updated DCM version
jyameo a76ffcc
updated DCM version to 1.26.0-1
jyameo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
135 changes: 135 additions & 0 deletions
135
dwds/test/chrome_proxy_service_ddc_library_bundle_test.dart
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,135 @@ | ||
// Copyright (c) 2025, the Dart project authors. Please see the AUTHORS file | ||
// for details. All rights reserved. Use of this source code is governed by a | ||
// BSD-style license that can be found in the LICENSE file. | ||
|
||
@TestOn('vm') | ||
@Tags(['daily']) | ||
@Timeout(Duration(minutes: 2)) | ||
library; | ||
|
||
import 'dart:convert'; | ||
|
||
import 'package:dwds/expression_compiler.dart'; | ||
import 'package:dwds/src/services/chrome_proxy_service.dart'; | ||
import 'package:test/test.dart'; | ||
import 'package:test_common/logging.dart'; | ||
import 'package:test_common/test_sdk_configuration.dart'; | ||
import 'package:vm_service/vm_service.dart'; | ||
|
||
import 'fixtures/context.dart'; | ||
import 'fixtures/project.dart'; | ||
import 'fixtures/utilities.dart'; | ||
|
||
void main() { | ||
// Change to true to see verbose output from the tests. | ||
final debug = false; | ||
final moduleFormat = ModuleFormat.ddc; | ||
final canaryFeatures = true; | ||
final compilationMode = CompilationMode.frontendServer; | ||
|
||
final provider = TestSdkConfigurationProvider( | ||
verbose: debug, | ||
ddcModuleFormat: moduleFormat, | ||
canaryFeatures: canaryFeatures, | ||
); | ||
tearDownAll(provider.dispose); | ||
|
||
final context = TestContext(TestProject.testDdcLibraryBundle, provider); | ||
|
||
group('shared context', () { | ||
setUpAll(() async { | ||
setCurrentLogWriter(debug: debug); | ||
await context.setUp( | ||
testSettings: TestSettings( | ||
enableExpressionEvaluation: true, | ||
verboseCompiler: false, | ||
moduleFormat: provider.ddcModuleFormat, | ||
canaryFeatures: provider.canaryFeatures, | ||
compilationMode: compilationMode, | ||
), | ||
); | ||
}); | ||
|
||
tearDownAll(() async { | ||
await context.tearDown(); | ||
}); | ||
|
||
group('callServiceExtension', () { | ||
late ChromeProxyService service; | ||
|
||
setUp(() { | ||
setCurrentLogWriter(debug: debug); | ||
service = context.service; | ||
}); | ||
|
||
test( | ||
'success', | ||
() async { | ||
final serviceMethod = 'ext.test.callServiceExtension'; | ||
await context.tabConnection.runtime | ||
.evaluate('registerExtension("$serviceMethod");'); | ||
|
||
// The non-string keys/values get auto json-encoded to match the vm | ||
// behavior. | ||
final args = { | ||
'bool': true, | ||
'list': [1, '2', 3], | ||
'map': {'foo': 'bar'}, | ||
'num': 1.0, | ||
'string': 'hello', | ||
1: 2, | ||
false: true, | ||
}; | ||
|
||
final result = | ||
await service.callServiceExtension(serviceMethod, args: args); | ||
expect( | ||
result.json, | ||
args.map( | ||
(k, v) => MapEntry( | ||
k is String ? k : jsonEncode(k), | ||
v is String ? v : jsonEncode(v), | ||
), | ||
), | ||
); | ||
}, | ||
onPlatform: { | ||
'windows': | ||
const Skip('https://github.com/dart-lang/webdev/issues/711'), | ||
}, | ||
); | ||
|
||
test( | ||
'failure', | ||
() async { | ||
final serviceMethod = 'ext.test.callServiceExtensionWithError'; | ||
await context.tabConnection.runtime | ||
.evaluate('registerExtensionWithError("$serviceMethod");'); | ||
|
||
final errorDetails = {'intentional': 'error'}; | ||
expect( | ||
service.callServiceExtension( | ||
serviceMethod, | ||
args: { | ||
'code': '-32001', | ||
'details': jsonEncode(errorDetails), | ||
}, | ||
), | ||
throwsA( | ||
predicate( | ||
(dynamic error) => | ||
error is RPCError && | ||
error.code == -32001 && | ||
error.details == jsonEncode(errorDetails), | ||
), | ||
), | ||
); | ||
}, | ||
onPlatform: { | ||
'windows': | ||
const Skip('https://github.com/dart-lang/webdev/issues/711'), | ||
}, | ||
); | ||
}); | ||
}); | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
fixtures/_testSound/example/hello_world/main_ddc_library_bundle.dart
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// Copyright (c) 2025, the Dart project authors. Please see the AUTHORS file | ||
// for details. All rights reserved. Use of this source code is governed by a | ||
// BSD-style license that can be found in the LICENSE file. | ||
|
||
import 'dart:convert'; | ||
import 'dart:developer'; | ||
import 'dart:js'; | ||
jyameo marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
// Create a series of top level objects for tests in | ||
// dwds/test/chrome_proxy_service_ddc_library_bundle_test.dart | ||
|
||
void main() async { | ||
context['registerExtension'] = (String method) { | ||
jyameo marked this conversation as resolved.
Show resolved
Hide resolved
|
||
registerExtension(method, | ||
(String method, Map<String, String> parameters) async { | ||
return ServiceExtensionResponse.result(jsonEncode(parameters)); | ||
}); | ||
}; | ||
|
||
context['registerExtensionWithError'] = (String method) { | ||
registerExtension(method, | ||
(String method, Map<String, String> parameters) async { | ||
return ServiceExtensionResponse.error( | ||
int.parse(parameters['code']!), parameters['details']!); | ||
}); | ||
}; | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.