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

Side by Side Diff: base/observer_list_unittest.cc

Issue 2445643002: Remove gender specific language from src/base (Closed)
Patch Set: Created 4 years, 1 month 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 | « no previous file | 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 834 matching lines...) Expand 10 before | Expand all | Expand 10 after
845 EXPECT_EQ(-15, d.total); 845 EXPECT_EQ(-15, d.total);
846 } 846 }
847 847
848 TEST(ObserverListTest, NonCompactList) { 848 TEST(ObserverListTest, NonCompactList) {
849 ObserverList<Foo> observer_list; 849 ObserverList<Foo> observer_list;
850 Adder a(1), b(-1); 850 Adder a(1), b(-1);
851 851
852 Disrupter disrupter1(&observer_list, true); 852 Disrupter disrupter1(&observer_list, true);
853 Disrupter disrupter2(&observer_list, true); 853 Disrupter disrupter2(&observer_list, true);
854 854
855 // Disrupt itself and another guy. 855 // Disrupt itself and another one.
856 disrupter1.SetDoomed(&disrupter2); 856 disrupter1.SetDoomed(&disrupter2);
857 857
858 observer_list.AddObserver(&disrupter1); 858 observer_list.AddObserver(&disrupter1);
859 observer_list.AddObserver(&disrupter2); 859 observer_list.AddObserver(&disrupter2);
860 observer_list.AddObserver(&a); 860 observer_list.AddObserver(&a);
861 observer_list.AddObserver(&b); 861 observer_list.AddObserver(&b);
862 862
863 for (auto& o : observer_list) { 863 for (auto& o : observer_list) {
864 // Get the { nullptr, nullptr, &a, &b } non-compact list 864 // Get the { nullptr, nullptr, &a, &b } non-compact list
865 // on the first inner pass. 865 // on the first inner pass.
866 o.Observe(10); 866 o.Observe(10);
867 867
868 for (auto& o : observer_list) 868 for (auto& o : observer_list)
869 o.Observe(1); 869 o.Observe(1);
870 } 870 }
871 871
872 EXPECT_EQ(13, a.total); 872 EXPECT_EQ(13, a.total);
873 EXPECT_EQ(-13, b.total); 873 EXPECT_EQ(-13, b.total);
874 } 874 }
875 875
876 TEST(ObserverListTest, BecomesEmptyThanNonEmpty) { 876 TEST(ObserverListTest, BecomesEmptyThanNonEmpty) {
877 ObserverList<Foo> observer_list; 877 ObserverList<Foo> observer_list;
878 Adder a(1), b(-1); 878 Adder a(1), b(-1);
879 879
880 Disrupter disrupter1(&observer_list, true); 880 Disrupter disrupter1(&observer_list, true);
881 Disrupter disrupter2(&observer_list, true); 881 Disrupter disrupter2(&observer_list, true);
882 882
883 // Disrupt itself and another guy. 883 // Disrupt itself and another one.
884 disrupter1.SetDoomed(&disrupter2); 884 disrupter1.SetDoomed(&disrupter2);
885 885
886 observer_list.AddObserver(&disrupter1); 886 observer_list.AddObserver(&disrupter1);
887 observer_list.AddObserver(&disrupter2); 887 observer_list.AddObserver(&disrupter2);
888 888
889 bool add_observers = true; 889 bool add_observers = true;
890 for (auto& o : observer_list) { 890 for (auto& o : observer_list) {
891 // Get the { nullptr, nullptr } empty list on the first inner pass. 891 // Get the { nullptr, nullptr } empty list on the first inner pass.
892 o.Observe(10); 892 o.Observe(10);
893 893
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
925 // However, the first Observe() call will add a second observer: at this 925 // However, the first Observe() call will add a second observer: at this
926 // point, it != observer_list.end() should be true, and Observe() should be 926 // point, it != observer_list.end() should be true, and Observe() should be
927 // called on the newly added observer on the next iteration of the loop. 927 // called on the newly added observer on the next iteration of the loop.
928 observer.Observe(10); 928 observer.Observe(10);
929 } 929 }
930 930
931 EXPECT_EQ(-10, b.total); 931 EXPECT_EQ(-10, b.total);
932 } 932 }
933 933
934 } // namespace base 934 } // namespace base
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698