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

Side by Side Diff: base/observer_list_unittest.cc

Issue 16160015: Update base/ to use scoped_refptr<T>::get() rather than implicit "operator T*" (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 | « base/message_pump_libevent_unittest.cc ('k') | base/prefs/json_pref_store_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/observer_list.h" 5 #include "base/observer_list.h"
6 #include "base/observer_list_threadsafe.h" 6 #include "base/observer_list_threadsafe.h"
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after
341 private: 341 private:
342 const scoped_refptr<ObserverListThreadSafe<Foo> > list_; 342 const scoped_refptr<ObserverListThreadSafe<Foo> > list_;
343 std::vector<Foo*> foos_; 343 std::vector<Foo*> foos_;
344 }; 344 };
345 345
346 TEST(ObserverListThreadSafeTest, RemoveMultipleObservers) { 346 TEST(ObserverListThreadSafeTest, RemoveMultipleObservers) {
347 MessageLoop loop; 347 MessageLoop loop;
348 scoped_refptr<ObserverListThreadSafe<Foo> > observer_list( 348 scoped_refptr<ObserverListThreadSafe<Foo> > observer_list(
349 new ObserverListThreadSafe<Foo>); 349 new ObserverListThreadSafe<Foo>);
350 350
351 FooRemover a(observer_list); 351 FooRemover a(observer_list.get());
352 Adder b(1); 352 Adder b(1);
353 353
354 observer_list->AddObserver(&a); 354 observer_list->AddObserver(&a);
355 observer_list->AddObserver(&b); 355 observer_list->AddObserver(&b);
356 356
357 a.AddFooToRemove(&a); 357 a.AddFooToRemove(&a);
358 a.AddFooToRemove(&b); 358 a.AddFooToRemove(&b);
359 359
360 observer_list->Notify(&Foo::Observe, 1); 360 observer_list->Notify(&Foo::Observe, 1);
361 RunLoop().RunUntilIdle(); 361 RunLoop().RunUntilIdle();
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
540 ListDestructor a(observer_list); 540 ListDestructor a(observer_list);
541 observer_list->AddObserver(&a); 541 observer_list->AddObserver(&a);
542 542
543 FOR_EACH_OBSERVER(Foo, *observer_list, Observe(0)); 543 FOR_EACH_OBSERVER(Foo, *observer_list, Observe(0));
544 // If this test fails, there'll be Valgrind errors when this function goes out 544 // If this test fails, there'll be Valgrind errors when this function goes out
545 // of scope. 545 // of scope.
546 } 546 }
547 547
548 } // namespace 548 } // namespace
549 } // namespace base 549 } // namespace base
OLDNEW
« no previous file with comments | « base/message_pump_libevent_unittest.cc ('k') | base/prefs/json_pref_store_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698