| OLD | NEW |
| 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 "core/dom/custom/CustomElementRegistry.h" | 5 #include "core/dom/custom/CustomElementRegistry.h" |
| 6 | 6 |
| 7 #include "bindings/core/v8/ExceptionState.h" | 7 #include "bindings/core/v8/ExceptionState.h" |
| 8 #include "core/dom/Document.h" | 8 #include "core/dom/Document.h" |
| 9 #include "core/dom/Element.h" | 9 #include "core/dom/Element.h" |
| 10 #include "core/dom/ElementDefinitionOptions.h" | 10 #include "core/dom/ElementDefinitionOptions.h" |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 } | 212 } |
| 213 }; | 213 }; |
| 214 HeapVector<Member<Adopted>> m_adopted; | 214 HeapVector<Member<Adopted>> m_adopted; |
| 215 | 215 |
| 216 void clear() { | 216 void clear() { |
| 217 m_logs.clear(); | 217 m_logs.clear(); |
| 218 m_attributeChanged.clear(); | 218 m_attributeChanged.clear(); |
| 219 } | 219 } |
| 220 | 220 |
| 221 bool runConstructor(Element* element) override { | 221 bool runConstructor(Element* element) override { |
| 222 m_logs.append(Constructor); | 222 m_logs.push_back(Constructor); |
| 223 m_element = element; | 223 m_element = element; |
| 224 return TestCustomElementDefinition::runConstructor(element); | 224 return TestCustomElementDefinition::runConstructor(element); |
| 225 } | 225 } |
| 226 | 226 |
| 227 bool hasConnectedCallback() const override { return true; } | 227 bool hasConnectedCallback() const override { return true; } |
| 228 bool hasDisconnectedCallback() const override { return true; } | 228 bool hasDisconnectedCallback() const override { return true; } |
| 229 bool hasAdoptedCallback() const override { return true; } | 229 bool hasAdoptedCallback() const override { return true; } |
| 230 | 230 |
| 231 void runConnectedCallback(Element* element) override { | 231 void runConnectedCallback(Element* element) override { |
| 232 m_logs.append(ConnectedCallback); | 232 m_logs.push_back(ConnectedCallback); |
| 233 EXPECT_EQ(element, m_element); | 233 EXPECT_EQ(element, m_element); |
| 234 } | 234 } |
| 235 | 235 |
| 236 void runDisconnectedCallback(Element* element) override { | 236 void runDisconnectedCallback(Element* element) override { |
| 237 m_logs.append(DisconnectedCallback); | 237 m_logs.push_back(DisconnectedCallback); |
| 238 EXPECT_EQ(element, m_element); | 238 EXPECT_EQ(element, m_element); |
| 239 } | 239 } |
| 240 | 240 |
| 241 void runAdoptedCallback(Element* element, | 241 void runAdoptedCallback(Element* element, |
| 242 Document* oldOwner, | 242 Document* oldOwner, |
| 243 Document* newOwner) override { | 243 Document* newOwner) override { |
| 244 m_logs.append(AdoptedCallback); | 244 m_logs.push_back(AdoptedCallback); |
| 245 EXPECT_EQ(element, m_element); | 245 EXPECT_EQ(element, m_element); |
| 246 m_adopted.append(new Adopted(oldOwner, newOwner)); | 246 m_adopted.push_back(new Adopted(oldOwner, newOwner)); |
| 247 } | 247 } |
| 248 | 248 |
| 249 void runAttributeChangedCallback(Element* element, | 249 void runAttributeChangedCallback(Element* element, |
| 250 const QualifiedName& name, | 250 const QualifiedName& name, |
| 251 const AtomicString& oldValue, | 251 const AtomicString& oldValue, |
| 252 const AtomicString& newValue) override { | 252 const AtomicString& newValue) override { |
| 253 m_logs.append(AttributeChangedCallback); | 253 m_logs.push_back(AttributeChangedCallback); |
| 254 EXPECT_EQ(element, m_element); | 254 EXPECT_EQ(element, m_element); |
| 255 m_attributeChanged.append(AttributeChanged{name, oldValue, newValue}); | 255 m_attributeChanged.push_back(AttributeChanged{name, oldValue, newValue}); |
| 256 } | 256 } |
| 257 }; | 257 }; |
| 258 | 258 |
| 259 class LogUpgradeBuilder final : public TestCustomElementDefinitionBuilder { | 259 class LogUpgradeBuilder final : public TestCustomElementDefinitionBuilder { |
| 260 STACK_ALLOCATED(); | 260 STACK_ALLOCATED(); |
| 261 WTF_MAKE_NONCOPYABLE(LogUpgradeBuilder); | 261 WTF_MAKE_NONCOPYABLE(LogUpgradeBuilder); |
| 262 | 262 |
| 263 public: | 263 public: |
| 264 LogUpgradeBuilder() {} | 264 LogUpgradeBuilder() {} |
| 265 | 265 |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 438 EXPECT_EQ(definitionB, definition); | 438 EXPECT_EQ(definitionB, definition); |
| 439 // look up undefined customized built-in element | 439 // look up undefined customized built-in element |
| 440 definition = registry().definitionFor(CustomElementDescriptor("a-a", "div")); | 440 definition = registry().definitionFor(CustomElementDescriptor("a-a", "div")); |
| 441 EXPECT_EQ(nullptr, definition) << "a-a, div should not be registered"; | 441 EXPECT_EQ(nullptr, definition) << "a-a, div should not be registered"; |
| 442 } | 442 } |
| 443 | 443 |
| 444 // TODO(dominicc): Add tests which adjust the "is" attribute when type | 444 // TODO(dominicc): Add tests which adjust the "is" attribute when type |
| 445 // extensions are implemented. | 445 // extensions are implemented. |
| 446 | 446 |
| 447 } // namespace blink | 447 } // namespace blink |
| OLD | NEW |