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

Unified Diff: base/synchronization/waitable_event_unittest.cc

Issue 2761993004: Revert of Ensure consistent return ordering in base::WaitableEvent::WaitMany (Closed)
Patch Set: Created 3 years, 9 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/synchronization/waitable_event_posix.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/synchronization/waitable_event_unittest.cc
diff --git a/base/synchronization/waitable_event_unittest.cc b/base/synchronization/waitable_event_unittest.cc
index 3aa1af1619bdaf1a918118f23d6fb7c3493cc439..c0e280aa9740642058d3d3e9ee109b3a1c5e5e8a 100644
--- a/base/synchronization/waitable_event_unittest.cc
+++ b/base/synchronization/waitable_event_unittest.cc
@@ -5,8 +5,6 @@
#include "base/synchronization/waitable_event.h"
#include <stddef.h>
-
-#include <algorithm>
#include "base/compiler_specific.h"
#include "base/threading/platform_thread.h"
@@ -77,42 +75,6 @@
EXPECT_EQ(WaitableEvent::WaitMany(ev, 5), 0u);
for (unsigned i = 0; i < 5; ++i)
- delete ev[i];
-}
-
-TEST(WaitableEventTest, WaitManyLeftToRight) {
- WaitableEvent* ev[5];
- for (size_t i = 0; i < 5; ++i) {
- ev[i] = new WaitableEvent(WaitableEvent::ResetPolicy::AUTOMATIC,
- WaitableEvent::InitialState::NOT_SIGNALED);
- }
-
- // Test for consistent left-to-right return behavior across all permutations
- // of the input array. This is to verify that only the indices -- and not
- // the WaitableEvents' addresses -- are relevant in determining who wins when
- // multiple events are signaled.
-
- std::sort(ev, ev + 5);
- do {
- ev[0]->Signal();
- ev[1]->Signal();
- EXPECT_EQ(0u, WaitableEvent::WaitMany(ev, 5));
-
- ev[2]->Signal();
- EXPECT_EQ(1u, WaitableEvent::WaitMany(ev, 5));
- EXPECT_EQ(2u, WaitableEvent::WaitMany(ev, 5));
-
- ev[3]->Signal();
- ev[4]->Signal();
- ev[0]->Signal();
- EXPECT_EQ(0u, WaitableEvent::WaitMany(ev, 5));
- EXPECT_EQ(3u, WaitableEvent::WaitMany(ev, 5));
- ev[2]->Signal();
- EXPECT_EQ(2u, WaitableEvent::WaitMany(ev, 5));
- EXPECT_EQ(4u, WaitableEvent::WaitMany(ev, 5));
- } while (std::next_permutation(ev, ev + 5));
-
- for (size_t i = 0; i < 5; ++i)
delete ev[i];
}
« no previous file with comments | « base/synchronization/waitable_event_posix.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698