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

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

Issue 2561773003: Parse input argument types and store the argument types in CSSPaintDefinition. (Closed)
Patch Set: Add layout test Created 3 years, 11 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 "bindings/core/v8/ScriptSourceCode.h" 7 #include "bindings/core/v8/ScriptSourceCode.h"
8 #include "bindings/core/v8/V8GCController.h" 8 #include "bindings/core/v8/V8GCController.h"
9 #include "bindings/core/v8/WorkerOrWorkletScriptController.h" 9 #include "bindings/core/v8/WorkerOrWorkletScriptController.h"
10 #include "core/css/CSSSyntaxDescriptor.h"
10 #include "core/frame/LocalFrame.h" 11 #include "core/frame/LocalFrame.h"
11 #include "core/testing/DummyPageHolder.h" 12 #include "core/testing/DummyPageHolder.h"
12 #include "modules/csspaint/CSSPaintDefinition.h" 13 #include "modules/csspaint/CSSPaintDefinition.h"
13 #include "modules/csspaint/PaintWorkletGlobalScope.h" 14 #include "modules/csspaint/PaintWorkletGlobalScope.h"
14 #include "modules/csspaint/WindowPaintWorklet.h" 15 #include "modules/csspaint/WindowPaintWorklet.h"
16 #include "testing/gmock/include/gmock/gmock.h"
ikilpatrick 2017/01/13 18:50:18 oh, just use EXPECT_EQ in gtest.h and remove this
renjieliu1 2017/01/15 05:05:20 Done.
15 #include "testing/gtest/include/gtest/gtest.h" 17 #include "testing/gtest/include/gtest/gtest.h"
16 #include <memory> 18 #include <memory>
17 19
18 namespace blink { 20 namespace blink {
19 21
20 class PaintWorkletTest : public testing::Test { 22 class PaintWorkletTest : public testing::Test {
21 public: 23 public:
22 PaintWorkletTest() : m_page(DummyPageHolder::create()) {} 24 PaintWorkletTest() : m_page(DummyPageHolder::create()) {}
23 25
24 PaintWorklet* paintWorklet() { 26 PaintWorklet* paintWorklet() {
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 62
61 // Delete the page & associated objects. 63 // Delete the page & associated objects.
62 m_page.reset(); 64 m_page.reset();
63 65
64 // Run a GC, the persistent should have been collected. 66 // Run a GC, the persistent should have been collected.
65 ThreadState::current()->collectAllGarbage(); 67 ThreadState::current()->collectAllGarbage();
66 V8GCController::collectAllGarbageForTesting(isolate); 68 V8GCController::collectAllGarbageForTesting(isolate);
67 ASSERT(handle.isEmpty()); 69 ASSERT(handle.isEmpty());
68 } 70 }
69 71
70 } // naespace blink 72 TEST_F(PaintWorkletTest, CSSPaintInputArgumentsParsing) {
73 PaintWorkletGlobalScope* globalScope =
74 paintWorklet()->workletGlobalScopeProxy();
75 globalScope->scriptController()->evaluate(ScriptSourceCode(
76 "registerPaint('arguments', class {"
77 "static get inputArguments(){return ['<length>'];} paint() { } });"));
78
79 CSSPaintDefinition* definition = globalScope->findDefinition("arguments");
80 DCHECK(definition);
81 EXPECT_THAT(definition->inputArgumentTypes().size(), 1);
ikilpatrick 2017/01/13 18:50:18 So these tests doesn't add that much, it would be
renjieliu1 2017/01/15 05:05:20 CSSSyntaxDescriptor hasn't implemented a compare m
82 }
83
84 TEST_F(PaintWorkletTest, CSSPaintInputArgumentsNoArguments) {
85 PaintWorkletGlobalScope* globalScope =
86 paintWorklet()->workletGlobalScopeProxy();
87 globalScope->scriptController()->evaluate(
88 ScriptSourceCode("registerPaint('noArguments', class { paint() { } });"));
89
90 CSSPaintDefinition* definition = globalScope->findDefinition("noArguments");
91 DCHECK(definition);
92 EXPECT_THAT(definition->inputArgumentTypes().size(), 0);
93 }
94
95 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698