| Index: third_party/WebKit/Source/core/dom/custom/CustomElementReactionQueueTest.cpp
|
| diff --git a/third_party/WebKit/Source/core/dom/custom/CustomElementReactionQueueTest.cpp b/third_party/WebKit/Source/core/dom/custom/CustomElementReactionQueueTest.cpp
|
| index 9c3a0b72bfe131f0bb52b0d1c2d15b67321269f0..98f5a49ac9440838e1837d11ad1aac0f7a3b2f5d 100644
|
| --- a/third_party/WebKit/Source/core/dom/custom/CustomElementReactionQueueTest.cpp
|
| +++ b/third_party/WebKit/Source/core/dom/custom/CustomElementReactionQueueTest.cpp
|
| @@ -7,6 +7,7 @@
|
| #include "core/dom/custom/CustomElementReaction.h"
|
| #include "core/dom/custom/CustomElementReactionTestHelpers.h"
|
| #include "testing/gtest/include/gtest/gtest.h"
|
| +#include "wtf/Functional.h"
|
| #include <initializer_list>
|
| #include <vector>
|
|
|
| @@ -53,4 +54,19 @@ TEST(CustomElementReactionQueueTest, invokeReactions_recursive) {
|
| << "the reactions should have been invoked";
|
| }
|
|
|
| +TEST(CustomElementReactionQueueTest, clear_duringInvoke) {
|
| + std::vector<char> log;
|
| + CustomElementReactionQueue* queue = new CustomElementReactionQueue();
|
| +
|
| + queue->add(new TestReaction({new Log('a', log)}));
|
| + queue->add(new TestReaction({new Call(WTF::bind(
|
| + [](CustomElementReactionQueue* queue, Element*) { queue->clear(); },
|
| + wrapPersistent(queue)))}));
|
| + queue->add(new TestReaction({new Log('b', log)}));
|
| +
|
| + queue->invokeReactions(nullptr);
|
| + EXPECT_EQ(log, std::vector<char>({'a'}))
|
| + << "only 'a' should be logged; the second log should have been cleared";
|
| +}
|
| +
|
| } // namespace blink
|
|
|