Unnecessary new (#20138)
* enable lint unnecessary_new * fix tests * fix tests * fix tests
This commit is contained in:
committed by
GitHub
parent
d7a0dcaa4a
commit
d927c93310
@@ -19,11 +19,11 @@ void main() {
|
||||
|
||||
setUp(() {
|
||||
result = null;
|
||||
extension = new FlutterDriverExtension((String message) async { log.add(message); return (messageId += 1).toString(); }, false);
|
||||
extension = FlutterDriverExtension((String message) async { log.add(message); return (messageId += 1).toString(); }, false);
|
||||
});
|
||||
|
||||
testWidgets('returns immediately when transient callback queue is empty', (WidgetTester tester) async {
|
||||
extension.call(new WaitUntilNoTransientCallbacks().serialize())
|
||||
extension.call(WaitUntilNoTransientCallbacks().serialize())
|
||||
.then<Null>(expectAsync1((Map<String, dynamic> r) {
|
||||
result = r;
|
||||
}));
|
||||
@@ -43,7 +43,7 @@ void main() {
|
||||
// Intentionally blank. We only care about existence of a callback.
|
||||
});
|
||||
|
||||
extension.call(new WaitUntilNoTransientCallbacks().serialize())
|
||||
extension.call(WaitUntilNoTransientCallbacks().serialize())
|
||||
.then<Null>(expectAsync1((Map<String, dynamic> r) {
|
||||
result = r;
|
||||
}));
|
||||
@@ -65,7 +65,7 @@ void main() {
|
||||
|
||||
testWidgets('handler', (WidgetTester tester) async {
|
||||
expect(log, isEmpty);
|
||||
final dynamic result = RequestDataResult.fromJson((await extension.call(new RequestData('hello').serialize()))['response']);
|
||||
final dynamic result = RequestDataResult.fromJson((await extension.call(RequestData('hello').serialize()))['response']);
|
||||
expect(log, <String>['hello']);
|
||||
expect(result.message, '1');
|
||||
});
|
||||
@@ -74,7 +74,7 @@ void main() {
|
||||
group('getSemanticsId', () {
|
||||
FlutterDriverExtension extension;
|
||||
setUp(() {
|
||||
extension = new FlutterDriverExtension((String arg) async => '', true);
|
||||
extension = FlutterDriverExtension((String arg) async => '', true);
|
||||
});
|
||||
|
||||
testWidgets('works when semantics are enabled', (WidgetTester tester) async {
|
||||
@@ -82,7 +82,7 @@ void main() {
|
||||
await tester.pumpWidget(
|
||||
const Text('hello', textDirection: TextDirection.ltr));
|
||||
|
||||
final Map<String, Object> arguments = new GetSemanticsId(new ByText('hello')).serialize();
|
||||
final Map<String, Object> arguments = GetSemanticsId(ByText('hello')).serialize();
|
||||
final GetSemanticsIdResult result = GetSemanticsIdResult.fromJson((await extension.call(arguments))['response']);
|
||||
|
||||
expect(result.id, 1);
|
||||
@@ -93,7 +93,7 @@ void main() {
|
||||
await tester.pumpWidget(
|
||||
const Text('hello', textDirection: TextDirection.ltr));
|
||||
|
||||
final Map<String, Object> arguments = new GetSemanticsId(new ByText('hello')).serialize();
|
||||
final Map<String, Object> arguments = GetSemanticsId(ByText('hello')).serialize();
|
||||
final Map<String, Object> response = await extension.call(arguments);
|
||||
|
||||
expect(response['isError'], true);
|
||||
@@ -103,16 +103,16 @@ void main() {
|
||||
testWidgets('throws state error multiple matches are found', (WidgetTester tester) async {
|
||||
final SemanticsHandle semantics = RendererBinding.instance.pipelineOwner.ensureSemantics();
|
||||
await tester.pumpWidget(
|
||||
new Directionality(
|
||||
Directionality(
|
||||
textDirection: TextDirection.ltr,
|
||||
child: new ListView(children: const <Widget>[
|
||||
child: ListView(children: const <Widget>[
|
||||
SizedBox(width: 100.0, height: 100.0, child: Text('hello')),
|
||||
SizedBox(width: 100.0, height: 100.0, child: Text('hello')),
|
||||
]),
|
||||
),
|
||||
);
|
||||
|
||||
final Map<String, Object> arguments = new GetSemanticsId(new ByText('hello')).serialize();
|
||||
final Map<String, Object> arguments = GetSemanticsId(ByText('hello')).serialize();
|
||||
final Map<String, Object> response = await extension.call(arguments);
|
||||
|
||||
expect(response['isError'], true);
|
||||
|
||||
@@ -15,7 +15,7 @@ void main() {
|
||||
group('TimelineSummary', () {
|
||||
|
||||
TimelineSummary summarize(List<Map<String, dynamic>> testEvents) {
|
||||
return new TimelineSummary.summarize(new Timeline.fromJson(<String, dynamic>{
|
||||
return TimelineSummary.summarize(Timeline.fromJson(<String, dynamic>{
|
||||
'traceEvents': testEvents,
|
||||
}));
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ import '../common.dart';
|
||||
void main() {
|
||||
group('Timeline', () {
|
||||
test('parses JSON', () {
|
||||
final Timeline timeline = new Timeline.fromJson(<String, dynamic>{
|
||||
final Timeline timeline = Timeline.fromJson(<String, dynamic>{
|
||||
'traceEvents': <Map<String, dynamic>>[
|
||||
<String, dynamic>{
|
||||
'name': 'test event',
|
||||
|
||||
Reference in New Issue
Block a user