Chromium Code Reviews| Index: third_party/WebKit/Source/core/dom/custom/CustomElementTest.cpp |
| diff --git a/third_party/WebKit/Source/core/dom/custom/CustomElementTest.cpp b/third_party/WebKit/Source/core/dom/custom/CustomElementTest.cpp |
| index 426340a687a8105babaa1fc3d088f7db4ce3ed96..51b304f9daed5d8e9a9a8bf865c30d6464f94ebf 100644 |
| --- a/third_party/WebKit/Source/core/dom/custom/CustomElementTest.cpp |
| +++ b/third_party/WebKit/Source/core/dom/custom/CustomElementTest.cpp |
| @@ -229,4 +229,39 @@ TEST(CustomElementTest, |
| EXPECT_EQ(definition, element->customElementDefinition()); |
| } |
| +TEST(CustomElementTest, CreateElement_LookupCustomElement) { |
|
dominicc (has gone to gerrit)
2016/10/27 04:33:14
Could we put this in CustomElementRegistryTest? de
|
| + // register a definition |
| + std::unique_ptr<DummyPageHolder> holder(DummyPageHolder::create()); |
| + CustomElementRegistry* registry = |
| + holder->frame().localDOMWindow()->customElements(); |
| + NonThrowableExceptionState shouldNotThrow; |
| + { |
| + CEReactionsScope reactions; |
| + TestCustomElementDefinitionBuilder builder; |
| + registry->define("a-a", builder, ElementDefinitionOptions(), |
| + shouldNotThrow); |
| + ElementDefinitionOptions options; |
| + options.setExtends("div"); |
| + registry->define("b-b", builder, options, shouldNotThrow); |
| + } |
| + CustomElementDefinition* definition = |
| + registry->definitionFor(CustomElementDescriptor("a-a", "a-a")); |
| + // lookup defined autonomous custom element |
|
dominicc (has gone to gerrit)
2016/10/27 04:33:14
lookup -> look up
|
| + EXPECT_NE(nullptr, definition) << "a-a, a-a should be registered"; |
|
dominicc (has gone to gerrit)
2016/10/27 04:33:14
It would be more precise to hang onto the definiti
|
| + EXPECT_EQ(AtomicString("a-a"), definition->descriptor().name()); |
|
dominicc (has gone to gerrit)
2016/10/27 04:33:14
Just use EXPECT_EQ(..., definition->descriptor())
|
| + EXPECT_EQ(AtomicString("a-a"), definition->descriptor().localName()); |
| + // lookup undefined autonomous custom element |
| + definition = registry->definitionFor(CustomElementDescriptor("a-b", "a-b")); |
| + EXPECT_EQ(nullptr, definition) << "a-b, a-b should not be registered"; |
| + // lookup defined customized built-in element |
| + // TODO(yurak): uncomment once the define algorithm is committed |
|
dominicc (has gone to gerrit)
2016/10/27 04:33:14
Maybe just omit this instead of adding commented o
|
| + /*definition = registry->definitionFor(CustomElementDescriptor("b-b", "div")); |
| + EXPECT_NE(nullptr, definition) << "b-b, div should be registered"; |
| + EXPECT_EQ(AtomicString("b-b"), definition->descriptor()->name()); |
| + EXPECT_EQ(AtomicString("div"), definition->descriptor()->localName());*/ |
| + // lookup undefined customized built-in element |
| + definition = registry->definitionFor(CustomElementDescriptor("a-a", "div")); |
| + EXPECT_EQ(nullptr, definition) << "a-a, div should not be registered"; |
| +} |
| + |
| } // namespace blink |