29 Commits

Author SHA1 Message Date
Ben Konyi ad5133b373 [DDS] Fix server_connection_vm_service_test timeouts
In `server_connection_common.dart`, the `server removes clients that
disconnect from the API` test spawned its own Chrome instance using
`package:devtools_shared`'s `Chrome` class without isolated profiles or
essential headless flags.

This caused the test to hang or fail flakily in container environments
(like LUCI bots) and local environments: 1. Without
`--use-mock-keychain`, headless Chrome on macOS blocks on system
credential dialogs. 2. Without `--no-sandbox`, Chrome renderer processes
can crash in restricted container environments. 3. Without
`--user-data-dir`, Chrome uses the default system profile, which can
cause it to attach to an existing open Chrome instance instead of
starting a new one, meaning the process exits immediately and the test
cannot terminate it.

Fixed by directly using `package:browser_launcher`'s `Chrome` class in
the test and passing:
* `--user-data-dir` pointing to a unique temporary directory.
* `--no-first-run` and `--no-default-browser-check` to bypass welcome prompts.
* `--no-sandbox` and `--use-mock-keychain` where appropriate.

Also wrapped the test in `try-finally` to guarantee cleanup of the
temporary profile directory.

Change-Id: I6fbe5a280524b57c635ab11ef54fa07dba2794cf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/507600
Reviewed-by: Alexander Aprelev <aam@google.com>
Auto-Submit: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2026-05-29 13:48:45 -07:00
Ben Konyi 0aa709e8cc [dds] Update expected DevTools title in path strategy test
DevTools recently updated their index.html to include "The Flutter Authors" in the copyright header instead of "Dart DevTools" in the body. This updates the test expectation to match.

Fixes https://github.com/dart-lang/sdk/issues/63375

TEST=pkg/dds/test/devtools_server/devtools_server_path_strategy_test.dart

Fixed: 63375
Change-Id: I83b8fc4101501ffbbf1e3a84ca797c7b18c0d9b7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/503820
Auto-Submit: Ben Konyi <bkonyi@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2026-05-15 10:32:53 -07:00
Kenzie Davisson a0e0688b21 Update DevTools rev to 23a1bf0ff30bc83b1dc16045d6d9b15da9b4bc9c
Change-Id: Ib46dfa0b30de394665ad6b0fb4f55cc5b0f93add
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/499801
Reviewed-by: Ben Konyi <bkonyi@google.com>
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Commit-Queue: Kenzie Davisson <kenzieschmoll@google.com>
2026-05-05 17:30:59 -07:00
Lasse R.H. Nielsen 56505e0575 Stop using Match.group.
The `Match.operator[]` does the same thing and is
generally recommended (and shorter).
(I want to deprecate `group` and `groups`)

Tested: Refactoring.
CoreLibraryReviewExempt: Calling equivalent function.
Change-Id: I4c758968ae622fe16b7322be1b29b05b91e7fcd9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/489021
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Lasse Nielsen <lrn@google.com>
2026-03-20 09:09:46 -07:00
Ben Konyi a3f0e40c2f [ DevTools Server ] Add logging to server_connection_api_test
Will hopefully help resolve https://github.com/dart-lang/sdk/issues/52584

Change-Id: I9142c73cc24be070de6751e6f94f52e2605324fa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/454101
Auto-Submit: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Jessy Yameogo <yjessy@google.com>
2025-10-08 09:49:50 -07:00
asiva ab44b20ab8 Reapply "[VM/dartdev] Switch dartdev to use an AOT runtime." and
Add the fixes that were done after original CL landed.

This reverts commit 97bc401163.

TEST=ci

Change-Id: I26373aecc325e4c0c379c92e779aa301e3a58c5a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/441700
Reviewed-by: Brian Quinlan <bquinlan@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
2025-07-24 14:48:03 -07:00
asiva 97bc401163 Revert "[VM/dartdev] Switch dartdev to use an AOT runtime."
This reverts commit 5399dbf6f6.

Reason for revert : Flutter rolls are failing

TEST=ci

Change-Id: I76fede849705514496adbc2ab7f6c262de4103ca
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/439661
Reviewed-by: Jason Simmons <jsimmons@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
2025-07-09 23:08:28 -07:00
asiva 5399dbf6f6 [VM/dartdev] Switch dartdev to use an AOT runtime.
- split the Dart CLI tool out of the VM into it's own embedder which
  runs in AOT mode. The pure Dart VM executable is called 'dartvm' and
  has no Dart CLI functionality in it
- the Dart CLI executable parses the CLI commands and invokes the rest
  of the AOT tools in the same process, for the 'run' and 'test'
  commands it execs a process which runs 'dartvm' to run
- 'dart hello.dart' execs the 'dartvm' process and runs 'hello.dart'
- the Dart CLI is not generated for ia32 as we are not shipping a
  Dart SDK for ia32 anymore (support to execute the 'dartvm' for ia32
  architecture is retained)
- the Dart CLI tool is not built in the internal Dart SDK builds

TEST=ci

Some performance improvement numbers
'dart format pkg/dartdev' goes from 1.17 secs to 0.22 secs
'dart doc pkg/dartdev' goes from 100.2 secs to 66.6 secs
'dart fix pkg/dartdev' goes from 19.3 secs to 14.5 secs

Change-Id: I66984a26cb2ab014b34dc1873f1f3d2884e13518
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/364202
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2025-07-04 13:22:13 -07:00
Jake Macdonald bf9acedc73 Adds a new helper resolveTestRelativePath for resolving paths relative to the test dir, which works using the package config instead of Platform.script. This allows it to work via dart test as well as the test runner, or when manually invoked.
Replaced usages of Platform.script.resolve with this utility.

Change-Id: I904d281934c3eb42516e891f27a8f3dbe714e7f6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/432740
Auto-Submit: Jake Macdonald <jakemac@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2025-06-05 07:23:15 -07:00
Danny Tuppeny acf43c7587 [dds] Build DevTools URL using querystring, not fragment
DevTools now uses page URLs so we don't need to put the querystring as a fragment. The original code did work, but it complicates things for other code (such as code injecting `?wasm=true`) so should be updated.

Fixes https://github.com/Dart-Code/Dart-Code/issues/5365

Change-Id: I80ff4d78a3df1f77740a9b8f61ef5499bd008eda
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/399681
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Kenzie Davisson <kenzieschmoll@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2024-12-19 12:54:42 -08:00
Danny Tuppeny 560adc7dc6 [dds/devtools] Switch to always using a relative base href in DevTools pages
This avoids the server needing to know the exact URL path being used on the client, so proxies that rewrite the path (such as code-server) can still work.

See https://github.com/flutter/devtools/issues/8067#issuecomment-2236419703

Change-Id: I5b131d84232c63f5495ccbb533da727cce514de5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/376682
Reviewed-by: Kenzie Davisson <kenzieschmoll@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2024-09-26 15:19:54 +00:00
Danny Tuppeny f50975e3b5 [dds] Bump DDS to 5.0.0, use devtools_shared 11.0.0, and support a second DTD URI for web editors
devtools_shared 11.0.0 updates some signatures to use a new DTDInfo class to support both a local + exposed URI for DTD. A new CLI flag `--dtd-exposed-uri` for `devtools server` allows passing this second URI.

The DevTools server will use `--dtd-uri` to connect to DTD itself, but serve `--dtd-exposed-uri` to the frontend.

`--dtd-exposed-uri` is entirely optional and if not supplied, the value from `--dtd-uri` will be used in its place.

Change-Id: I5ab052ff9c4e7b2b186c1592f1ba2d63b7711113
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/383400
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Kenzie Davisson <kenzieschmoll@google.com>
Reviewed-by: Kenzie Davisson <kenzieschmoll@google.com>
2024-09-11 17:05:09 +00:00
Kenzie Schmoll 408918d6f5 [dds] Start DTD from DevTools server if it is not already started.
Fixes https://github.com/dart-lang/sdk/issues/54937.

Tested: pkg/dartdev test for `dart devtools` command, and new `dtd_test.dart` in pkg/dds.
Change-Id: I530ba2fe4d5809082378b61c282ba7856974e21e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/354460
Commit-Queue: Kenzie Davisson <kenzieschmoll@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
Reviewed-by: Dan Chevalier <danchevalier@google.com>
2024-03-18 21:50:09 +00:00
Danny Tuppeny 5fde2e1534 [dds/devtools_server] Add support for finding VS Code extensions defined in packages
See https://github.com/Dart-Code/Dart-Code/issues/4705

Change-Id: I724c039cd6940dd5939330a6f91f38567db9a179
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/337781
Reviewed-by: Kenzie Davisson <kenzieschmoll@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Kenzie Davisson <kenzieschmoll@google.com>
2023-12-06 20:56:11 +00:00
Danny Tuppeny c74ea634cb [dds/devtools] Prevent DevTools server reusing clients that aren't fully initialized
It's only valid to reuse a client that is not showing an embedded page, however we only get the embedded flag when a client sends a "currentPage" event.

There is a period between a client connecting and sending this event where we would consider it reusable when it's not. This fixes that by keeping a flag to indicate if a client has completed initializing (that is, it has sent its initial page).

See https://github.com/Dart-Code/Dart-Code/issues/4832

Change-Id: I9f2d43d1537ee97e4e231a844831e7548cf07beb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/336041
Reviewed-by: Ben Konyi <bkonyi@google.com>
Reviewed-by: Kenzie Davisson <kenzieschmoll@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2023-11-14 20:47:43 +00:00
Sam Rawlins e6ac464ff0 Avoid passing a nullable value to Completer<nn-type>.completer.
This is cleanup work required to start enforcing this with static analysis, as
per https://github.com/dart-lang/sdk/issues/53253.

Real quick this issue is that this code is unsafe:

```dart
void f(Completer<int> c, int? i) {
  Future<int>.value(i); // Ouch!
  c.complete(i);        // Ouch!
}
```

Change-Id: Ia4d83719c425601b24e8ae6e305c88c95cba8b20
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/324640
Auto-Submit: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Liam Appelbe <liama@google.com>
Reviewed-by: Liam Appelbe <liama@google.com>
2023-09-07 21:48:26 +00:00
Devon Carew 2d15cad9e5 [pkg/dds] use package:lints/recommended.yaml
Change-Id: I05eb1af5dd985ee9f752b8ea409cabc785740472
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/283964
Commit-Queue: Devon Carew <devoncarew@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2023-02-21 18:30:23 +00:00
Ben Konyi ab5b7d7ad1 [ DDS / VM Service ] Simplify DevTools URI construction
DevTools no longer expects a fragment (i.e., '#') in its path, which was
causing issues when attempting to redirect to an external DevTools
instance.

Also removes unnecessary query parameter encoding.

TEST=Existing tests

Change-Id: Ifbeba62c173141a754951527f44ab337318a21d0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/278669
Reviewed-by: Kenzie Davisson <kenzieschmoll@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2023-01-11 21:22:50 +00:00
Danny Tuppeny 70e8dc6ee4 [devtools] Ping browsers running DevTools before trying to reuse them
It's possible the browser has been closed but is in the SSE timeout period and therefore looks active. Ping it to see if it's actually responsive before deciding whether to reuse it or launch a new window.

Fixes https://github.com/Dart-Code/Dart-Code/issues/3966.

Change-Id: I2fdcba036b8b63f7ab974e8fef5dd565c2917b64
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/257581
Reviewed-by: Kenzie Davisson <kenzieschmoll@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2022-09-07 17:38:57 +00:00
Danny Tuppeny f6e025ed27 [dds] Unskip tests for checking devtools base href tags
Change-Id: Ic31344a65b04cb252aa661b2f9af411b5a148bd2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/243903
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2022-05-09 13:28:23 +00:00
Danny Tuppeny db0d9b1852 [dds] Serve DevTools index page for extension-less requests to support UrlPathStrategy
Change-Id: I780e16b391dda6159c99b4844f6663dad02a98af
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/239082
Reviewed-by: Ben Konyi <bkonyi@google.com>
Reviewed-by: Kenzie Davisson <kenzieschmoll@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2022-04-25 14:12:13 +00:00
Ben Konyi 1771c55238 [ DDS ] Split DevTools server tests into smaller pieces
Should resolve timeout issues, particularly around server connection
tests

Change-Id: Ic06d1179b09a17497e38de9aa19549f66ff79d2c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/240180
Reviewed-by: Kenzie Davisson <kenzieschmoll@google.com>
2022-04-04 22:07:21 +00:00
Ben Konyi d087f0334d [ DDS ] Fix devtools_server tests on Windows
Fixes https://github.com/dart-lang/sdk/issues/48528

Change-Id: Iaa08d6ee409354eadc37d3beb98ea79b75575758
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/239464
Reviewed-by: Kenzie Davisson <kenzieschmoll@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2022-03-30 20:45:20 +00:00
Ben Konyi 0950d887be [ package:dds ] Fix devtools_server_test flakiness
The test harness wasn't waiting on `CliAppFixture.onAppStarted` which
could cause an unhandled exception if the test cleanup started before
the target application finished initializing. This typically only
occurred while the test was running on a machine under load.

Fixes https://github.com/dart-lang/sdk/issues/48669

TEST=Locally while running under load (e.g., `stress -c 72`)

Change-Id: Ieb67e46f62c33101490899440574fb57fc0f8882
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/238922
Reviewed-by: Kenzie Davisson <kenzieschmoll@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2022-03-25 18:40:30 +00:00
Kenzie Schmoll 3f623c65b0 Split DevTools server tests up into two libraries
Change-Id: Ic394faee18547f3338fb36419defa45c6734d90c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/236301
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2022-03-14 17:51:28 +00:00
Kenzie Schmoll 167970dea7 Reland "Add DevTools Server test and test driver to DDS"
This reverts commit d0dff0e9ba.

Reason for revert: fixed broken tests to reland.

Original change's description:
> Revert "Add DevTools Server test and test driver to DDS"
>
> This reverts commit 02bff5bde2.
>
> Reason for revert: broken tests. (e.g. https://ci.chromium.org/ui/p/dart/builders/ci.sandbox/pkg-mac-release/20638/overview)
>
> Original change's description:
> > Add DevTools Server test and test driver to DDS
> >
> > Bug: https://github.com/dart-lang/sdk/issues/48300
> > Change-Id: I3b72274d111489448a482d65eb7cc23a9f263edf
> > Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/233320
> > Reviewed-by: Ben Konyi <bkonyi@google.com>
> > Commit-Queue: Kenzie Davisson <kenzieschmoll@google.com>
>
> TBR=bkonyi@google.com,kenzieschmoll@google.com
>
> Change-Id: Iaca6b34a4e55ddd7b984b49821f3cc95337d696a
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: https://github.com/dart-lang/sdk/issues/48300
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/234114
> Reviewed-by: Kenzie Davisson <kenzieschmoll@google.com>
> Commit-Queue: Kenzie Davisson <kenzieschmoll@google.com>

# Not skipping CQ checks because original CL landed > 1 day ago.

Bug: https://github.com/dart-lang/sdk/issues/48300
Change-Id: I60ffd0e8a394353014408530d636c5918e517a59
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/234861
Reviewed-by: Ben Konyi <bkonyi@google.com>
Reviewed-by: Kenzie Davisson <kenzieschmoll@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Jake Macdonald <jakemac@google.com>
Commit-Queue: Kenzie Davisson <kenzieschmoll@google.com>
2022-03-09 16:48:54 +00:00
Kenzie Davisson d0dff0e9ba Revert "Add DevTools Server test and test driver to DDS"
This reverts commit 02bff5bde2.

Reason for revert: broken tests. (e.g. https://ci.chromium.org/ui/p/dart/builders/ci.sandbox/pkg-mac-release/20638/overview)

Original change's description:
> Add DevTools Server test and test driver to DDS
>
> Bug: https://github.com/dart-lang/sdk/issues/48300
> Change-Id: I3b72274d111489448a482d65eb7cc23a9f263edf
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/233320
> Reviewed-by: Ben Konyi <bkonyi@google.com>
> Commit-Queue: Kenzie Davisson <kenzieschmoll@google.com>

TBR=bkonyi@google.com,kenzieschmoll@google.com

Change-Id: Iaca6b34a4e55ddd7b984b49821f3cc95337d696a
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: https://github.com/dart-lang/sdk/issues/48300
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/234114
Reviewed-by: Kenzie Davisson <kenzieschmoll@google.com>
Commit-Queue: Kenzie Davisson <kenzieschmoll@google.com>
2022-02-23 23:46:44 +00:00
Kenzie Schmoll 02bff5bde2 Add DevTools Server test and test driver to DDS
Bug: https://github.com/dart-lang/sdk/issues/48300
Change-Id: I3b72274d111489448a482d65eb7cc23a9f263edf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/233320
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Kenzie Davisson <kenzieschmoll@google.com>
2022-02-23 21:09:04 +00:00
Ben Konyi 3b736b8460 [ package:dds ] Migrate package:devtools_server functionality under package:dds/devtools_server.dart
Will allow for us to remove dependencies on package:devtools_server in
various packages.

Change-Id: I055cc7bb05d5b4ce0071e3f88a71cb9596e76c74
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/228022
Reviewed-by: Kenzie (Schmoll) Davisson <kenzieschmoll@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2022-01-18 22:42:05 +00:00