diff --git a/packages/devtools_app/benchmark/devtools_benchmarks_test.dart b/packages/devtools_app/benchmark/devtools_benchmarks_test.dart index 58a0b59733e..3ed950eaf2b 100644 --- a/packages/devtools_app/benchmark/devtools_benchmarks_test.dart +++ b/packages/devtools_app/benchmark/devtools_benchmarks_test.dart @@ -50,12 +50,14 @@ Future _runBenchmarks({bool useWasm = false}) async { stdout.writeln('Starting web benchmark tests ...'); final taskResult = await serveWebBenchmark( benchmarkAppDirectory: projectRootDirectory(), - entryPoint: 'benchmark/test_infra/client.dart', + entryPoint: + 'benchmark/test_infra/client/client_${useWasm ? 'wasm' : 'js'}.dart', compilationOptions: useWasm ? const CompilationOptions.wasm() : const CompilationOptions.js(), treeShakeIcons: false, initialPage: benchmarkInitialPage, + queryParameters: useWasm ? wasmQueryParameters : null, ); stdout.writeln('Web benchmark tests finished.'); diff --git a/packages/devtools_app/benchmark/test_infra/client/client_js.dart b/packages/devtools_app/benchmark/test_infra/client/client_js.dart new file mode 100644 index 00000000000..394c44cd861 --- /dev/null +++ b/packages/devtools_app/benchmark/test_infra/client/client_js.dart @@ -0,0 +1,17 @@ +// Copyright 2023 The Chromium Authors. 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:web_benchmarks/client.dart'; + +import '../common.dart'; +import 'client_shared.dart'; + +/// Runs the client of the DevTools web benchmarks. +/// +/// When the DevTools web benchmarks are run, the server builds an app with this +/// file as the entry point (see `run_benchmarks.dart`). The app automates +/// the DevTools web app, records some performance data, and reports them. +Future main() async { + await runBenchmarks(benchmarks, initialPage: benchmarkInitialPage); +} diff --git a/packages/devtools_app/benchmark/test_infra/client.dart b/packages/devtools_app/benchmark/test_infra/client/client_shared.dart similarity index 57% rename from packages/devtools_app/benchmark/test_infra/client.dart rename to packages/devtools_app/benchmark/test_infra/client/client_shared.dart index cc59063bfd2..66e86a76d0f 100644 --- a/packages/devtools_app/benchmark/test_infra/client.dart +++ b/packages/devtools_app/benchmark/test_infra/client/client_shared.dart @@ -1,11 +1,11 @@ -// Copyright 2023 The Chromium Authors. All rights reserved. +// Copyright 2024 The Chromium Authors. 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:web_benchmarks/client.dart'; -import 'common.dart'; -import 'devtools_recorder.dart'; +import '../common.dart'; +import '../devtools_recorder.dart'; typedef RecorderFactory = Recorder Function(); @@ -20,12 +20,3 @@ final benchmarks = { benchmark: DevToolsBenchmark.offlinePerformanceScreen, ), }; - -/// Runs the client of the DevTools web benchmarks. -/// -/// When the DevTools web benchmarks are run, the server builds an app with this -/// file as the entry point (see `run_benchmarks.dart`). The app automates -/// the DevTools web app, records some performance data, and reports them. -Future main() async { - await runBenchmarks(benchmarks, initialPage: benchmarkInitialPage); -} diff --git a/packages/devtools_app/benchmark/test_infra/client/client_wasm.dart b/packages/devtools_app/benchmark/test_infra/client/client_wasm.dart new file mode 100644 index 00000000000..53d53d407c7 --- /dev/null +++ b/packages/devtools_app/benchmark/test_infra/client/client_wasm.dart @@ -0,0 +1,21 @@ +// Copyright 2024 The Chromium Authors. 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:web_benchmarks/client.dart'; + +import '../common.dart'; +import 'client_shared.dart'; + +/// Runs the client of the DevTools web benchmarks. +/// +/// When the DevTools web benchmarks are run, the server builds an app with this +/// file as the entry point (see `run_benchmarks.dart`). The app automates +/// the DevTools web app, records some performance data, and reports them. +Future main() async { + await runBenchmarks( + benchmarks, + initialPage: benchmarkInitialPage, + queryParameters: wasmQueryParameters, + ); +} diff --git a/packages/devtools_app/benchmark/test_infra/common.dart b/packages/devtools_app/benchmark/test_infra/common.dart index c3f5b462d52..737af05c3a4 100644 --- a/packages/devtools_app/benchmark/test_infra/common.dart +++ b/packages/devtools_app/benchmark/test_infra/common.dart @@ -10,6 +10,8 @@ // found" in DevTools. const benchmarkInitialPage = ''; +const wasmQueryParameters = {'wasm': 'true'}; + const devtoolsBenchmarkPrefix = 'devtools'; enum DevToolsBenchmark { diff --git a/packages/devtools_app/pubspec.yaml b/packages/devtools_app/pubspec.yaml index 83071f7fc51..4e6f2599cee 100644 --- a/packages/devtools_app/pubspec.yaml +++ b/packages/devtools_app/pubspec.yaml @@ -76,7 +76,7 @@ dev_dependencies: mockito: ^5.4.1 stager: ^1.0.1 test: ^1.21.0 - web_benchmarks: ^2.0.2 + web_benchmarks: ^2.1.0 webkit_inspection_protocol: ">=0.5.0 <2.0.0" flutter: