Unverified Commit 1e86c1fb authored by Jonah Williams's avatar Jonah Williams Committed by GitHub

[flutter_tools] re-enable debug extension (#53765)

parent 66d7a6c2
......@@ -36,6 +36,22 @@ import '../globals.dart' as globals;
import '../web/bootstrap.dart';
import '../web/chrome.dart';
typedef DwdsLauncher = Future<Dwds> Function({
@required AssetReader assetReader,
@required Stream<BuildResult> buildResults,
@required ConnectionProvider chromeConnection,
@required LoadStrategy loadStrategy,
@required bool enableDebugging,
bool enableDebugExtension,
String hostname,
bool useSseForDebugProxy,
bool serveDevTools,
void Function(Level, String) logWriter,
bool verbose,
UrlEncoder urlEncoder,
ExpressionCompiler expressionCompiler,
});
/// An expression compiler connecting to FrontendServer
///
/// This is only used in development mode
......@@ -87,7 +103,6 @@ class WebAssetServer implements AssetReader {
static const String _kDefaultMimeType = 'application/octet-stream';
final Map<String, String> _modules;
final Map<String, String> _digests;
void performRestart(List<String> modules) {
......@@ -121,6 +136,7 @@ class WebAssetServer implements AssetReader {
Uri entrypoint,
ExpressionCompiler expressionCompiler, {
bool testMode = false,
DwdsLauncher dwdsLauncher = Dwds.start,
}) async {
try {
final InternetAddress address = (await InternetAddress.lookup(hostname)).first;
......@@ -184,8 +200,9 @@ class WebAssetServer implements AssetReader {
}
// In debug builds, spin up DWDS and the full asset server.
final Dwds dwds = await Dwds.start(
final Dwds dwds = await dwdsLauncher(
assetReader: server,
enableDebugExtension: true,
buildResults: const Stream<BuildResult>.empty(),
chromeConnection: () async {
final Chrome chrome = await ChromeLauncher.connectedInstance;
......
......@@ -2,14 +2,21 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'dart:async';
import 'dart:io';
import 'package:dwds/data/build_result.dart';
import 'package:dwds/dwds.dart';
import 'package:dwds/src/loaders/strategy.dart';
import 'package:dwds/src/readers/asset_reader.dart';
import 'package:dwds/src/services/expression_compiler.dart';
import 'package:flutter_tools/src/base/file_system.dart';
import 'package:flutter_tools/src/base/io.dart';
import 'package:flutter_tools/src/build_info.dart';
import 'package:flutter_tools/src/compile.dart';
import 'package:flutter_tools/src/convert.dart';
import 'package:flutter_tools/src/build_runner/devfs_web.dart';
import 'package:logging/logging.dart';
import 'package:mockito/mockito.dart';
// TODO(bkonyi): remove deprecated member usage, https://github.com/flutter/flutter/issues/51951
// ignore: deprecated_member_use
......@@ -432,7 +439,43 @@ void main() {
await webDevFS.destroy();
}));
test('Launches DWDS with the correct arguments', () => testbed.run(() async {
final WebAssetServer server = await WebAssetServer.start(
'localhost',
8123,
(String url) => null,
BuildMode.debug,
true,
Uri.file('test.dart'),
null,
dwdsLauncher: ({
AssetReader assetReader,
Stream<BuildResult> buildResults,
ConnectionProvider chromeConnection,
bool enableDebugExtension,
bool enableDebugging,
ExpressionCompiler expressionCompiler,
String hostname,
LoadStrategy loadStrategy,
void Function(Level, String) logWriter,
bool serveDevTools,
UrlEncoder urlEncoder,
bool useSseForDebugProxy,
bool verbose,
}) async {
expect(serveDevTools, false);
expect(verbose, null);
expect(enableDebugging, true);
expect(enableDebugExtension, true);
return MockDwds();
});
await server.dispose();
}));
}
class MockHttpServer extends Mock implements HttpServer {}
class MockResidentCompiler extends Mock implements ResidentCompiler {}
class MockDwds extends Mock implements Dwds {}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment