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

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: 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 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 4c8d400316c78611b419b4ce5e8dcc04b3a6cb79..49c00427f4cd022d477d274484d7a5020a5ca06e 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/13 18:50:18 oh, just use EXPECT_EQ in gtest.h and remove this
renjieliu1 2017/01/15 05:05:20 Done.
#include "testing/gtest/include/gtest/gtest.h"
#include <memory>
@@ -67,4 +69,27 @@ TEST_F(PaintWorkletTest, GarbageCollectionOfCSSPaintDefinition) {
ASSERT(handle.isEmpty());
}
-} // naespace blink
+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);
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
+}
+
+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);
+}
+
+} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698