| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "platform/scheduler/CancellableTaskFactory.h" | 5 #include "platform/scheduler/CancellableTaskFactory.h" |
| 6 | 6 |
| 7 #include "platform/heap/Handle.h" | 7 #include "platform/heap/Handle.h" |
| 8 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
| 9 #include "wtf/PtrUtil.h" | 9 #include "wtf/PtrUtil.h" |
| 10 #include <memory> | 10 #include <memory> |
| 11 | 11 |
| 12 namespace blink { | 12 namespace blink { |
| 13 | 13 |
| 14 namespace { | 14 namespace { |
| 15 | 15 |
| 16 class TestCancellableTaskFactory final : public CancellableTaskFactory { | 16 class TestCancellableTaskFactory final : public CancellableTaskFactory { |
| 17 public: | 17 public: |
| 18 explicit TestCancellableTaskFactory(std::unique_ptr<SameThreadClosure> closu
re) | 18 explicit TestCancellableTaskFactory(std::unique_ptr<WTF::Closure> closure) |
| 19 : CancellableTaskFactory(std::move(closure)) | 19 : CancellableTaskFactory(std::move(closure)) |
| 20 { | 20 { |
| 21 } | 21 } |
| 22 }; | 22 }; |
| 23 | 23 |
| 24 } // namespace | 24 } // namespace |
| 25 | 25 |
| 26 using CancellableTaskFactoryTest = testing::Test; | 26 using CancellableTaskFactoryTest = testing::Test; |
| 27 | 27 |
| 28 TEST_F(CancellableTaskFactoryTest, IsPending_TaskNotCreated) | 28 TEST_F(CancellableTaskFactoryTest, IsPending_TaskNotCreated) |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 220 task->run(); | 220 task->run(); |
| 221 // The owning object will have been GCed and the task will have | 221 // The owning object will have been GCed and the task will have |
| 222 // lost its weak reference. Verify that it wasn't invoked. | 222 // lost its weak reference. Verify that it wasn't invoked. |
| 223 EXPECT_EQ(0, GCObject::s_invoked); | 223 EXPECT_EQ(0, GCObject::s_invoked); |
| 224 | 224 |
| 225 // ..and just to make sure |object| was indeed destructed. | 225 // ..and just to make sure |object| was indeed destructed. |
| 226 EXPECT_EQ(1, GCObject::s_destructed); | 226 EXPECT_EQ(1, GCObject::s_destructed); |
| 227 } | 227 } |
| 228 | 228 |
| 229 } // namespace blink | 229 } // namespace blink |
| OLD | NEW |