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

Side by Side Diff: base/memory/weak_ptr_unittest.cc

Issue 9452021: Fix weak_ptr's operator* implementation. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 10 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « base/memory/weak_ptr.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/bind.h" 5 #include "base/bind.h"
6 #include "base/memory/scoped_ptr.h" 6 #include "base/memory/scoped_ptr.h"
7 #include "base/memory/weak_ptr.h" 7 #include "base/memory/weak_ptr.h"
8 #include "testing/gtest/include/gtest/gtest.h" 8 #include "testing/gtest/include/gtest/gtest.h"
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "base/synchronization/waitable_event.h" 10 #include "base/synchronization/waitable_event.h"
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after
328 { 328 {
329 Producer producer; 329 Producer producer;
330 Consumer consumer; 330 Consumer consumer;
331 consumer.producer = producer.AsWeakPtr(); 331 consumer.producer = producer.AsWeakPtr();
332 thread.CreateConsumerFromConsumer(&consumer_copy, &consumer); 332 thread.CreateConsumerFromConsumer(&consumer_copy, &consumer);
333 } 333 }
334 EXPECT_TRUE(consumer_copy->producer == NULL); 334 EXPECT_TRUE(consumer_copy->producer == NULL);
335 thread.DeleteConsumer(consumer_copy); 335 thread.DeleteConsumer(consumer_copy);
336 } 336 }
337 337
338 TEST(WeakPtrTest, Dereference) {
339 Base data;
340 WeakPtrFactory<Base> factory(&data);
341 WeakPtr<Base> ptr = factory.GetWeakPtr();
342 EXPECT_EQ(&data, ptr.get());
343 EXPECT_EQ(&data, *ptr);
344 }
345
338 } // namespace base 346 } // namespace base
OLDNEW
« no previous file with comments | « base/memory/weak_ptr.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698