Chromium Code Reviews| 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 5649878057a15ec055db82f540ed9f2a6ddb9f3c..09b08e353be302810db8d835718d34cb1936aa70 100644 |
| --- a/third_party/WebKit/Source/modules/csspaint/PaintWorkletTest.cpp |
| +++ b/third_party/WebKit/Source/modules/csspaint/PaintWorkletTest.cpp |
| @@ -7,11 +7,13 @@ |
| #include "bindings/core/v8/ScriptSourceCode.h" |
| #include "bindings/core/v8/V8GCController.h" |
| #include "bindings/core/v8/WorkerOrWorkletScriptController.h" |
| +#include "core/css/CSSSyntaxDescriptor.h" |
| #include "core/frame/LocalFrame.h" |
| #include "core/testing/DummyPageHolder.h" |
| #include "modules/csspaint/CSSPaintDefinition.h" |
| #include "modules/csspaint/PaintWorkletGlobalScope.h" |
| #include "modules/csspaint/WindowPaintWorklet.h" |
| +#include "testing/gmock/include/gmock/gmock.h" |
|
ikilpatrick
2017/01/12 05:36:04
not needed?
renjieliu1
2017/01/13 04:18:23
'EXPECT_THAT' is actually from gmock.h
|
| #include "testing/gtest/include/gtest/gtest.h" |
| #include <memory> |
| @@ -67,4 +69,27 @@ TEST_F(PaintWorkletTest, GarbageCollectionOfCSSPaintDefinition) { |
| ASSERT(handle.isEmpty()); |
| } |
| +TEST_F(PaintWorkletTest, CSSPaintInputArgumentsParsing) { |
| + PaintWorkletGlobalScope* globalScope = |
| + paintWorklet()->workletGlobalScopeProxy(); |
| + globalScope->scriptController()->evaluate(ScriptSourceCode( |
| + "registerPaint('arguments', class {" |
| + "static get inputArguments(){return ['<length>'];} paint() { } });")); |
| + |
| + CSSPaintDefinition* definition = globalScope->findDefinition("arguments"); |
| + DCHECK(definition); |
| + EXPECT_THAT(definition->inputArgumentTypes().size(), 1); |
| +} |
| + |
| +TEST_F(PaintWorkletTest, CSSPaintInputArgumentsNoArguments) { |
| + PaintWorkletGlobalScope* globalScope = |
| + paintWorklet()->workletGlobalScopeProxy(); |
| + globalScope->scriptController()->evaluate( |
| + ScriptSourceCode("registerPaint('noArguments', class { paint() { } });")); |
| + |
| + CSSPaintDefinition* definition = globalScope->findDefinition("noArguments"); |
| + DCHECK(definition); |
| + EXPECT_THAT(definition->inputArgumentTypes().size(), 0); |
| +} |
|
ikilpatrick
2017/01/12 05:36:04
instead of these tests, can you write LayoutTests
renjieliu1
2017/01/13 04:18:23
Thank you! layout test added!:)
|
| + |
| } // naespace blink |