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

Unified 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: input arguments parsing Created 4 years 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
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

Powered by Google App Engine
This is Rietveld 408576698