Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(120)

Unified Diff: third_party/WebKit/Source/modules/csspaint/PaintWorkletTest.cpp

Issue 2840523002: [DONT COMMIT] Worklet: Implement "addModule()" algorithm for main thread worklets (Closed)
Patch Set: rebase Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/modules/csspaint/PaintWorkletGlobalScopeProxy.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..e192079d0f221f8ada972daaa01a99ee69204f76 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()->MayAddWorkletGlobalScopes(); }
+
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() { } });"));
« no previous file with comments | « third_party/WebKit/Source/modules/csspaint/PaintWorkletGlobalScopeProxy.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698