Files
sdk/tests/lib/isolate/native_wrapper_message_test.dart
T
Daco Harkes 3de5d25429 [vm] Class modifiers for NativeFieldWrapper subtypes
Split off https://dart-review.googlesource.com/c/sdk/+/291761.
Landing separately, so that the breaking change itself is a smaller
CL.

TEST=ci build (see touched _test files)

bug: https://github.com/dart-lang/sdk/issues/51896
Change-Id: Ic8d218845ccb6a277689e911b2c34c44639e13cf
Cq-Include-Trybots: luci.dart.try:flutter-linux-try,vm-aot-linux-debug-x64c-try,vm-ffi-android-debug-arm-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/292000
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2023-03-31 13:20:19 +00:00

35 lines
873 B
Dart

// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import 'dart:isolate';
import 'dart:nativewrappers';
import 'package:expect/expect.dart';
import 'package:async_helper/async_helper.dart';
echo(msg) {
var data = msg[0];
var reply = msg[1];
reply.send('echoing ${data(1)}}');
}
base class Test extends NativeFieldWrapperClass2 {
Test(this.i, this.j);
int i, j;
}
main() {
var port = new RawReceivePort();
var obj = new Test(1, 2);
var msg = [obj, port.sendPort];
var snd = Isolate.spawn(echo, msg);
asyncStart();
Future<Isolate?>.value(snd).catchError((e) {
Expect.isTrue(e is ArgumentError);
Expect.isTrue("$e".contains("Test"));
port.close();
asyncEnd();
});
}