Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(754)

Unified Diff: base/memory/weak_ptr_unittest.cc

Issue 1602443003: Improve GetWeakPtr() to better protect against unsafe usage patterns. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/memory/weak_ptr.cc ('k') | base/observer_list.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/memory/weak_ptr_unittest.cc
diff --git a/base/memory/weak_ptr_unittest.cc b/base/memory/weak_ptr_unittest.cc
index 1a4870eab184e39f80fa2dd3d2b7abb797d61ab3..3584333ef57096e549653c8b1171f8bf4e21b31d 100644
--- a/base/memory/weak_ptr_unittest.cc
+++ b/base/memory/weak_ptr_unittest.cc
@@ -416,34 +416,6 @@ TEST(WeakPtrTest, MoveOwnershipImplicitly) {
background.DeleteArrow(arrow);
}
-TEST(WeakPtrTest, MoveOwnershipOfUnreferencedObject) {
- BackgroundThread background;
- background.Start();
-
- Arrow* arrow;
- {
- Target target;
- // Background thread creates WeakPtr.
- background.CreateArrowFromTarget(&arrow, &target);
-
- // Bind to background thread.
- EXPECT_EQ(&target, background.DeRef(arrow));
-
- // Release the only WeakPtr.
- arrow->target.reset();
-
- // Now we should be able to create a new reference from this thread.
- arrow->target = target.AsWeakPtr();
-
- // Re-bind to main thread.
- EXPECT_EQ(&target, arrow->target.get());
-
- // And the main thread can now delete the target.
- }
-
- delete arrow;
-}
-
TEST(WeakPtrTest, MoveOwnershipAfterInvalidate) {
BackgroundThread background;
background.Start();
« no previous file with comments | « base/memory/weak_ptr.cc ('k') | base/observer_list.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698