diff options
Diffstat (limited to 'chromium/third_party/blink/renderer/core/html/custom/custom_element_reaction_queue_test.cc')
-rw-r--r-- | chromium/third_party/blink/renderer/core/html/custom/custom_element_reaction_queue_test.cc | 80 |
1 files changed, 35 insertions, 45 deletions
diff --git a/chromium/third_party/blink/renderer/core/html/custom/custom_element_reaction_queue_test.cc b/chromium/third_party/blink/renderer/core/html/custom/custom_element_reaction_queue_test.cc index 4f3c7506adf..7703104e3e7 100644 --- a/chromium/third_party/blink/renderer/core/html/custom/custom_element_reaction_queue_test.cc +++ b/chromium/third_party/blink/renderer/core/html/custom/custom_element_reaction_queue_test.cc @@ -18,10 +18,9 @@ TEST(CustomElementReactionQueueTest, invokeReactions_one) { Vector<char> log; CustomElementReactionQueue* queue = MakeGarbageCollected<CustomElementReactionQueue>(); - HeapVector<Member<Command>>* commands = - MakeGarbageCollected<HeapVector<Member<Command>>>(); - commands->push_back(MakeGarbageCollected<Log>('a', log)); - queue->Add(*MakeGarbageCollected<TestReaction>(commands)); + HeapVector<Member<Command>> commands; + commands.push_back(MakeGarbageCollected<Log>('a', log)); + queue->Add(*MakeGarbageCollected<TestReaction>(std::move(commands))); Element* test_element = CreateElement(AtomicString("my-element")); queue->InvokeReactions(*test_element); EXPECT_EQ(log, Vector<char>({'a'})) @@ -33,22 +32,19 @@ TEST(CustomElementReactionQueueTest, invokeReactions_many) { CustomElementReactionQueue* queue = MakeGarbageCollected<CustomElementReactionQueue>(); { - HeapVector<Member<Command>>* commands = - MakeGarbageCollected<HeapVector<Member<Command>>>(); - commands->push_back(MakeGarbageCollected<Log>('a', log)); - queue->Add(*MakeGarbageCollected<TestReaction>(commands)); + HeapVector<Member<Command>> commands; + commands.push_back(MakeGarbageCollected<Log>('a', log)); + queue->Add(*MakeGarbageCollected<TestReaction>(std::move(commands))); } { - HeapVector<Member<Command>>* commands = - MakeGarbageCollected<HeapVector<Member<Command>>>(); - commands->push_back(MakeGarbageCollected<Log>('b', log)); - queue->Add(*MakeGarbageCollected<TestReaction>(commands)); + HeapVector<Member<Command>> commands; + commands.push_back(MakeGarbageCollected<Log>('b', log)); + queue->Add(*MakeGarbageCollected<TestReaction>(std::move(commands))); } { - HeapVector<Member<Command>>* commands = - MakeGarbageCollected<HeapVector<Member<Command>>>(); - commands->push_back(MakeGarbageCollected<Log>('c', log)); - queue->Add(*MakeGarbageCollected<TestReaction>(commands)); + HeapVector<Member<Command>> commands; + commands.push_back(MakeGarbageCollected<Log>('c', log)); + queue->Add(*MakeGarbageCollected<TestReaction>(std::move(commands))); } Element* test_element = CreateElement(AtomicString("my-element")); queue->InvokeReactions(*test_element); @@ -61,27 +57,24 @@ TEST(CustomElementReactionQueueTest, invokeReactions_recursive) { CustomElementReactionQueue* queue = MakeGarbageCollected<CustomElementReactionQueue>(); - HeapVector<Member<Command>>* third_commands = - MakeGarbageCollected<HeapVector<Member<Command>>>(); - third_commands->push_back(MakeGarbageCollected<Log>('c', log)); - third_commands->push_back(MakeGarbageCollected<Recurse>(queue)); - CustomElementReaction* third = - MakeGarbageCollected<TestReaction>(third_commands); // "Empty" recursion + HeapVector<Member<Command>> third_commands; + third_commands.push_back(MakeGarbageCollected<Log>('c', log)); + third_commands.push_back(MakeGarbageCollected<Recurse>(queue)); + CustomElementReaction* third = MakeGarbageCollected<TestReaction>( + std::move(third_commands)); // "Empty" recursion - HeapVector<Member<Command>>* second_commands = - MakeGarbageCollected<HeapVector<Member<Command>>>(); - second_commands->push_back(MakeGarbageCollected<Log>('b', log)); - second_commands->push_back(MakeGarbageCollected<Enqueue>(queue, third)); + HeapVector<Member<Command>> second_commands; + second_commands.push_back(MakeGarbageCollected<Log>('b', log)); + second_commands.push_back(MakeGarbageCollected<Enqueue>(queue, third)); CustomElementReaction* second = MakeGarbageCollected<TestReaction>( - second_commands); // Unwinds one level of recursion + std::move(second_commands)); // Unwinds one level of recursion - HeapVector<Member<Command>>* first_commands = - MakeGarbageCollected<HeapVector<Member<Command>>>(); - first_commands->push_back(MakeGarbageCollected<Log>('a', log)); - first_commands->push_back(MakeGarbageCollected<Enqueue>(queue, second)); - first_commands->push_back(MakeGarbageCollected<Recurse>(queue)); + HeapVector<Member<Command>> first_commands; + first_commands.push_back(MakeGarbageCollected<Log>('a', log)); + first_commands.push_back(MakeGarbageCollected<Enqueue>(queue, second)); + first_commands.push_back(MakeGarbageCollected<Recurse>(queue)); CustomElementReaction* first = MakeGarbageCollected<TestReaction>( - first_commands); // Non-empty recursion + std::move(first_commands)); // Non-empty recursion queue->Add(*first); Element* test_element = CreateElement(AtomicString("my-element")); @@ -96,24 +89,21 @@ TEST(CustomElementReactionQueueTest, clear_duringInvoke) { MakeGarbageCollected<CustomElementReactionQueue>(); { - HeapVector<Member<Command>>* commands = - MakeGarbageCollected<HeapVector<Member<Command>>>(); - commands->push_back(MakeGarbageCollected<Log>('a', log)); - queue->Add(*MakeGarbageCollected<TestReaction>(commands)); + HeapVector<Member<Command>> commands; + commands.push_back(MakeGarbageCollected<Log>('a', log)); + queue->Add(*MakeGarbageCollected<TestReaction>(std::move(commands))); } { - HeapVector<Member<Command>>* commands = - MakeGarbageCollected<HeapVector<Member<Command>>>(); - commands->push_back(MakeGarbageCollected<Call>(WTF::Bind( + HeapVector<Member<Command>> commands; + commands.push_back(MakeGarbageCollected<Call>(WTF::Bind( [](CustomElementReactionQueue* queue, Element&) { queue->Clear(); }, WrapPersistent(queue)))); - queue->Add(*MakeGarbageCollected<TestReaction>(commands)); + queue->Add(*MakeGarbageCollected<TestReaction>(std::move(commands))); } { - HeapVector<Member<Command>>* commands = - MakeGarbageCollected<HeapVector<Member<Command>>>(); - commands->push_back(MakeGarbageCollected<Log>('b', log)); - queue->Add(*MakeGarbageCollected<TestReaction>(commands)); + HeapVector<Member<Command>> commands; + commands.push_back(MakeGarbageCollected<Log>('b', log)); + queue->Add(*MakeGarbageCollected<TestReaction>(std::move(commands))); } Element* test_element = CreateElement(AtomicString("my-element")); |