[flutter_tools] support run -d chrome test scripts (#51658)
This commit is contained in:
parent
266742e12d
commit
9b4159c5ee
@ -590,7 +590,8 @@ Future<void> _runWebUnitTests() async {
|
|||||||
Future<void> _runWebIntegrationTests() async {
|
Future<void> _runWebIntegrationTests() async {
|
||||||
await _runWebStackTraceTest('profile');
|
await _runWebStackTraceTest('profile');
|
||||||
await _runWebStackTraceTest('release');
|
await _runWebStackTraceTest('release');
|
||||||
await _runWebDebugStackTraceTest();
|
await _runWebDebugTest('lib/stack_trace.dart');
|
||||||
|
await _runWebDebugTest('test/test.dart');
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> _runWebStackTraceTest(String buildMode) async {
|
Future<void> _runWebStackTraceTest(String buildMode) async {
|
||||||
@ -636,7 +637,7 @@ Future<void> _runWebStackTraceTest(String buildMode) async {
|
|||||||
/// Debug mode is special because `flutter build web` doesn't build in debug mode.
|
/// Debug mode is special because `flutter build web` doesn't build in debug mode.
|
||||||
///
|
///
|
||||||
/// Instead, we use `flutter run --debug` and sniff out the standard output.
|
/// Instead, we use `flutter run --debug` and sniff out the standard output.
|
||||||
Future<void> _runWebDebugStackTraceTest() async {
|
Future<void> _runWebDebugTest(String target) async {
|
||||||
final String testAppDirectory = path.join(flutterRoot, 'dev', 'integration_tests', 'web');
|
final String testAppDirectory = path.join(flutterRoot, 'dev', 'integration_tests', 'web');
|
||||||
final CapturedOutput output = CapturedOutput();
|
final CapturedOutput output = CapturedOutput();
|
||||||
bool success = false;
|
bool success = false;
|
||||||
@ -648,7 +649,8 @@ Future<void> _runWebDebugStackTraceTest() async {
|
|||||||
'-d',
|
'-d',
|
||||||
'chrome',
|
'chrome',
|
||||||
'--web-run-headless',
|
'--web-run-headless',
|
||||||
'lib/stack_trace.dart',
|
'-t',
|
||||||
|
target,
|
||||||
],
|
],
|
||||||
output: output,
|
output: output,
|
||||||
outputMode: OutputMode.capture,
|
outputMode: OutputMode.capture,
|
||||||
|
5
dev/integration_tests/web/lib/a.dart
Normal file
5
dev/integration_tests/web/lib/a.dart
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
// Copyright 2014 The Flutter Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
|
// found in the LICENSE file.
|
||||||
|
|
||||||
|
const String message = 'a';
|
5
dev/integration_tests/web/lib/b.dart
Normal file
5
dev/integration_tests/web/lib/b.dart
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
// Copyright 2014 The Flutter Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
|
// found in the LICENSE file.
|
||||||
|
|
||||||
|
const String message = 'b';
|
5
dev/integration_tests/web/lib/c.dart
Normal file
5
dev/integration_tests/web/lib/c.dart
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
// Copyright 2014 The Flutter Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
|
// found in the LICENSE file.
|
||||||
|
|
||||||
|
const String message = 'c';
|
5
dev/integration_tests/web/lib/d.dart
Normal file
5
dev/integration_tests/web/lib/d.dart
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
// Copyright 2014 The Flutter Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
|
// found in the LICENSE file.
|
||||||
|
|
||||||
|
const String message = 'd';
|
16
dev/integration_tests/web/test/test.dart
Normal file
16
dev/integration_tests/web/test/test.dart
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
// Copyright 2014 The Flutter 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_integration/a.dart'
|
||||||
|
if (dart.library.io) 'package:web_integration/b.dart' as message1;
|
||||||
|
import 'package:web_integration/c.dart'
|
||||||
|
if (dart.library.html) 'package:web_integration/d.dart' as message2;
|
||||||
|
|
||||||
|
void main() {
|
||||||
|
if (message1.message == 'a' && message2.message == 'd') {
|
||||||
|
print('--- TEST SUCCEEDED ---');
|
||||||
|
} else {
|
||||||
|
print('--- TEST FAILED ---');
|
||||||
|
}
|
||||||
|
}
|
@ -573,7 +573,13 @@ class _ResidentWebRunner extends ResidentWebRunner {
|
|||||||
.childFile('generated_plugin_registrant.dart')
|
.childFile('generated_plugin_registrant.dart')
|
||||||
.absolute.path;
|
.absolute.path;
|
||||||
final Uri generatedImport = packageUriMapper.map(generatedPath);
|
final Uri generatedImport = packageUriMapper.map(generatedPath);
|
||||||
final String importedEntrypoint = packageUriMapper.map(main).toString() ?? 'file://$main';
|
String importedEntrypoint = packageUriMapper.map(main)?.toString();
|
||||||
|
// Special handling for entrypoints that are not under lib, such as test scripts.
|
||||||
|
if (importedEntrypoint == null) {
|
||||||
|
final String parent = globals.fs.file(main).parent.path;
|
||||||
|
flutterDevices.first.generator.addFileSystemRoot(parent);
|
||||||
|
importedEntrypoint = 'org-dartlang-app:///${globals.fs.path.basename(main)}';
|
||||||
|
}
|
||||||
|
|
||||||
final String entrypoint = <String>[
|
final String entrypoint = <String>[
|
||||||
'import "$importedEntrypoint" as entrypoint;',
|
'import "$importedEntrypoint" as entrypoint;',
|
||||||
|
@ -427,9 +427,8 @@ void main() {
|
|||||||
Usage: () => MockFlutterUsage(),
|
Usage: () => MockFlutterUsage(),
|
||||||
}));
|
}));
|
||||||
|
|
||||||
test('web resident runner iss debuggable', () => testbed.run(() {
|
test('web resident runner is debuggable', () => testbed.run(() {
|
||||||
expect(residentWebRunner.debuggingEnabled, true);
|
expect(residentWebRunner.debuggingEnabled, true);
|
||||||
}, overrides: <Type, Generator>{
|
|
||||||
}));
|
}));
|
||||||
|
|
||||||
test('Exits when initial compile fails', () => testbed.run(() async {
|
test('Exits when initial compile fails', () => testbed.run(() async {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user