| 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" |
| 11 #include "core/dom/ElementRegistrationOptions.h" | 11 #include "core/dom/ElementRegistrationOptions.h" |
| 12 #include "core/dom/custom/CEReactionsScope.h" |
| 12 #include "core/dom/custom/CustomElementDefinition.h" | 13 #include "core/dom/custom/CustomElementDefinition.h" |
| 13 #include "core/dom/custom/CustomElementDefinitionBuilder.h" | 14 #include "core/dom/custom/CustomElementDefinitionBuilder.h" |
| 14 #include "core/dom/custom/CustomElementDescriptor.h" | 15 #include "core/dom/custom/CustomElementDescriptor.h" |
| 15 #include "core/dom/custom/CustomElementTestHelpers.h" | 16 #include "core/dom/custom/CustomElementTestHelpers.h" |
| 16 #include "core/dom/shadow/ShadowRoot.h" | 17 #include "core/dom/shadow/ShadowRoot.h" |
| 17 #include "core/dom/shadow/ShadowRootInit.h" | 18 #include "core/dom/shadow/ShadowRootInit.h" |
| 18 #include "core/html/HTMLDocument.h" | 19 #include "core/html/HTMLDocument.h" |
| 19 #include "core/testing/DummyPageHolder.h" | 20 #include "core/testing/DummyPageHolder.h" |
| 20 #include "platform/ScriptForbiddenScope.h" | 21 #include "platform/ScriptForbiddenScope.h" |
| 21 #include "platform/heap/Handle.h" | 22 #include "platform/heap/Handle.h" |
| (...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 294 | 295 |
| 295 TEST_F(CustomElementsRegistryFrameTest, define_upgradesInDocumentElements) | 296 TEST_F(CustomElementsRegistryFrameTest, define_upgradesInDocumentElements) |
| 296 { | 297 { |
| 297 ScriptForbiddenScope doNotRelyOnScript; | 298 ScriptForbiddenScope doNotRelyOnScript; |
| 298 | 299 |
| 299 Element* element = CreateElement("a-a").inDocument(&document()); | 300 Element* element = CreateElement("a-a").inDocument(&document()); |
| 300 document().documentElement()->appendChild(element); | 301 document().documentElement()->appendChild(element); |
| 301 | 302 |
| 302 LogUpgradeBuilder builder; | 303 LogUpgradeBuilder builder; |
| 303 NonThrowableExceptionState shouldNotThrow; | 304 NonThrowableExceptionState shouldNotThrow; |
| 304 registry().define( | 305 { |
| 305 "a-a", | 306 CEReactionsScope reactions; |
| 306 builder, | 307 registry().define( |
| 307 ElementRegistrationOptions(), | 308 "a-a", |
| 308 shouldNotThrow); | 309 builder, |
| 310 ElementRegistrationOptions(), |
| 311 shouldNotThrow); |
| 312 } |
| 309 LogUpgradeDefinition* definition = | 313 LogUpgradeDefinition* definition = |
| 310 static_cast<LogUpgradeDefinition*>(registry().definitionForName("a-a")); | 314 static_cast<LogUpgradeDefinition*>(registry().definitionForName("a-a")); |
| 311 EXPECT_EQ(1u, definition->m_invocationCount) | 315 EXPECT_EQ(1u, definition->m_invocationCount) |
| 312 << "defining the element should have 'upgraded' the existing element"; | 316 << "defining the element should have 'upgraded' the existing element"; |
| 313 EXPECT_EQ(element, definition->m_element) | 317 EXPECT_EQ(element, definition->m_element) |
| 314 << "the existing a-a element should have been upgraded"; | 318 << "the existing a-a element should have been upgraded"; |
| 315 } | 319 } |
| 316 | 320 |
| 317 // TODO(dominicc): Add tests which adjust the "is" attribute when type | 321 // TODO(dominicc): Add tests which adjust the "is" attribute when type |
| 318 // extensions are implemented. | 322 // extensions are implemented. |
| 319 | 323 |
| 320 } // namespace blink | 324 } // namespace blink |
| OLD | NEW |