OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "base/ref_counted.h" | 5 #include "base/memory/ref_counted.h" |
6 #include "base/task.h" | 6 #include "base/task.h" |
7 #include "testing/gtest/include/gtest/gtest.h" | 7 #include "testing/gtest/include/gtest/gtest.h" |
8 | 8 |
9 namespace { | 9 namespace { |
10 | 10 |
11 class CancelInDestructor : public base::RefCounted<CancelInDestructor> { | 11 class CancelInDestructor : public base::RefCounted<CancelInDestructor> { |
12 public: | 12 public: |
13 CancelInDestructor() : cancelable_task_(NULL) {} | 13 CancelInDestructor() : cancelable_task_(NULL) {} |
14 | 14 |
15 void Start() { | 15 void Start() { |
(...skipping 27 matching lines...) Expand all Loading... |
43 TEST(TaskTest, TestCancelInDestructor) { | 43 TEST(TaskTest, TestCancelInDestructor) { |
44 // Intentionally not using a scoped_refptr for cancel_in_destructor. | 44 // Intentionally not using a scoped_refptr for cancel_in_destructor. |
45 CancelInDestructor* cancel_in_destructor = new CancelInDestructor(); | 45 CancelInDestructor* cancel_in_destructor = new CancelInDestructor(); |
46 cancel_in_destructor->Start(); | 46 cancel_in_destructor->Start(); |
47 CancelableTask* cancelable_task = cancel_in_destructor->cancelable_task(); | 47 CancelableTask* cancelable_task = cancel_in_destructor->cancelable_task(); |
48 ASSERT_TRUE(cancelable_task); | 48 ASSERT_TRUE(cancelable_task); |
49 delete cancelable_task; | 49 delete cancelable_task; |
50 } | 50 } |
51 | 51 |
52 } // namespace | 52 } // namespace |
OLD | NEW |