[dwds] Copy changes from github

Copy into pkg/dwds and pkg/dwds_test_common.

* https://github.com/dart-lang/webdev/commit/ac63d06eb9a186f5799b5e6ecb97eb097562ed8a
* https://github.com/dart-lang/webdev/commit/f9a56607fac5ad0c979d2647cf11d3e3be993bf6
* https://github.com/dart-lang/webdev/commit/b2cd91f6ef8072847cba0cde33fe6e007403fb7b

Selectively revert incompatible changes to the pubspec.yaml files.

Change-Id: I4fc2bbd7440e699bb010262529edfc19a0fd3433
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/501221
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Jessy Yameogo <yjessy@google.com>
This commit is contained in:
Nicholas Shahan
2026-05-06 16:14:04 -07:00
committed by dart-scoped@luci-project-accounts.iam.gserviceaccount.com
parent 5a98fe5564
commit 23bd610f97
16 changed files with 1035 additions and 627 deletions
+6 -2
View File
@@ -1,6 +1,10 @@
## 27.1.1-wip
## 27.1.2-wip
- Replace raw map for client ping checks with a proper `PingRequest` class and update client deserialization handling.
## 27.1.1
- Fix deserialization errors appearing in the chrome console.
Replace raw map for client ping checks with a proper `PingRequest` class and
update client deserialization handling.
## 27.1.0
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -1,2 +1,2 @@
// Generated code. Do not modify.
const packageVersion = '27.1.1-wip';
const packageVersion = '27.1.2-wip';
+2 -2
View File
@@ -1,12 +1,12 @@
name: dwds
# Every time this changes you need to run `dart run tool/build.dart`.
version: 27.1.1-wip
version: 27.1.2-wip
description: >-
A service that proxies between the Chrome debug protocol and the Dart VM
service protocol.
environment:
sdk: ^3.12.0-0
sdk: ^3.12.0-307.0.dev
resolution: workspace
@@ -0,0 +1,22 @@
// Copyright (c) 2026, 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.
@Timeout(Duration(minutes: 5))
@TestOn('vm')
library;
import 'package:dwds/expression_compiler.dart';
import 'package:dwds_test_common/test_sdk_configuration.dart';
import 'package:test/test.dart';
import 'devtools_common.dart';
void main() {
final provider = TestSdkConfigurationProvider(
ddcModuleFormat: ModuleFormat.amd,
);
tearDownAll(provider.dispose);
testAll(provider: provider);
}
@@ -0,0 +1,222 @@
// Copyright (c) 2019, 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:io';
import 'package:dwds/src/config/tool_configuration.dart';
import 'package:dwds_test_common/test_sdk_configuration.dart';
import 'package:test/test.dart';
import 'package:vm_service/vm_service.dart';
// ignore: deprecated_member_use
import 'package:webdriver/io.dart';
import 'fixtures/context.dart';
import 'fixtures/project.dart';
import 'fixtures/utilities.dart';
Future<void> _waitForPageReady(TestContext context) async {
var attempt = 100;
while (attempt-- > 0) {
final content = await context.webDriver.pageSource;
if (content.contains('hello_world')) return;
await Future<void>.delayed(const Duration(milliseconds: 100));
}
throw StateError('Page never initialized');
}
TypeMatcher<Event> _hasKind(String kind) =>
isA<Event>().having((Event e) => e.kind, 'kind', kind);
void testAll({required TestSdkConfigurationProvider provider}) {
final context = TestContext(TestProject.test, provider);
for (final serveFromDds in [true, false]) {
group('Injected client with DevTools served from '
'${serveFromDds ? 'DDS' : 'DevTools Launcher'}', () {
setUp(() async {
await context.setUp(
debugSettings: TestDebugSettings.withDevToolsLaunch(
context,
serveFromDds: serveFromDds,
),
testSettings: TestSettings(
moduleFormat: provider.ddcModuleFormat,
canaryFeatures: provider.canaryFeatures,
),
);
await context.webDriver.driver.keyboard.sendChord([Keyboard.alt, 'd']);
// Wait for DevTools to actually open.
await Future<void>.delayed(const Duration(seconds: 2));
});
tearDown(() async {
await context.tearDown();
});
test('can launch devtools', () async {
final windows = await context.webDriver.windows.toList();
await context.webDriver.driver.switchTo.window(windows.last);
expect(await context.webDriver.pageSource, contains('DevTools'));
expect(await context.webDriver.currentUrl, contains('ide=Dwds'));
// TODO(https://github.com/dart-lang/webdev/issues/1888): Re-enable.
}, skip: Platform.isWindows);
test(
'can not launch devtools for the same app in multiple tabs',
() async {
final appUrl = await context.webDriver.currentUrl;
// Open a new tab, select it, and navigate to the app
await context.webDriver.driver.execute(
"window.open('$appUrl', '_blank');",
[],
);
await Future<void>.delayed(const Duration(seconds: 2));
final newAppWindow = await context.webDriver.windows.last;
await newAppWindow.setAsActive();
// Wait for the page to be ready before trying to open DevTools
// again.
await _waitForPageReady(context);
// Try to open devtools and check for the alert.
await context.webDriver.driver.keyboard.sendChord([
Keyboard.alt,
'd',
]);
await Future<void>.delayed(const Duration(seconds: 2));
final alert = context.webDriver.driver.switchTo.alert;
expect(alert, isNotNull);
expect(
await alert.text,
contains('This app is already being debugged in a different tab'),
);
await alert.accept();
var windows = await context.webDriver.windows.toList();
for (final window in windows) {
if (window.id != newAppWindow.id) {
await window.setAsActive();
await window.close();
}
}
await newAppWindow.setAsActive();
await context.webDriver.driver.keyboard.sendChord([
Keyboard.alt,
'd',
]);
await Future<void>.delayed(const Duration(seconds: 2));
windows = await context.webDriver.windows.toList();
final devToolsWindow = windows.firstWhere(
(Window window) => window != newAppWindow,
);
await devToolsWindow.setAsActive();
expect(await context.webDriver.pageSource, contains('DevTools'));
},
skip: 'See https://github.com/dart-lang/webdev/issues/2462',
);
test(
'destroys and recreates the isolate during a page refresh',
() async {
final client = context.debugConnection.vmService;
await client.streamListen('Isolate');
await context.makeEdits([
(
file: context.project.dartEntryFileName,
originalString: 'Hello World!',
newString: 'Bonjour le monde!',
),
]);
await context.waitForSuccessfulBuild(propagateToBrowser: true);
final eventsDone = expectLater(
client.onIsolateEvent,
emitsThrough(
emitsInOrder([
_hasKind(EventKind.kIsolateExit),
_hasKind(EventKind.kIsolateStart),
_hasKind(EventKind.kIsolateRunnable),
]),
),
);
await context.webDriver.driver.refresh();
await eventsDone;
},
skip: 'https://github.com/dart-lang/webdev/issues/1888',
);
}, timeout: const Timeout.factor(2));
}
group('Injected client without a DevTools server', () {
setUp(() async {
await context.setUp(
debugSettings: const TestDebugSettings.noDevToolsLaunch().copyWith(
enableDevToolsLaunch: true,
ddsConfiguration: const DartDevelopmentServiceConfiguration(
serveDevTools: false,
),
),
testSettings: TestSettings(
moduleFormat: provider.ddcModuleFormat,
canaryFeatures: provider.canaryFeatures,
),
);
});
tearDown(() async {
await context.tearDown();
});
test('gives a good error if devtools is not served', () async {
// Try to open devtools and check for the alert.
await context.webDriver.driver.keyboard.sendChord([Keyboard.alt, 'd']);
await Future<void>.delayed(const Duration(seconds: 2));
final alert = context.webDriver.driver.switchTo.alert;
expect(alert, isNotNull);
expect(await alert.text, contains('--debug'));
await alert.accept();
});
});
group(
'Injected client with debug extension and without DevTools',
() {
setUp(() async {
await context.setUp(
debugSettings: const TestDebugSettings.noDevToolsLaunch().copyWith(
enableDebugExtension: true,
),
testSettings: TestSettings(
moduleFormat: provider.ddcModuleFormat,
canaryFeatures: provider.canaryFeatures,
),
);
});
tearDown(() async {
await context.tearDown();
});
test('gives a good error if devtools is not served', () async {
// Click on extension
await context.extensionConnection.sendCommand('Runtime.evaluate', {
'expression': 'fakeClick()',
});
// Try to open devtools and check for the alert.
await context.webDriver.driver.keyboard.sendChord([Keyboard.alt, 'd']);
await Future<void>.delayed(const Duration(seconds: 2));
final alert = context.webDriver.driver.switchTo.alert;
expect(alert, isNotNull);
expect(await alert.text, contains('--debug'));
await alert.accept();
});
},
tags: ['extension'],
skip: 'https://github.com/dart-lang/webdev/issues/2114',
timeout: const Timeout.factor(2),
);
}
@@ -0,0 +1,23 @@
// Copyright (c) 2026, 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.
@Timeout(Duration(minutes: 5))
@TestOn('vm')
library;
import 'package:dwds/expression_compiler.dart';
import 'package:dwds_test_common/test_sdk_configuration.dart';
import 'package:test/test.dart';
import 'devtools_common.dart';
void main() {
final provider = TestSdkConfigurationProvider(
ddcModuleFormat: ModuleFormat.ddc,
canaryFeatures: true,
);
tearDownAll(provider.dispose);
testAll(provider: provider);
}
@@ -5,13 +5,16 @@
@Timeout(Duration(minutes: 2))
library;
import 'package:dwds/expression_compiler.dart';
import 'package:dwds_test_common/test_sdk_configuration.dart';
import 'package:test/test.dart';
import 'asset_handler_common.dart';
void main() {
final provider = TestSdkConfigurationProvider();
final provider = TestSdkConfigurationProvider(
ddcModuleFormat: ModuleFormat.amd,
);
tearDownAll(provider.dispose);
testAll(provider: provider);
@@ -0,0 +1,21 @@
// Copyright (c) 2026, 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.
@Timeout(Duration(minutes: 2))
library;
import 'package:dwds/expression_compiler.dart';
import 'package:dwds_test_common/test_sdk_configuration.dart';
import 'package:test/test.dart';
import 'proxy_server_asset_reader_common.dart';
void main() {
final provider = TestSdkConfigurationProvider(
ddcModuleFormat: ModuleFormat.amd,
);
tearDownAll(provider.dispose);
testAll(provider: provider);
}
@@ -0,0 +1,58 @@
// Copyright (c) 2020, 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 'package:dwds/src/readers/proxy_server_asset_reader.dart';
import 'package:dwds_test_common/test_sdk_configuration.dart';
import 'package:test/test.dart';
import '../fixtures/context.dart';
import '../fixtures/project.dart';
import '../fixtures/utilities.dart';
void testAll({required TestSdkConfigurationProvider provider}) {
group('ProxyServerAssetReader', () {
final context = TestContext(TestProject.test, provider);
late ProxyServerAssetReader assetReader;
setUpAll(() async {
await context.setUp(
testSettings: TestSettings(
moduleFormat: provider.ddcModuleFormat,
canaryFeatures: provider.canaryFeatures,
),
);
assetReader = context.testServer.assetReader as ProxyServerAssetReader;
});
tearDownAll(() async {
await context.tearDown();
});
test('returns null if the dart path does not exist', () async {
final result = await assetReader.dartSourceContents('some/path/foo.dart');
expect(result, isNull);
});
test('can read dart sources', () async {
final result = await assetReader.dartSourceContents(
'hello_world/main.dart',
);
expect(result, isNotNull);
});
test('can read source maps', () async {
final result = await assetReader.dartSourceContents(
'hello_world/main.ddc.js.map',
);
expect(result, isNotNull);
});
test('returns null if the source map path does not exist', () async {
final result = await assetReader.dartSourceContents(
'hello_world/foo.ddc.js.map',
);
expect(result, isNull);
});
});
}
@@ -0,0 +1,22 @@
// Copyright (c) 2026, 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.
@Timeout(Duration(minutes: 2))
library;
import 'package:dwds/expression_compiler.dart';
import 'package:dwds_test_common/test_sdk_configuration.dart';
import 'package:test/test.dart';
import 'proxy_server_asset_reader_common.dart';
void main() {
final provider = TestSdkConfigurationProvider(
ddcModuleFormat: ModuleFormat.ddc,
canaryFeatures: true,
);
tearDownAll(provider.dispose);
testAll(provider: provider);
}
@@ -0,0 +1,25 @@
// Copyright (c) 2026, 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.
@Timeout(Duration(minutes: 2))
library;
import 'package:dwds/expression_compiler.dart';
import 'package:dwds_test_common/test_sdk_configuration.dart';
import 'package:test/test.dart';
import 'run_request_common.dart';
void main() {
// Enable verbose logging for debugging.
const debug = false;
final provider = TestSdkConfigurationProvider(
verbose: debug,
ddcModuleFormat: ModuleFormat.amd,
);
tearDownAll(provider.dispose);
testAll(provider: provider);
}
@@ -0,0 +1,93 @@
// Copyright (c) 2019, 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:async';
import 'package:dwds_test_common/logging.dart';
import 'package:dwds_test_common/test_sdk_configuration.dart';
import 'package:test/test.dart';
import 'package:vm_service/vm_service.dart';
import 'package:vm_service_interface/vm_service_interface.dart';
import 'fixtures/context.dart';
import 'fixtures/project.dart';
import 'fixtures/utilities.dart';
void testAll({required TestSdkConfigurationProvider provider}) {
final context = TestContext(TestProject.test, provider);
group('while debugger is attached', () {
late VmServiceInterface service;
setUp(() async {
setCurrentLogWriter(debug: provider.verbose);
await context.setUp(
testSettings: TestSettings(
autoRun: false,
verboseCompiler: provider.verbose,
moduleFormat: provider.ddcModuleFormat,
canaryFeatures: provider.canaryFeatures,
),
);
service = context.service;
});
tearDown(() async {
await context.tearDown();
});
test('can resume while paused at the start', () async {
final vm = await service.getVM();
final isolate = await service.getIsolate(vm.isolates!.first.id!);
expect(isolate.pauseEvent!.kind, EventKind.kPauseStart);
final stream = service.onEvent('Debug');
final resumeCompleter = Completer<void>();
// The underlying stream is a broadcast stream so we need to add a
// listener before calling resume so that we don't miss events.
unawaited(
stream.firstWhere((event) => event.kind == EventKind.kResume).then((_) {
resumeCompleter.complete();
}),
);
await service.resume(isolate.id!);
await resumeCompleter.future;
expect(isolate.pauseEvent!.kind, EventKind.kResume);
});
test('correctly sets the isolate pauseEvent', () async {
final vm = await service.getVM();
final isolate = await service.getIsolate(vm.isolates!.first.id!);
expect(isolate.pauseEvent!.kind, EventKind.kPauseStart);
final stream = service.onEvent('Debug');
context.appConnection.runMain();
await stream.firstWhere((event) => event.kind == EventKind.kResume);
expect(isolate.pauseEvent!.kind, EventKind.kResume);
});
}, timeout: const Timeout.factor(2));
group('while debugger is not attached', () {
setUp(() async {
setCurrentLogWriter(debug: provider.verbose);
await context.setUp(
testSettings: TestSettings(
autoRun: false,
waitToDebug: true,
moduleFormat: provider.ddcModuleFormat,
canaryFeatures: provider.canaryFeatures,
),
);
});
tearDown(() async {
await context.tearDown();
});
test('correctly sets the isolate pauseEvent if already running', () async {
context.appConnection.runMain();
await context.startDebugging();
final service = context.vmService;
final vm = await service.getVM();
final isolate = await service.getIsolate(vm.isolates!.first.id!);
expect(isolate.pauseEvent!.kind, EventKind.kResume);
});
});
}
@@ -0,0 +1,26 @@
// Copyright (c) 2026, 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.
@Timeout(Duration(minutes: 2))
library;
import 'package:dwds/expression_compiler.dart';
import 'package:dwds_test_common/test_sdk_configuration.dart';
import 'package:test/test.dart';
import 'run_request_common.dart';
void main() {
// Enable verbose logging for debugging.
const debug = false;
final provider = TestSdkConfigurationProvider(
verbose: debug,
ddcModuleFormat: ModuleFormat.ddc,
canaryFeatures: true,
);
tearDownAll(provider.dispose);
testAll(provider: provider);
}
@@ -5,13 +5,16 @@
@Timeout(Duration(minutes: 2))
library;
import 'package:dwds/expression_compiler.dart';
import 'package:dwds_test_common/test_sdk_configuration.dart';
import 'package:test/test.dart';
import 'screenshot_common.dart';
void main() {
final provider = TestSdkConfigurationProvider();
final provider = TestSdkConfigurationProvider(
ddcModuleFormat: ModuleFormat.amd,
);
tearDownAll(provider.dispose);
testAll(provider: provider);
@@ -22,7 +22,10 @@ void main() {
});
test('Creates and deletes SDK directory copy', () async {
final provider = TestSdkConfigurationProvider(verbose: debug);
final provider = TestSdkConfigurationProvider(
verbose: debug,
ddcModuleFormat: ModuleFormat.amd,
);
final sdkDirectory = provider.sdkLayout.sdkDirectory;
final sdkSummary = provider.sdkLayout.summaryPath;
try {
@@ -91,7 +94,10 @@ void main() {
group('Test SDK configuration | DDC with AMD modules |', () {
setCurrentLogWriter(debug: debug);
final provider = TestSdkConfigurationProvider(verbose: debug);
final provider = TestSdkConfigurationProvider(
verbose: debug,
ddcModuleFormat: ModuleFormat.amd,
);
tearDownAll(provider.dispose);
test('Can validate configuration with generated assets', () async {