Commit 37084183 authored by Michael Lippautz's avatar Michael Lippautz Committed by Commit Bot

[unified-heap] Remove obsolete tests

- LayoutWorklet and PaintWorklet are supplements to LocalDOMWindow which
  ties the lifetime of JS wrappers to the lifetime of the window
- TransformStreamTest does not crash anymore

Bug: 843903
Change-Id: Iea6d46f32fd22d10aa3581ff0712778d4c9ca6ba
Reviewed-on: https://chromium-review.googlesource.com/c/1296591Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#601920}
parent 96dcf5b3
...@@ -63,46 +63,6 @@ class LayoutWorkletTest : public PageTestBase { ...@@ -63,46 +63,6 @@ class LayoutWorkletTest : public PageTestBase {
Persistent<LayoutWorklet> layout_worklet_; Persistent<LayoutWorklet> layout_worklet_;
}; };
TEST_F(LayoutWorkletTest, GarbageCollectionOfCSSLayoutDefinition) {
EvaluateScriptModule(R"JS(
registerLayout('foo', class {
*intrinsicSizes() { }
*layout() { }
});
)JS");
LayoutWorkletGlobalScope* global_scope = GetGlobalScope();
CSSLayoutDefinition* definition = global_scope->FindDefinition("foo");
EXPECT_NE(nullptr, definition);
v8::Isolate* isolate =
global_scope->ScriptController()->GetScriptState()->GetIsolate();
DCHECK(isolate);
// Set our ScopedPersistent to the layout function, and make weak.
ScopedPersistent<v8::Function> handle;
{
v8::HandleScope handle_scope(isolate);
handle.Set(isolate, definition->LayoutFunctionForTesting(isolate));
handle.SetPhantom();
}
EXPECT_FALSE(handle.IsEmpty());
EXPECT_TRUE(handle.IsWeak());
// Run a GC, persistent shouldn't have been collected yet.
ThreadState::Current()->CollectAllGarbage();
V8GCController::CollectAllGarbageForTesting(isolate);
EXPECT_FALSE(handle.IsEmpty());
// Delete the page & associated objects.
Terminate();
// Run a GC, the persistent should have been collected.
ThreadState::Current()->CollectAllGarbage();
V8GCController::CollectAllGarbageForTesting(isolate);
EXPECT_TRUE(handle.IsEmpty());
}
TEST_F(LayoutWorkletTest, ParseProperties) { TEST_F(LayoutWorkletTest, ParseProperties) {
EvaluateScriptModule(R"JS( EvaluateScriptModule(R"JS(
registerLayout('foo', class { registerLayout('foo', class {
......
...@@ -469,35 +469,6 @@ TEST_F(TransformStreamTest, SurvivesGarbageCollectionWhenTraced) { ...@@ -469,35 +469,6 @@ TEST_F(TransformStreamTest, SurvivesGarbageCollectionWhenTraced) {
.value_or(false)); .value_or(false));
} }
// Verify that JS TransformStream is collected when it is not reachable from V8.
#if GTEST_HAS_DEATH_TEST
#define MAYBE_IsGarbageCollectedWhenNotTraced IsGarbageCollectedWhenNotTraced
#else
#define MAYBE_IsGarbageCollectedWhenNotTraced \
DISABLED_IsGarbageCollectedWhenNotTraced
#endif
TEST_F(TransformStreamTest, MAYBE_IsGarbageCollectedWhenNotTraced) {
auto page_holder = DummyPageHolder::Create();
Persistent<ScriptState> script_state =
ToScriptStateForMainWorld(page_holder->GetDocument().GetFrame());
{
ScriptState::Scope scope(script_state);
Init(new IdentityTransformer(), script_state, ASSERT_NO_EXCEPTION);
}
Persistent<TransformStream> stream = Stream();
ClearHolder();
Microtask::PerformCheckpoint(script_state->GetIsolate());
// Avoid scanning the stack here as it could accidentaly keep state alive.
V8GCController::CollectAllGarbageForTesting(
script_state->GetIsolate(),
v8::EmbedderHeapTracer::EmbedderStackState::kEmpty);
ScriptState::Scope scope(script_state);
// This emits a warning that death tests are unsafe with threads, but it works
// anyway. The crash message depends on whether DCHECK is enabled or not, so
// the regex it is required to match is empty.
EXPECT_DEATH(stream->Readable(script_state, ASSERT_NO_EXCEPTION), "");
}
} // namespace } // namespace
} // namespace blink } // namespace blink
...@@ -103,43 +103,6 @@ class PaintWorkletTest : public PageTestBase { ...@@ -103,43 +103,6 @@ class PaintWorkletTest : public PageTestBase {
Persistent<TestPaintWorklet> test_paint_worklet_; Persistent<TestPaintWorklet> test_paint_worklet_;
}; };
TEST_F(PaintWorkletTest, GarbageCollectionOfCSSPaintDefinition) {
PaintWorkletGlobalScope* global_scope = GetProxy()->global_scope();
global_scope->ScriptController()->Evaluate(
ScriptSourceCode("registerPaint('foo', class { paint() { } });"),
kSharableCrossOrigin);
CSSPaintDefinition* definition = global_scope->FindDefinition("foo");
DCHECK(definition);
v8::Isolate* isolate =
global_scope->ScriptController()->GetScriptState()->GetIsolate();
DCHECK(isolate);
// Set our ScopedPersistent to the paint function, and make weak.
ScopedPersistent<v8::Function> handle;
{
v8::HandleScope handle_scope(isolate);
handle.Set(isolate, definition->PaintFunctionForTesting(isolate));
handle.SetPhantom();
}
DCHECK(!handle.IsEmpty());
DCHECK(handle.IsWeak());
// Run a GC, persistent shouldn't have been collected yet.
ThreadState::Current()->CollectAllGarbage();
V8GCController::CollectAllGarbageForTesting(isolate);
DCHECK(!handle.IsEmpty());
// Delete the page & associated objects.
Terminate();
// Run a GC, the persistent should have been collected.
ThreadState::Current()->CollectAllGarbage();
V8GCController::CollectAllGarbageForTesting(isolate);
DCHECK(handle.IsEmpty());
}
// This is a crash test for crbug.com/803026. At some point, we shipped the // This is a crash test for crbug.com/803026. At some point, we shipped the
// CSSPaintAPI without shipping the CSSPaintAPIArguments, the result of it is // CSSPaintAPI without shipping the CSSPaintAPIArguments, the result of it is
// that the |paint_arguments| in the CSSPaintDefinition::Paint() becomes // that the |paint_arguments| in the CSSPaintDefinition::Paint() becomes
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment