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