Skip to content

Commit 763d025

Browse files
[pigeon] Eliminate some of the test pigeons (flutter#3213)
* Fold in async_handlers.dart * Remove some largely unused files * Fold in the relevant parts of list.dart * Remove java_double_host_api * Remove unnecessary double-generation of messages.dart * Remove enum_args * Remove some unnecesasry/duplicate unit tests * Eliminate android_unittest * Format * Remove build references on Windows
1 parent 6c04c74 commit 763d025

File tree

33 files changed

+1832
-420
lines changed

33 files changed

+1832
-420
lines changed

packages/pigeon/pigeons/async_handlers.dart

Lines changed: 0 additions & 23 deletions
This file was deleted.

packages/pigeon/pigeons/core_tests.dart

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -538,10 +538,68 @@ abstract class FlutterIntegrationCoreApi {
538538
@ObjCSelector('echoNullableMap:')
539539
@SwiftFunction('echoNullable(_:)')
540540
Map<String?, Object?>? echoNullableMap(Map<String?, Object?>? aMap);
541+
542+
// ========== Async tests ==========
543+
// These are minimal since async FlutterApi only changes Dart generation.
544+
// Currently they aren't integration tested, but having them here ensures
545+
// analysis coverage.
546+
547+
/// A no-op function taking no arguments and returning no value, to sanity
548+
/// test basic asynchronous calling.
549+
@async
550+
void noopAsync();
551+
552+
/// Returns the passed in generic Object asynchronously.
553+
@async
554+
@ObjCSelector('echoAsyncString:')
555+
@SwiftFunction('echoAsync(_:)')
556+
String echoAsyncString(String aString);
541557
}
542558

543559
/// An API that can be implemented for minimal, compile-only tests.
560+
//
561+
// This is also here to test that multiple host APIs can be generated
562+
// successfully in all languages (e.g., in Java where it requires having a
563+
// wrapper class).
544564
@HostApi()
545565
abstract class HostTrivialApi {
546566
void noop();
547567
}
568+
569+
/// A simple API implemented in some unit tests.
570+
//
571+
// This is separate from HostIntegrationCoreApi to avoid having to update a
572+
// lot of unit tests every time we add something to the integration test API.
573+
// TODO(stuartmorgan): Restructure the unit tests to reduce the number of
574+
// different APIs we define.
575+
@HostApi()
576+
abstract class HostSmallApi {
577+
@async
578+
@ObjCSelector('echoString:')
579+
String echo(String aString);
580+
581+
@async
582+
void voidVoid();
583+
}
584+
585+
/// A simple API called in some unit tests.
586+
//
587+
// This is separate from FlutterIntegrationCoreApi to allow for incrementally
588+
// moving from the previous fragmented unit test structure to something more
589+
// unified.
590+
// TODO(stuartmorgan): Restructure the unit tests to reduce the number of
591+
// different APIs we define.
592+
@FlutterApi()
593+
abstract class FlutterSmallApi {
594+
@ObjCSelector('echoWrappedList:')
595+
@SwiftFunction('echo(_:)')
596+
TestMessage echoWrappedList(TestMessage msg);
597+
}
598+
599+
/// A data class containing a List, used in unit tests.
600+
// TODO(stuartmorgan): Evaluate whether these unit tests are still useful; see
601+
// TODOs above about restructring.
602+
class TestMessage {
603+
// ignore: always_specify_types, strict_raw_type
604+
List? testList;
605+
}

packages/pigeon/pigeons/enum_args.dart

Lines changed: 0 additions & 20 deletions
This file was deleted.

packages/pigeon/pigeons/host2flutter.dart

Lines changed: 0 additions & 23 deletions
This file was deleted.

packages/pigeon/pigeons/java_double_host_api.dart

Lines changed: 0 additions & 21 deletions
This file was deleted.

packages/pigeon/pigeons/list.dart

Lines changed: 0 additions & 20 deletions
This file was deleted.

packages/pigeon/pigeons/void_arg_flutter.dart

Lines changed: 0 additions & 14 deletions
This file was deleted.

packages/pigeon/pigeons/void_arg_host.dart

Lines changed: 0 additions & 14 deletions
This file was deleted.

packages/pigeon/pigeons/voidflutter.dart

Lines changed: 0 additions & 14 deletions
This file was deleted.

packages/pigeon/pigeons/voidhost.dart

Lines changed: 0 additions & 14 deletions
This file was deleted.

0 commit comments

Comments
 (0)