Skip to content

Commit

Permalink
Resolve merge conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
elliette committed Sep 27, 2023
2 parents 3241f33 + 7739a11 commit 5c1d246
Show file tree
Hide file tree
Showing 29 changed files with 293 additions and 205 deletions.
5 changes: 3 additions & 2 deletions dwds/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
## 22.0.0-wip

- Update the interface for ChromeProxyService.getSourceReport to match the VM service. - [#2235](https://github.com/dart-lang/webdev/pull/2235)

**Breaking changes**

- Refactor the parameters to `Dwds.start`. - [#2231](https://github.com/dart-lang/webdev/pull/2231).

- Update the interface for ChromeProxyService.getSourceReport to match the VM service. - [#2235](https://github.com/dart-lang/webdev/pull/2235)
- Add a new parameter `workspaceName` to the `ToolConfiguration` passed to `Dwds.start`. - [#2237](https://github.com/dart-lang/webdev/pull/2237)

## 21.0.0

Expand Down
2 changes: 1 addition & 1 deletion dwds/debug_extension_mv3/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: mv3_extension
publish_to: none
version: 1.35.0
version: 1.36.0
homepage: https://github.com/dart-lang/webdev
description: >-
A Chrome extension for Dart debugging.
Expand Down
2 changes: 1 addition & 1 deletion dwds/debug_extension_mv3/web/debug_session.dart
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ void _routeDwdsEvent(String eventData, SocketClient client, int tabId) {
_openDevTools(message.params, dartAppTabId: tabId);
}
}
if (message.method == 'dwds.plainUri') {
if (message.method == 'dwds.debugUri') {
sendMessageToCider(
messageType: CiderMessageType.startDebugResponse,
messageBody: message.params,
Expand Down
2 changes: 1 addition & 1 deletion dwds/debug_extension_mv3/web/manifest_mv2.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Dart Debug Extension",
"version": "1.35",
"version": "1.36",
"manifest_version": 2,
"devtools_page": "static_assets/devtools.html",
"browser_action": {
Expand Down
2 changes: 1 addition & 1 deletion dwds/debug_extension_mv3/web/manifest_mv3.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Dart Debug Extension",
"version": "1.35",
"version": "1.36",
"manifest_version": 3,
"devtools_page": "static_assets/devtools.html",
"action": {
Expand Down
1 change: 1 addition & 0 deletions dwds/debug_extension_mv3/web/utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ String addQueryParameters(
}) {
final originalUri = Uri.parse(uri);
final newUri = originalUri.replace(
path: '', // Replace the /debugger path so that the inspector url works.
queryParameters: {
...originalUri.queryParameters,
...queryParameters,
Expand Down
2 changes: 2 additions & 0 deletions dwds/lib/src/config/tool_configuration.dart
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,13 @@ ToolConfiguration get globalToolConfiguration => _globalToolConfiguration;
class AppMetadata {
final String hostname;
final bool isInternalBuild;
final String? workspaceName;
Future<bool> Function() isFlutterApp;

AppMetadata({
this.hostname = 'localhost',
this.isInternalBuild = false,
this.workspaceName,
Future<bool> Function()? isFlutterApp,
}) : isFlutterApp = isFlutterApp ?? (() => Future.value(true));
}
Expand Down
1 change: 1 addition & 0 deletions dwds/lib/src/handlers/dev_handler.dart
Original file line number Diff line number Diff line change
Expand Up @@ -598,6 +598,7 @@ class DevHandler {
appServices = await _createAppDebugServices(
debugService,
);
extensionDebugger.sendEvent('dwds.debugUri', debugService.uri);
final encodedUri = await debugService.encodedUri;
extensionDebugger.sendEvent('dwds.encodedUri', encodedUri);
safeUnawaited(
Expand Down
4 changes: 4 additions & 0 deletions dwds/lib/src/handlers/injector.dart
Original file line number Diff line number Diff line change
Expand Up @@ -200,5 +200,9 @@ Future<String> _injectedClientSnippet(
if (extensionUri != null) {
injectedBody += 'window.\$dartExtensionUri = "$extensionUri";\n';
}
final workspaceName = globalToolConfiguration.appMetadata.workspaceName;
if (workspaceName != null) {
injectedBody += 'window.\$dartWorkspaceName = "$workspaceName";\n';
}
return injectedBody;
}
2 changes: 2 additions & 0 deletions dwds/lib/src/injected/client.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions dwds/test/dart_uri_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class G3TestStrategy extends FakeStrategy {
void main() {
group('DartUri', () {
setUpAll(() {
final toolConfiguration = createToolConfiguration(
final toolConfiguration = TestToolConfiguration.forTests(
loadStrategy: TestStrategy(
FakeAssetReader(),
),
Expand Down Expand Up @@ -209,7 +209,7 @@ void main() {

group('initialized to handle g3-relative paths', () {
setUpAll(() async {
final toolConfiguration = createToolConfiguration(
final toolConfiguration = TestToolConfiguration.forTests(
loadStrategy: G3TestStrategy(FakeAssetReader()),
appMetadata: AppMetadata(isInternalBuild: true),
);
Expand Down
36 changes: 23 additions & 13 deletions dwds/test/debug_extension_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
'linux': Skip('https://github.com/dart-lang/webdev/issues/2114'),
})

import 'package:dwds/config.dart';
import 'package:dwds/src/connections/debug_connection.dart';
import 'package:dwds/src/handlers/injector.dart';
import 'package:http/http.dart' as http;
Expand Down Expand Up @@ -61,9 +62,10 @@ void main() async {
group('Without encoding', () {
setUp(() async {
await context.setUp(
enableDebugExtension: true,
serveDevTools: true,
useSse: useSse,
debugSettings: TestDebugSettings.withDevTools(context).copyWith(
enableDebugExtension: true,
useSse: useSse,
),
);
await context.extensionConnection.sendCommand('Runtime.evaluate', {
'expression': 'fakeClick()',
Expand Down Expand Up @@ -124,9 +126,10 @@ void main() async {
group('With a sharded Dart app', () {
setUp(() async {
await context.setUp(
enableDebugExtension: true,
serveDevTools: true,
useSse: useSse,
debugSettings: TestDebugSettings.withDevTools(context).copyWith(
enableDebugExtension: true,
useSse: useSse,
),
);
final htmlTag =
await context.webDriver.findElement(const By.tagName('html'));
Expand Down Expand Up @@ -158,9 +161,10 @@ void main() async {
group('With an internal Dart app', () {
setUp(() async {
await context.setUp(
enableDebugExtension: true,
serveDevTools: true,
useSse: false,
debugSettings: TestDebugSettings.withDevTools(context).copyWith(
enableDebugExtension: true,
useSse: false,
),
);
final htmlTag =
await context.webDriver.findElement(const By.tagName('html'));
Expand Down Expand Up @@ -227,9 +231,11 @@ void main() async {
group('With encoding', () {
setUp(() async {
await context.setUp(
enableDebugExtension: true,
urlEncoder: (url) async =>
url.endsWith(r'/$debug') ? 'http://some-encoded-url:8081/' : url,
debugSettings: TestDebugSettings.noDevTools().copyWith(
enableDebugExtension: true,
urlEncoder: (url) async =>
url.endsWith(r'/$debug') ? 'http://some-encoded-url:8081/' : url,
),
);
});

Expand All @@ -252,7 +258,11 @@ void main() async {
final uriPattern = RegExp(r'dartExtensionUri = "([^"]+)";');

setUp(() async {
await context.setUp(enableDebugExtension: true, hostname: 'any');
await context.setUp(
debugSettings:
TestDebugSettings.noDevTools().copyWith(enableDebugExtension: true),
appMetadata: AppMetadata(hostname: 'any'),
);
});

tearDown(() async {
Expand Down
7 changes: 6 additions & 1 deletion dwds/test/debug_service_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import 'package:test_common/test_sdk_configuration.dart';

import 'fixtures/context.dart';
import 'fixtures/project.dart';
import 'fixtures/utilities.dart';

void main() {
final provider = TestSdkConfigurationProvider();
Expand All @@ -22,7 +23,11 @@ void main() {

setUpAll(() async {
// Disable DDS as we're testing DWDS behavior.
await context.setUp(spawnDds: false);
await context.setUp(
debugSettings: TestDebugSettings.noDevTools().copyWith(
spawnDds: false,
),
);
});

tearDownAll(() async {
Expand Down
2 changes: 1 addition & 1 deletion dwds/test/debugger_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ void main() async {
webkitDebugger = FakeWebkitDebugger(scripts: scripts);
pausedController = StreamController<DebuggerPausedEvent>();
webkitDebugger.onPaused = pausedController.stream;
final toolConfiguration = createToolConfiguration(
final toolConfiguration = TestToolConfiguration.forTests(
loadStrategy: TestStrategy(FakeAssetReader()),
);
setGlobalsForTesting(
Expand Down
16 changes: 12 additions & 4 deletions dwds/test/devtools_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ 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;
Expand All @@ -34,7 +35,7 @@ void main() {
group('Injected client', () {
setUp(() async {
await context.setUp(
serveDevTools: true,
debugSettings: TestDebugSettings.withDevTools(context),
);
await context.webDriver.driver.keyboard.sendChord([Keyboard.alt, 'd']);
// Wait for DevTools to actually open.
Expand Down Expand Up @@ -136,9 +137,13 @@ void main() {
);
});

group('Injected client without DevTools', () {
group('Injected client without a DevTools server', () {
setUp(() async {
await context.setUp(serveDevTools: false);
await context.setUp(
debugSettings: TestDebugSettings.noDevTools().copyWith(
enableDevToolsLaunch: true,
),
);
});

tearDown(() async {
Expand All @@ -160,7 +165,10 @@ void main() {
'Injected client with debug extension and without DevTools',
() {
setUp(() async {
await context.setUp(enableDebugExtension: true, serveDevTools: false);
await context.setUp(
debugSettings: TestDebugSettings.noDevTools()
.copyWith(enableDebugExtension: true),
);
});

tearDown(() async {
Expand Down
3 changes: 2 additions & 1 deletion dwds/test/events_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import 'package:webdriver/async_core.dart';

import 'fixtures/context.dart';
import 'fixtures/project.dart';
import 'fixtures/utilities.dart';

void main() {
final provider = TestSdkConfigurationProvider();
Expand Down Expand Up @@ -131,7 +132,7 @@ void main() {
),
);
await context.setUp(
serveDevTools: true,
debugSettings: TestDebugSettings.withDevTools(context),
enableExpressionEvaluation: true,
);
vmService = context.debugConnection.vmService;
Expand Down
2 changes: 1 addition & 1 deletion dwds/test/expression_evaluator_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ void main() async {
late StreamController<Event> debugEventController;
setUp(() async {
final assetReader = FakeAssetReader(sourceMap: '');
final toolConfiguration = createToolConfiguration(
final toolConfiguration = TestToolConfiguration.forTests(
loadStrategy: FakeStrategy(assetReader),
);
setGlobalsForTesting(
Expand Down
Loading

0 comments on commit 5c1d246

Please sign in to comment.