| 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/CustomElementsRegistry.h" | 5 #include "core/dom/custom/CustomElementsRegistry.h" |
| 6 | 6 |
| 7 #include "bindings/core/v8/ExceptionState.h" | 7 #include "bindings/core/v8/ExceptionState.h" |
| 8 #include "bindings/core/v8/ScriptValue.h" | 8 #include "bindings/core/v8/ScriptValue.h" |
| 9 #include "core/dom/Document.h" | 9 #include "core/dom/Document.h" |
| 10 #include "core/dom/Element.h" | 10 #include "core/dom/Element.h" |
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 250 }; | 250 }; |
| 251 | 251 |
| 252 // Classes which use trace macros cannot be local because of the | 252 // Classes which use trace macros cannot be local because of the |
| 253 // traceImpl template. | 253 // traceImpl template. |
| 254 class LogUpgradeDefinition : public TestCustomElementDefinition { | 254 class LogUpgradeDefinition : public TestCustomElementDefinition { |
| 255 WTF_MAKE_NONCOPYABLE(LogUpgradeDefinition); | 255 WTF_MAKE_NONCOPYABLE(LogUpgradeDefinition); |
| 256 public: | 256 public: |
| 257 LogUpgradeDefinition(const CustomElementDescriptor& descriptor) | 257 LogUpgradeDefinition(const CustomElementDescriptor& descriptor) |
| 258 : TestCustomElementDefinition(descriptor) | 258 : TestCustomElementDefinition(descriptor) |
| 259 { | 259 { |
| 260 m_observedAttributes.add("attr1"); |
| 261 m_observedAttributes.add("attr2"); |
| 262 m_observedAttributes.add(HTMLNames::contenteditableAttr.localName()); |
| 260 } | 263 } |
| 261 | 264 |
| 262 DEFINE_INLINE_VIRTUAL_TRACE() | 265 DEFINE_INLINE_VIRTUAL_TRACE() |
| 263 { | 266 { |
| 264 TestCustomElementDefinition::trace(visitor); | 267 TestCustomElementDefinition::trace(visitor); |
| 265 visitor->trace(m_element); | 268 visitor->trace(m_element); |
| 266 } | 269 } |
| 267 | 270 |
| 268 // TODO(dominicc): Make this class collect a vector of what's | 271 // TODO(dominicc): Make this class collect a vector of what's |
| 269 // upgraded; it will be useful in more tests. | 272 // upgraded; it will be useful in more tests. |
| (...skipping 21 matching lines...) Expand all Loading... |
| 291 | 294 |
| 292 bool runConstructor(Element* element) override | 295 bool runConstructor(Element* element) override |
| 293 { | 296 { |
| 294 m_logs.append(Constructor); | 297 m_logs.append(Constructor); |
| 295 m_element = element; | 298 m_element = element; |
| 296 return TestCustomElementDefinition::runConstructor(element); | 299 return TestCustomElementDefinition::runConstructor(element); |
| 297 } | 300 } |
| 298 | 301 |
| 299 bool hasConnectedCallback() const override { return true; } | 302 bool hasConnectedCallback() const override { return true; } |
| 300 bool hasDisconnectedCallback() const override { return true; } | 303 bool hasDisconnectedCallback() const override { return true; } |
| 301 bool hasAttributeChangedCallback(const QualifiedName&) const override { retu
rn true; } | |
| 302 | 304 |
| 303 void runConnectedCallback(Element* element) override | 305 void runConnectedCallback(Element* element) override |
| 304 { | 306 { |
| 305 m_logs.append(ConnectedCallback); | 307 m_logs.append(ConnectedCallback); |
| 306 EXPECT_EQ(element, m_element); | 308 EXPECT_EQ(element, m_element); |
| 307 } | 309 } |
| 308 | 310 |
| 309 void runDisconnectedCallback(Element* element) override | 311 void runDisconnectedCallback(Element* element) override |
| 310 { | 312 { |
| 311 m_logs.append(DisconnectedCallback); | 313 m_logs.append(DisconnectedCallback); |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 449 << "remove() should invoke disconnectedCallback"; | 451 << "remove() should invoke disconnectedCallback"; |
| 450 | 452 |
| 451 EXPECT_EQ(1u, definition->m_logs.size()) | 453 EXPECT_EQ(1u, definition->m_logs.size()) |
| 452 << "remove() should not invoke other callbacks"; | 454 << "remove() should not invoke other callbacks"; |
| 453 } | 455 } |
| 454 | 456 |
| 455 // TODO(dominicc): Add tests which adjust the "is" attribute when type | 457 // TODO(dominicc): Add tests which adjust the "is" attribute when type |
| 456 // extensions are implemented. | 458 // extensions are implemented. |
| 457 | 459 |
| 458 } // namespace blink | 460 } // namespace blink |
| OLD | NEW |