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

Side by Side Diff: base/observer_list_unittest.cc

Issue 2419673003: Remove base::ObserverList<T>::Iter::GetNext(). (Closed)
Patch Set: Created 4 years, 2 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
« no previous file with comments | « base/observer_list_threadsafe.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) 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 877 matching lines...) Expand 10 before | Expand all | Expand 10 after
888 observer_list.AddObserver(&a); 888 observer_list.AddObserver(&a);
889 observer_list.AddObserver(&b); 889 observer_list.AddObserver(&b);
890 add_observers = false; 890 add_observers = false;
891 } 891 }
892 } 892 }
893 893
894 EXPECT_EQ(12, a.total); 894 EXPECT_EQ(12, a.total);
895 EXPECT_EQ(-12, b.total); 895 EXPECT_EQ(-12, b.total);
896 } 896 }
897 897
898 TEST(ObserverListTest, AddObserverInTheLastObserve) {
danakj 2016/10/13 19:38:13 Why kill the test?
loyso (OOO) 2016/10/13 23:33:52 +1. Even without GetNext a user is able to write G
899 using FooList = ObserverList<Foo>;
900 FooList observer_list;
901
902 AddInObserve<FooList> a(&observer_list);
903 Adder b(-1);
904
905 a.SetToAdd(&b);
906 observer_list.AddObserver(&a);
907
908 FooList::Iterator it(&observer_list);
909 Foo* foo;
910 while ((foo = it.GetNext()) != nullptr)
911 foo->Observe(10);
912
913 EXPECT_EQ(-10, b.total);
914 }
915
916 } // namespace base 898 } // namespace base
OLDNEW
« no previous file with comments | « base/observer_list_threadsafe.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698