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 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
260 }; | 260 }; |
261 | 261 |
262 // Classes which use trace macros cannot be local because of the | 262 // Classes which use trace macros cannot be local because of the |
263 // traceImpl template. | 263 // traceImpl template. |
264 class LogUpgradeDefinition : public TestCustomElementDefinition { | 264 class LogUpgradeDefinition : public TestCustomElementDefinition { |
265 WTF_MAKE_NONCOPYABLE(LogUpgradeDefinition); | 265 WTF_MAKE_NONCOPYABLE(LogUpgradeDefinition); |
266 public: | 266 public: |
267 LogUpgradeDefinition(const CustomElementDescriptor& descriptor) | 267 LogUpgradeDefinition(const CustomElementDescriptor& descriptor) |
268 : TestCustomElementDefinition(descriptor) | 268 : TestCustomElementDefinition(descriptor) |
269 { | 269 { |
270 m_observedAttributes.add("attr1"); | |
271 m_observedAttributes.add("attr2"); | |
272 m_observedAttributes.add(HTMLNames::contenteditableAttr.localName()); | |
273 } | 270 } |
274 | 271 |
275 DEFINE_INLINE_VIRTUAL_TRACE() | 272 DEFINE_INLINE_VIRTUAL_TRACE() |
276 { | 273 { |
277 TestCustomElementDefinition::trace(visitor); | 274 TestCustomElementDefinition::trace(visitor); |
278 visitor->trace(m_element); | 275 visitor->trace(m_element); |
279 } | 276 } |
280 | 277 |
281 // TODO(dominicc): Make this class collect a vector of what's | 278 // TODO(dominicc): Make this class collect a vector of what's |
282 // upgraded; it will be useful in more tests. | 279 // upgraded; it will be useful in more tests. |
(...skipping 21 matching lines...) Expand all Loading... |
304 | 301 |
305 bool runConstructor(Element* element) override | 302 bool runConstructor(Element* element) override |
306 { | 303 { |
307 m_logs.append(Constructor); | 304 m_logs.append(Constructor); |
308 m_element = element; | 305 m_element = element; |
309 return TestCustomElementDefinition::runConstructor(element); | 306 return TestCustomElementDefinition::runConstructor(element); |
310 } | 307 } |
311 | 308 |
312 bool hasConnectedCallback() const override { return true; } | 309 bool hasConnectedCallback() const override { return true; } |
313 bool hasDisconnectedCallback() const override { return true; } | 310 bool hasDisconnectedCallback() const override { return true; } |
| 311 bool hasAttributeChangedCallback(const QualifiedName&) const override { retu
rn true; } |
314 | 312 |
315 void runConnectedCallback(Element* element) override | 313 void runConnectedCallback(Element* element) override |
316 { | 314 { |
317 m_logs.append(ConnectedCallback); | 315 m_logs.append(ConnectedCallback); |
318 EXPECT_EQ(element, m_element); | 316 EXPECT_EQ(element, m_element); |
319 } | 317 } |
320 | 318 |
321 void runDisconnectedCallback(Element* element) override | 319 void runDisconnectedCallback(Element* element) override |
322 { | 320 { |
323 m_logs.append(DisconnectedCallback); | 321 m_logs.append(DisconnectedCallback); |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
461 << "remove() should invoke disconnectedCallback"; | 459 << "remove() should invoke disconnectedCallback"; |
462 | 460 |
463 EXPECT_EQ(1u, definition->m_logs.size()) | 461 EXPECT_EQ(1u, definition->m_logs.size()) |
464 << "remove() should not invoke other callbacks"; | 462 << "remove() should not invoke other callbacks"; |
465 } | 463 } |
466 | 464 |
467 // TODO(dominicc): Add tests which adjust the "is" attribute when type | 465 // TODO(dominicc): Add tests which adjust the "is" attribute when type |
468 // extensions are implemented. | 466 // extensions are implemented. |
469 | 467 |
470 } // namespace blink | 468 } // namespace blink |
OLD | NEW |