Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(66)

Side by Side Diff: third_party/WebKit/Source/core/dom/custom/CustomElementsRegistryTest.cpp

Issue 2035623002: Implement the script parts of custom element upgrade steps. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@ce-upgrade-in-document-dom-merge2
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "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/ElementRegistrationOptions.h" 10 #include "core/dom/ElementRegistrationOptions.h"
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 } 229 }
230 230
231 ~TestCustomElementDefinition() override = default; 231 ~TestCustomElementDefinition() override = default;
232 232
233 bool runConstructor(Element* element) override 233 bool runConstructor(Element* element) override
234 { 234 {
235 if (constructionStack().isEmpty() 235 if (constructionStack().isEmpty()
236 || constructionStack().last() != element) 236 || constructionStack().last() != element)
237 return false; 237 return false;
238 constructionStack().last().clear(); 238 constructionStack().last().clear();
239 element->setCustomElementState(CustomElementState::Custom);
239 return true; 240 return true;
240 } 241 }
241 }; 242 };
242 243
243 // Classes which use trace macros cannot be local because of the 244 // Classes which use trace macros cannot be local because of the
244 // traceImpl template. 245 // traceImpl template.
245 class LogUpgradeDefinition : public TestCustomElementDefinition { 246 class LogUpgradeDefinition : public TestCustomElementDefinition {
246 WTF_MAKE_NONCOPYABLE(LogUpgradeDefinition); 247 WTF_MAKE_NONCOPYABLE(LogUpgradeDefinition);
247 public: 248 public:
248 LogUpgradeDefinition(const CustomElementDescriptor& descriptor) 249 LogUpgradeDefinition(const CustomElementDescriptor& descriptor)
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 EXPECT_EQ(1u, definition->m_invocationCount) 304 EXPECT_EQ(1u, definition->m_invocationCount)
304 << "defining the element should have 'upgraded' the existing element"; 305 << "defining the element should have 'upgraded' the existing element";
305 EXPECT_EQ(element, definition->m_element) 306 EXPECT_EQ(element, definition->m_element)
306 << "the existing a-a element should have been upgraded"; 307 << "the existing a-a element should have been upgraded";
307 } 308 }
308 309
309 // TODO(dominicc): Add tests which adjust the "is" attribute when type 310 // TODO(dominicc): Add tests which adjust the "is" attribute when type
310 // extensions are implemented. 311 // extensions are implemented.
311 312
312 } // namespace blink 313 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698