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 7a9be6568820c1a897bc0e710a19a65cd1f8eeb1..cf3abbf7c21d3a30193443ca155efee6d1ca0a38 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,9 +12,9 @@ |
#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 { |
@@ -21,18 +22,27 @@ class PaintWorkletTest : public testing::Test { |
public: |
PaintWorkletTest() : page_(DummyPageHolder::Create()) {} |
+ void SetUp() override { |
+ GetGlobalScopeManager().AddGlobalScope( |
+ GetPaintWorklet()->CreateGlobalScope()); |
+ } |
+ |
PaintWorklet* GetPaintWorklet() { |
return WindowPaintWorklet::From(*page_->GetFrame().DomWindow()) |
.paintWorklet(); |
} |
+ WorkletGlobalScopeManager& GetGlobalScopeManager() { |
+ return GetPaintWorklet()->GetGlobalScopeManager(); |
+ } |
+ |
protected: |
std::unique_ptr<DummyPageHolder> page_; |
}; |
TEST_F(PaintWorkletTest, GarbageCollectionOfCSSPaintDefinition) { |
- PaintWorkletGlobalScopeProxy* proxy = PaintWorkletGlobalScopeProxy::From( |
- GetPaintWorklet()->GetWorkletGlobalScopeProxy()); |
+ auto proxy = PaintWorkletGlobalScopeProxy::From( |
+ GetGlobalScopeManager().FindAvailableGlobalScope()); |
PaintWorkletGlobalScope* global_scope = proxy->global_scope(); |
global_scope->ScriptController()->Evaluate( |
ScriptSourceCode("registerPaint('foo', class { paint() { } });")); |