@@ -7,78 +7,43 @@ import 'package:flutter_test/flutter_test.dart';
77import '../../integration_test/test_infra/run/_in_file_args.dart' ;
88import '../../integration_test/test_infra/run/_test_app_driver.dart' ;
99
10- const _testAppPath = 'test/test_infra/fixtures/memory_app' ;
10+ void main () {
11+ group ('$TestFileArgs ' , () {
12+ test ('empty, flutter app device' , () {
13+ final args = TestFileArgs .fromFileContent (
14+ '' /* empty file */ ,
15+ testAppDevice: TestAppDevice .flutterTester,
16+ );
17+ expect (args.experimentsOn, isFalse);
18+ expect (args.appPath, defaultFlutterAppPath);
19+ });
1120
12- final _defaultArgs = TestFileArgs .fromFileContent (
13- '' ,
14- testAppDevice: TestAppDevice .flutterTester,
15- );
21+ test ('empty, cli app device' , () {
22+ final args = TestFileArgs .fromFileContent (
23+ '' /* empty file */ ,
24+ testAppDevice: TestAppDevice .cli,
25+ );
26+ expect (args.experimentsOn, isFalse);
27+ expect (args.appPath, defaultDartCliAppPath);
28+ });
1629
17- final _defaultArgsForCliDevice = TestFileArgs .fromFileContent (
18- '' ,
19- testAppDevice: TestAppDevice .cli,
20- );
30+ test ('non-empty' , () {
31+ const testAppPath = 'test/test_infra/fixtures/memory_app' ;
2132
22- final tests = [
23- _InFileTestArgsTest (
24- name: 'empty' ,
25- input: '' ,
26- testAppDevice: TestAppDevice .flutterTester,
27- expectedExperimentsOn: _defaultArgs.experimentsOn,
28- expectedAppPath: defaultFlutterAppPath,
29- ),
30- _InFileTestArgsTest (
31- name: 'empty' ,
32- input: '' ,
33- testAppDevice: TestAppDevice .cli,
34- expectedExperimentsOn: _defaultArgsForCliDevice.experimentsOn,
35- expectedAppPath: defaultDartCliAppPath,
36- ),
37- _InFileTestArgsTest (
38- name: 'non-empty' ,
39- input: '''
33+ final args = TestFileArgs .fromFileContent ('''
4034// Copyright 2023 The Chromium Authors. All rights reserved.
4135// Use of this source code is governed by a BSD-style license that can be
4236// found in the LICENSE file.
4337
4438// Do not delete these arguments. They are parsed by test runner.
45- //test-argument:appPath="$_testAppPath "
39+ //test-argument:appPath="$testAppPath "
4640// test-argument : experimentsOn = true
4741
4842
4943import 'dart:ui' as ui;
50- ''' ,
51- testAppDevice: TestAppDevice .flutterTester,
52- expectedExperimentsOn: true ,
53- expectedAppPath: _testAppPath,
54- ),
55- ];
56-
57- void main () {
58- for (final t in tests) {
59- test ('$TestFileArgs , ${t .name }' , () {
60- final args = TestFileArgs .fromFileContent (
61- t.input,
62- testAppDevice: t.testAppDevice,
63- );
64- expect (args.experimentsOn, t.expectedExperimentsOn);
65- expect (args.appPath, t.expectedAppPath);
44+ ''' , testAppDevice: TestAppDevice .flutterTester);
45+ expect (args.experimentsOn, isTrue);
46+ expect (args.appPath, testAppPath);
6647 });
67- }
68- }
69-
70- class _InFileTestArgsTest {
71- _InFileTestArgsTest ({
72- required this .name,
73- required this .input,
74- required this .testAppDevice,
75- required this .expectedExperimentsOn,
76- required this .expectedAppPath,
7748 });
78-
79- final String name;
80- final String input;
81- final TestAppDevice testAppDevice;
82- final bool expectedExperimentsOn;
83- final String expectedAppPath;
8449}
0 commit comments