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

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

Issue 16226028: Fix even more remaining uses of WeakPtr<T>'s operator T* conversion (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 6 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 | « no previous file | chrome/browser/extensions/extension_action_unittest.cc » ('j') | 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/memory/weak_ptr.h" 5 #include "base/memory/weak_ptr.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 WeakPtrFactory<int> factory(&data); 182 WeakPtrFactory<int> factory(&data);
183 WeakPtr<int> ptr = factory.GetWeakPtr(); 183 WeakPtr<int> ptr = factory.GetWeakPtr();
184 EXPECT_EQ(&data, ptr.get()); 184 EXPECT_EQ(&data, ptr.get());
185 } 185 }
186 186
187 TEST(WeakPtrFactoryTest, Comparison) { 187 TEST(WeakPtrFactoryTest, Comparison) {
188 int data; 188 int data;
189 WeakPtrFactory<int> factory(&data); 189 WeakPtrFactory<int> factory(&data);
190 WeakPtr<int> ptr = factory.GetWeakPtr(); 190 WeakPtr<int> ptr = factory.GetWeakPtr();
191 WeakPtr<int> ptr2 = ptr; 191 WeakPtr<int> ptr2 = ptr;
192 EXPECT_EQ(ptr, ptr2); 192 EXPECT_EQ(ptr.get(), ptr2.get());
193 } 193 }
194 194
195 TEST(WeakPtrFactoryTest, OutOfScope) { 195 TEST(WeakPtrFactoryTest, OutOfScope) {
196 WeakPtr<int> ptr; 196 WeakPtr<int> ptr;
197 EXPECT_EQ(NULL, ptr.get()); 197 EXPECT_EQ(NULL, ptr.get());
198 { 198 {
199 int data; 199 int data;
200 WeakPtrFactory<int> factory(&data); 200 WeakPtrFactory<int> factory(&data);
201 ptr = factory.GetWeakPtr(); 201 ptr = factory.GetWeakPtr();
202 } 202 }
(...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after
579 background.Start(); 579 background.Start();
580 background.DeleteTarget(target.release()); 580 background.DeleteTarget(target.release());
581 581
582 // Main thread attempts to dereference the target, violating thread binding. 582 // Main thread attempts to dereference the target, violating thread binding.
583 ASSERT_DEATH(arrow.target.get(), ""); 583 ASSERT_DEATH(arrow.target.get(), "");
584 } 584 }
585 585
586 #endif 586 #endif
587 587
588 } // namespace base 588 } // namespace base
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/extension_action_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698