summaryrefslogtreecommitdiffstats
path: root/base/task_unittest.cc
diff options
context:
space:
mode:
Diffstat (limited to 'base/task_unittest.cc')
-rw-r--r--base/task_unittest.cc43
1 files changed, 1 insertions, 42 deletions
diff --git a/base/task_unittest.cc b/base/task_unittest.cc
index f192415..956e77f 100644
--- a/base/task_unittest.cc
+++ b/base/task_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -9,47 +9,6 @@
namespace {
-class CancelInDestructor : public base::RefCounted<CancelInDestructor> {
- public:
- CancelInDestructor() : cancelable_task_(NULL) {}
-
- void Start() {
- if (cancelable_task_) {
- ADD_FAILURE();
- return;
- }
- AddRef();
- cancelable_task_ = NewRunnableMethod(
- this, &CancelInDestructor::NeverIssuedCallback);
- Release();
- }
-
- CancelableTask* cancelable_task() {
- return cancelable_task_;
- }
-
- private:
- friend class base::RefCounted<CancelInDestructor>;
-
- ~CancelInDestructor() {
- if (cancelable_task_)
- cancelable_task_->Cancel();
- }
-
- void NeverIssuedCallback() { NOTREACHED(); }
-
- CancelableTask* cancelable_task_;
-};
-
-TEST(TaskTest, TestCancelInDestructor) {
- // Intentionally not using a scoped_refptr for cancel_in_destructor.
- CancelInDestructor* cancel_in_destructor = new CancelInDestructor();
- cancel_in_destructor->Start();
- CancelableTask* cancelable_task = cancel_in_destructor->cancelable_task();
- ASSERT_TRUE(cancelable_task);
- delete cancelable_task;
-}
-
class DoneTask : public Task {
public:
DoneTask(int* run_count, bool* was_deleted)