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

Unified Diff: base/id_map_unittest.cc

Issue 609001: Merge 39084 - Correctly recognize emptiness of IDMap.... (Closed) Base URL: svn://svn.chromium.org/chrome/branches/249/src/
Patch Set: Created 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/id_map.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/id_map_unittest.cc
===================================================================
--- base/id_map_unittest.cc (revision 39086)
+++ base/id_map_unittest.cc (working copy)
@@ -59,10 +59,21 @@
map.Add(&obj2);
map.Add(&obj3);
- for (IDMap<TestObject>::const_iterator iter(&map);
- !iter.IsAtEnd(); iter.Advance()) {
- map.Remove(iter.GetCurrentKey());
+ {
+ IDMap<TestObject>::const_iterator iter(&map);
+ while (!iter.IsAtEnd()) {
+ map.Remove(iter.GetCurrentKey());
+ iter.Advance();
+ }
+
+ // Test that while an iterator is still in scope, we get the map emptiness
+ // right (http://crbug.com/35571).
+ EXPECT_TRUE(map.IsEmpty());
+ EXPECT_EQ(0U, map.size());
}
+
+ EXPECT_TRUE(map.IsEmpty());
+ EXPECT_EQ(0U, map.size());
}
TEST_F(IDMapTest, IteratorRemainsValidWhenRemovingOtherElements) {
« no previous file with comments | « base/id_map.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698