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

Unified Diff: third_party/WebKit/Source/wtf/DequeTest.cpp

Issue 2261623002: Make DrawingBuffer and Canvas2DLayerBridge be cc::TextureLayerClients. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: webmailbox: fix-passrefptr Created 4 years, 4 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
Index: third_party/WebKit/Source/wtf/DequeTest.cpp
diff --git a/third_party/WebKit/Source/wtf/DequeTest.cpp b/third_party/WebKit/Source/wtf/DequeTest.cpp
index 8c6e360b7a3cbc4ed8b1124ce32057b896c40c53..5ea72e24359205485935b0c159bdd52517790e1d 100644
--- a/third_party/WebKit/Source/wtf/DequeTest.cpp
+++ b/third_party/WebKit/Source/wtf/DequeTest.cpp
@@ -605,6 +605,35 @@ TEST(DequeTest, MoveShouldNotMakeCopy)
EXPECT_EQ(0, counter);
}
+TEST(DequeTest, RemoveWhileIterating)
+{
+ Deque<int> deque;
+ for (int i = 0; i < 10; ++i)
+ deque.append(i);
+
+ // All numbers present.
+ {
+ int i = 0;
+ for (int v : deque)
+ EXPECT_EQ(i++, v);
+ }
+
+ // Remove the even numbers while iterating.
+ for (auto it = deque.begin(); it != deque.end(); ++it) {
+ if (*it % 2 == 0) {
+ deque.remove(it);
+ --it;
+ }
+ }
+
+ // Only odd numbers left.
+ {
+ int i = 1;
+ for (int v : deque)
+ EXPECT_EQ(i + 2, v);
+ }
+}
+
} // anonymous namespace
} // namespace WTF
« no previous file with comments | « third_party/WebKit/Source/platform/graphics/gpu/DrawingBufferTest.cpp ('k') | third_party/WebKit/public/blink_headers.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698