[web] delete native_gc_test.

It seems to me that this test doesn't provide value for the JS backends.
The test was first introduced 11 years ago to investigate and fix GC
issues in Dartium that happened across the Dart/DOM boundary (see
https://github.com/dart-lang/sdk/issues/1448).

While the test works in many configurations, this test is flaky in
dart2js-firefox (37%) and DDC (8-14%).  I haven't investigated the
reasons behind the timeouts, but given the origins of the test, it
doesn't seem worth fixing it.

Change-Id: I3eaf2273209b587ce5ecfcf4a2bbbd9cb8b990fc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/332167
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
This commit is contained in:
Sigmund Cherem 2023-10-26 01:17:20 +00:00 committed by Commit Queue
parent a7104c813f
commit 744231d16e
2 changed files with 0 additions and 138 deletions

View file

@ -1,70 +0,0 @@
// Copyright (c) 2020, 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.
library NativeGCTest;
import 'dart:async';
import 'dart:html';
import 'package:expect/minitest.dart';
var testEvent = new EventStreamProvider<Event>('test');
void testEventListener() {
final int N = 1000000;
final int M = 1000;
var div;
for (int i = 0; i < M; ++i) {
// This memory should be freed when the listener below is
// collected.
List<int> l = new List<int>.filled(N, 0);
// Record the iteration number.
l[N - 1] = i;
div = new Element.tag('div');
testEvent.forTarget(div).listen((_) {
// Only the final iteration's listener should be invoked.
// Note: the reference to l keeps the entire list alive.
expect(l[N - 1], M - 1);
});
}
final event = new Event('test');
div.dispatchEvent(event);
}
Future<Null> testWindowEventListener() {
String message = 'WindowEventListenerTestPingMessage';
Element testDiv = new DivElement();
testDiv.id = '#TestDiv';
document.body!.append(testDiv);
window.onMessage.listen((e) {
if (e.data == message) testDiv.click();
});
for (int i = 0; i < 100; ++i) {
triggerMajorGC();
}
final done = new Completer<Null>();
testDiv.onClick.listen(((_) {
done.complete();
}));
window.postMessage(message, '*');
return done.future;
}
main() async {
testEventListener();
await testWindowEventListener();
}
void triggerMajorGC() {
List<int> list = new List<int>.filled(1000000, 0);
Element div = new DivElement();
div.onClick.listen((e) => print(list[0]));
}

View file

@ -1,68 +0,0 @@
// @dart = 2.9
library NativeGCTest;
import 'dart:async';
import 'dart:html';
import 'package:expect/minitest.dart';
var testEvent = new EventStreamProvider<Event>('test');
void testEventListener() {
final int N = 1000000;
final int M = 1000;
var div;
for (int i = 0; i < M; ++i) {
// This memory should be freed when the listener below is
// collected.
List l = new List.filled(N, null);
// Record the iteration number.
l[N - 1] = i;
div = new Element.tag('div');
testEvent.forTarget(div).listen((_) {
// Only the final iteration's listener should be invoked.
// Note: the reference to l keeps the entire list alive.
expect(l[N - 1], M - 1);
});
}
final event = new Event('test');
div.dispatchEvent(event);
}
Future<Null> testWindowEventListener() {
String message = 'WindowEventListenerTestPingMessage';
Element testDiv = new DivElement();
testDiv.id = '#TestDiv';
document.body.append(testDiv);
window.onMessage.listen((e) {
if (e.data == message) testDiv.click();
});
for (int i = 0; i < 100; ++i) {
triggerMajorGC();
}
final done = new Completer<Null>();
testDiv.onClick.listen(((_) {
done.complete();
}));
window.postMessage(message, '*');
return done.future;
}
main() async {
testEventListener();
await testWindowEventListener();
}
void triggerMajorGC() {
List list = new List.filled(1000000, null);
Element div = new DivElement();
div.onClick.listen((e) => print(list[0]));
}