| 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 fa235a8d0be44a78e26854bccbc68824cc3b71c2..976769236ea9603c267c0a877240db44d397d0df 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,39 @@
|
| #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()->AddWorkletGlobalScopesIfNeeded(); }
|
| +
|
| 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) {
|
| - PaintWorkletGlobalScopeProxy* proxy = PaintWorkletGlobalScopeProxy::From(
|
| - GetPaintWorklet()->GetWorkletGlobalScopeProxy());
|
| + GlobalScopeProxies& proxies = GetGlobalScopeProxies();
|
| + EXPECT_EQ(1u, proxies.size());
|
| + PaintWorkletGlobalScopeProxy* proxy =
|
| + PaintWorkletGlobalScopeProxy::From(proxies.begin()->get());
|
| PaintWorkletGlobalScope* global_scope = proxy->global_scope();
|
| global_scope->ScriptController()->Evaluate(
|
| ScriptSourceCode("registerPaint('foo', class { paint() { } });"));
|
|
|