Index: base/memory/weak_ptr_unittest.cc |
diff --git a/base/memory/weak_ptr_unittest.cc b/base/memory/weak_ptr_unittest.cc |
index 0a2724cb09ee9430b89b231a69372bd6e01e3a20..4a0ab9a451c932cfee0d102a7db5120c35630673 100644 |
--- a/base/memory/weak_ptr_unittest.cc |
+++ b/base/memory/weak_ptr_unittest.cc |
@@ -432,48 +432,44 @@ TEST(WeakPtrTest, OwnerThreadDeletesObject) { |
background.DeleteArrow(arrow_copy); |
} |
-TEST(WeakPtrTest, NonOwnerThreadCanCopyAndAssignWeakPtr) { |
+TEST(WeakPtrTest, NonOwnerThreadCanDeleteWeakPtr) { |
// Main thread creates a Target object. |
Target target; |
// Main thread creates an arrow referencing the Target. |
- Arrow *arrow; |
- { |
- ANNOTATE_SCOPED_MEMORY_LEAK; |
- arrow = new Arrow(); |
- arrow->target = target.AsWeakPtr(); |
- } |
- // Background can copy and assign arrow (as well as the WeakPtr inside). |
+ Arrow* arrow = new Arrow(); |
+ arrow->target = target.AsWeakPtr(); |
+ |
+ // Background can delete arrow (as well as the WeakPtr inside). |
BackgroundThread background; |
background.Start(); |
- background.CopyAndAssignArrow(arrow); |
+ background.DeleteArrow(arrow); |
} |
-TEST(WeakPtrTest, NonOwnerThreadCanCopyAndAssignWeakPtrBase) { |
+TEST(WeakPtrTest, NonOwnerThreadCanCopyAndAssignWeakPtr) { |
jar (doing other things)
2013/06/10 03:32:41
Why did you move the two test methods down (below
akalin
2013/06/10 17:58:21
I think that's the logical order of the tests, sin
|
// Main thread creates a Target object. |
Target target; |
// Main thread creates an arrow referencing the Target. |
- Arrow *arrow; |
- { |
- ANNOTATE_SCOPED_MEMORY_LEAK; |
- arrow = new Arrow(); |
- arrow->target = target.AsWeakPtr(); |
- } |
- // Background can copy and assign arrow's WeakPtr to a base class WeakPtr. |
+ Arrow *arrow = new Arrow(); |
+ arrow->target = target.AsWeakPtr(); |
+ |
+ // Background can copy and assign arrow (as well as the WeakPtr inside). |
BackgroundThread background; |
background.Start(); |
- background.CopyAndAssignArrowBase(arrow); |
+ background.CopyAndAssignArrow(arrow); |
+ background.DeleteArrow(arrow); |
} |
-TEST(WeakPtrTest, NonOwnerThreadCanDeleteWeakPtr) { |
+TEST(WeakPtrTest, NonOwnerThreadCanCopyAndAssignWeakPtrBase) { |
// Main thread creates a Target object. |
Target target; |
// Main thread creates an arrow referencing the Target. |
- Arrow* arrow = new Arrow(); |
+ Arrow *arrow = new Arrow(); |
arrow->target = target.AsWeakPtr(); |
- // Background can delete arrow (as well as the WeakPtr inside). |
+ // Background can copy and assign arrow's WeakPtr to a base class WeakPtr. |
BackgroundThread background; |
background.Start(); |
+ background.CopyAndAssignArrowBase(arrow); |
background.DeleteArrow(arrow); |
} |