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

Side by Side Diff: third_party/WebKit/Source/modules/csspaint/PaintWorkletTest.cpp

Issue 2896773002: [DONT COMMIT] PaintWorklet: Move paintWorklet from 'window' to 'CSS' (Closed)
Patch Set: WIP Created 3 years, 6 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "modules/csspaint/PaintWorklet.h" 5 #include "modules/csspaint/PaintWorklet.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include "bindings/core/v8/ScriptSourceCode.h" 8 #include "bindings/core/v8/ScriptSourceCode.h"
9 #include "bindings/core/v8/V8GCController.h" 9 #include "bindings/core/v8/V8GCController.h"
10 #include "bindings/core/v8/WorkerOrWorkletScriptController.h" 10 #include "bindings/core/v8/WorkerOrWorkletScriptController.h"
11 #include "core/frame/LocalFrame.h" 11 #include "core/frame/LocalFrame.h"
12 #include "core/testing/DummyPageHolder.h" 12 #include "core/testing/DummyPageHolder.h"
13 #include "modules/csspaint/CSSPaintDefinition.h" 13 #include "modules/csspaint/CSSPaintDefinition.h"
14 #include "modules/csspaint/CSSPaintWorklet.h"
14 #include "modules/csspaint/PaintWorkletGlobalScope.h" 15 #include "modules/csspaint/PaintWorkletGlobalScope.h"
15 #include "modules/csspaint/PaintWorkletGlobalScopeProxy.h" 16 #include "modules/csspaint/PaintWorkletGlobalScopeProxy.h"
16 #include "modules/csspaint/WindowPaintWorklet.h"
17 #include "testing/gtest/include/gtest/gtest.h" 17 #include "testing/gtest/include/gtest/gtest.h"
18 18
19 namespace blink { 19 namespace blink {
20 20
21 class PaintWorkletTest : public testing::Test { 21 class PaintWorkletTest : public testing::Test {
22 public: 22 public:
23 PaintWorkletTest() : page_(DummyPageHolder::Create()) {} 23 PaintWorkletTest() : page_(DummyPageHolder::Create()) {}
24 24
25 void SetUp() override { proxy_ = GetPaintWorklet()->CreateGlobalScope(); } 25 void SetUp() override { proxy_ = GetPaintWorklet()->CreateGlobalScope(); }
26 26
27 PaintWorklet* GetPaintWorklet() { 27 PaintWorklet* GetPaintWorklet() {
28 return WindowPaintWorklet::From(*page_->GetFrame().DomWindow()) 28 return CSSPaintWorklet::paintWorklet(page_->GetDocument());
29 .paintWorklet();
30 } 29 }
31 30
32 PaintWorkletGlobalScopeProxy* GetProxy() { 31 PaintWorkletGlobalScopeProxy* GetProxy() {
33 return PaintWorkletGlobalScopeProxy::From(proxy_.get()); 32 return PaintWorkletGlobalScopeProxy::From(proxy_.get());
34 } 33 }
35 34
36 void Terminate() { 35 void Terminate() {
37 page_.reset(); 36 page_.reset();
38 proxy_->TerminateWorkletGlobalScope(); 37 proxy_->TerminateWorkletGlobalScope();
39 proxy_.reset(); 38 proxy_.reset();
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 // Delete the page & associated objects. 73 // Delete the page & associated objects.
75 Terminate(); 74 Terminate();
76 75
77 // Run a GC, the persistent should have been collected. 76 // Run a GC, the persistent should have been collected.
78 ThreadState::Current()->CollectAllGarbage(); 77 ThreadState::Current()->CollectAllGarbage();
79 V8GCController::CollectAllGarbageForTesting(isolate); 78 V8GCController::CollectAllGarbageForTesting(isolate);
80 DCHECK(handle.IsEmpty()); 79 DCHECK(handle.IsEmpty());
81 } 80 }
82 81
83 } // namespace blink 82 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698