|
2 | 2 | // Use of this source code is governed by a BSD-style license that can be
|
3 | 3 | // found in the LICENSE file.
|
4 | 4 |
|
| 5 | +import 'dart:async'; |
5 | 6 | import 'dart:io';
|
6 | 7 |
|
| 8 | +import 'package:dwds/data/build_result.dart'; |
| 9 | +import 'package:dwds/dwds.dart'; |
| 10 | +import 'package:dwds/src/loaders/strategy.dart'; |
| 11 | +import 'package:dwds/src/readers/asset_reader.dart'; |
| 12 | +import 'package:dwds/src/services/expression_compiler.dart'; |
7 | 13 | import 'package:flutter_tools/src/base/file_system.dart';
|
8 | 14 | import 'package:flutter_tools/src/base/io.dart';
|
9 | 15 | import 'package:flutter_tools/src/build_info.dart';
|
10 | 16 | import 'package:flutter_tools/src/compile.dart';
|
11 | 17 | import 'package:flutter_tools/src/convert.dart';
|
12 | 18 | import 'package:flutter_tools/src/build_runner/devfs_web.dart';
|
| 19 | +import 'package:logging/logging.dart'; |
13 | 20 | import 'package:mockito/mockito.dart';
|
14 | 21 | // TODO(bkonyi): remove deprecated member usage, https://github.com/flutter/flutter/issues/51951
|
15 | 22 | // ignore: deprecated_member_use
|
@@ -432,7 +439,43 @@ void main() {
|
432 | 439 |
|
433 | 440 | await webDevFS.destroy();
|
434 | 441 | }));
|
| 442 | + |
| 443 | + test('Launches DWDS with the correct arguments', () => testbed.run(() async { |
| 444 | + final WebAssetServer server = await WebAssetServer.start( |
| 445 | + 'localhost', |
| 446 | + 8123, |
| 447 | + (String url) => null, |
| 448 | + BuildMode.debug, |
| 449 | + true, |
| 450 | + Uri.file('test.dart'), |
| 451 | + null, |
| 452 | + dwdsLauncher: ({ |
| 453 | + AssetReader assetReader, |
| 454 | + Stream<BuildResult> buildResults, |
| 455 | + ConnectionProvider chromeConnection, |
| 456 | + bool enableDebugExtension, |
| 457 | + bool enableDebugging, |
| 458 | + ExpressionCompiler expressionCompiler, |
| 459 | + String hostname, |
| 460 | + LoadStrategy loadStrategy, |
| 461 | + void Function(Level, String) logWriter, |
| 462 | + bool serveDevTools, |
| 463 | + UrlEncoder urlEncoder, |
| 464 | + bool useSseForDebugProxy, |
| 465 | + bool verbose, |
| 466 | + }) async { |
| 467 | + expect(serveDevTools, false); |
| 468 | + expect(verbose, null); |
| 469 | + expect(enableDebugging, true); |
| 470 | + expect(enableDebugExtension, true); |
| 471 | + |
| 472 | + return MockDwds(); |
| 473 | + }); |
| 474 | + |
| 475 | + await server.dispose(); |
| 476 | + })); |
435 | 477 | }
|
436 | 478 |
|
437 | 479 | class MockHttpServer extends Mock implements HttpServer {}
|
438 | 480 | class MockResidentCompiler extends Mock implements ResidentCompiler {}
|
| 481 | +class MockDwds extends Mock implements Dwds {} |
0 commit comments