| Index: third_party/WebKit/Source/modules/csspaint/PaintWorkletTest.cpp
|
| diff --git a/third_party/WebKit/Source/modules/csspaint/PaintWorkletTest.cpp b/third_party/WebKit/Source/modules/csspaint/PaintWorkletTest.cpp
|
| index 3aba3e96ef9a171d5e87362b00b24c0c392ff2a2..f7a3986bb30bbfd2bf665f5e623da3854853c3d0 100644
|
| --- a/third_party/WebKit/Source/modules/csspaint/PaintWorkletTest.cpp
|
| +++ b/third_party/WebKit/Source/modules/csspaint/PaintWorkletTest.cpp
|
| @@ -4,6 +4,7 @@
|
|
|
| #include "modules/csspaint/PaintWorklet.h"
|
|
|
| +#include <memory>
|
| #include "bindings/core/v8/ScriptSourceCode.h"
|
| #include "bindings/core/v8/V8GCController.h"
|
| #include "bindings/core/v8/WorkerOrWorkletScriptController.h"
|
| @@ -11,28 +12,41 @@
|
| #include "core/testing/DummyPageHolder.h"
|
| #include "modules/csspaint/CSSPaintDefinition.h"
|
| #include "modules/csspaint/PaintWorkletGlobalScope.h"
|
| +#include "modules/csspaint/PaintWorkletGlobalScopeProxy.h"
|
| #include "modules/csspaint/WindowPaintWorklet.h"
|
| #include "testing/gtest/include/gtest/gtest.h"
|
| -#include <memory>
|
|
|
| namespace blink {
|
|
|
| +using GlobalScopeProxies =
|
| + WTF::HashSet<std::unique_ptr<WorkletGlobalScopeProxy>>;
|
| +
|
| class PaintWorkletTest : public testing::Test {
|
| public:
|
| PaintWorkletTest() : page_(DummyPageHolder::Create()) {}
|
|
|
| + void SetUp() override { GetPaintWorklet()->CreateWorkletGlobalScope(); }
|
| +
|
| PaintWorklet* GetPaintWorklet() {
|
| return WindowPaintWorklet::From(*page_->GetFrame().DomWindow())
|
| .paintWorklet();
|
| }
|
|
|
| + GlobalScopeProxies& GetGlobalScopeProxies() {
|
| + return GetPaintWorklet()->global_scope_proxies_;
|
| + }
|
| +
|
| protected:
|
| std::unique_ptr<DummyPageHolder> page_;
|
| };
|
|
|
| TEST_F(PaintWorkletTest, GarbageCollectionOfCSSPaintDefinition) {
|
| + GlobalScopeProxies& proxies = GetGlobalScopeProxies();
|
| + EXPECT_EQ(1u, proxies.size());
|
| + WorkletGlobalScopeProxy* proxy = proxies.begin()->get();
|
| PaintWorkletGlobalScope* global_scope =
|
| - GetPaintWorklet()->GetWorkletGlobalScopeProxy();
|
| + PaintWorkletGlobalScopeProxy::From(proxy)->global_scope();
|
| +
|
| global_scope->ScriptController()->Evaluate(
|
| ScriptSourceCode("registerPaint('foo', class { paint() { } });"));
|
|
|
|
|