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

Unified Diff: mojo/edk/system/simple_dispatcher_unittest.cc

Issue 1639093002: Add //mojo/edk/platform/thread_utils.* containing "yield" and "sleep". (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 4 years, 11 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 | « mojo/edk/system/remote_message_pipe_unittest.cc ('k') | mojo/edk/system/test/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/edk/system/simple_dispatcher_unittest.cc
diff --git a/mojo/edk/system/simple_dispatcher_unittest.cc b/mojo/edk/system/simple_dispatcher_unittest.cc
index 305dcdeb55be1d6331eaa8cfc8dd9b39dbdd67c8..ae84b52ca349cbee0f5b362da8c3ad097fd1b094 100644
--- a/mojo/edk/system/simple_dispatcher_unittest.cc
+++ b/mojo/edk/system/simple_dispatcher_unittest.cc
@@ -13,7 +13,7 @@
#include <vector>
#include "base/logging.h"
-#include "mojo/edk/system/test/sleep.h"
+#include "mojo/edk/platform/thread_utils.h"
#include "mojo/edk/system/test/stopwatch.h"
#include "mojo/edk/system/test/timeouts.h"
#include "mojo/edk/system/waiter.h"
@@ -24,6 +24,7 @@
#include "mojo/public/cpp/system/macros.h"
#include "testing/gtest/include/gtest/gtest.h"
+using mojo::platform::ThreadSleep;
using mojo::util::MakeRefCounted;
using mojo::util::MakeUnique;
using mojo::util::MutexLocker;
@@ -364,7 +365,7 @@ TEST(SimpleDispatcherTest, BasicThreaded) {
&context, &hss);
stopwatch.Start();
thread.Start();
- test::Sleep(2 * test::EpsilonTimeout());
+ ThreadSleep(2 * test::EpsilonTimeout());
d->SetSatisfiedSignals(MOJO_HANDLE_SIGNAL_READABLE);
} // Joins the thread.
EXPECT_EQ(MOJO_RESULT_OK, d->Close());
@@ -388,7 +389,7 @@ TEST(SimpleDispatcherTest, BasicThreaded) {
&context, &hss);
stopwatch.Start();
thread.Start();
- test::Sleep(2 * test::EpsilonTimeout());
+ ThreadSleep(2 * test::EpsilonTimeout());
d->SetSatisfiableSignals(MOJO_HANDLE_SIGNAL_NONE);
} // Joins the thread.
EXPECT_EQ(MOJO_RESULT_OK, d->Close());
@@ -410,7 +411,7 @@ TEST(SimpleDispatcherTest, BasicThreaded) {
&context, &hss);
stopwatch.Start();
thread.Start();
- test::Sleep(2 * test::EpsilonTimeout());
+ ThreadSleep(2 * test::EpsilonTimeout());
EXPECT_EQ(MOJO_RESULT_OK, d->Close());
} // Joins the thread.
elapsed = stopwatch.Elapsed();
@@ -431,7 +432,7 @@ TEST(SimpleDispatcherTest, BasicThreaded) {
&result, &context, &hss);
stopwatch.Start();
thread.Start();
- test::Sleep(1 * test::EpsilonTimeout());
+ ThreadSleep(1 * test::EpsilonTimeout());
// Not what we're waiting for.
d->SetSatisfiedSignals(MOJO_HANDLE_SIGNAL_WRITABLE);
} // Joins the thread (after its wait times out).
@@ -466,7 +467,7 @@ TEST(SimpleDispatcherTest, MultipleWaiters) {
&did_wait[i], &result[i], &context[i], &hss[i]));
threads.back()->Start();
}
- test::Sleep(2 * test::EpsilonTimeout());
+ ThreadSleep(2 * test::EpsilonTimeout());
d->SetSatisfiedSignals(MOJO_HANDLE_SIGNAL_READABLE);
EXPECT_EQ(MOJO_RESULT_OK, d->Close());
} // Joins the threads.
@@ -495,7 +496,7 @@ TEST(SimpleDispatcherTest, MultipleWaiters) {
&did_wait[i], &result[i], &context[i], &hss[i]));
threads.back()->Start();
}
- test::Sleep(2 * test::EpsilonTimeout());
+ ThreadSleep(2 * test::EpsilonTimeout());
d->SetSatisfiedSignals(MOJO_HANDLE_SIGNAL_READABLE);
// This will wake up the ones waiting to write.
EXPECT_EQ(MOJO_RESULT_OK, d->Close());
@@ -532,9 +533,9 @@ TEST(SimpleDispatcherTest, MultipleWaiters) {
&did_wait[i], &result[i], &context[i], &hss[i]));
threads.back()->Start();
}
- test::Sleep(1 * test::EpsilonTimeout());
+ ThreadSleep(1 * test::EpsilonTimeout());
d->SetSatisfiableSignals(MOJO_HANDLE_SIGNAL_READABLE);
- test::Sleep(1 * test::EpsilonTimeout());
+ ThreadSleep(1 * test::EpsilonTimeout());
d->SetSatisfiedSignals(MOJO_HANDLE_SIGNAL_READABLE);
EXPECT_EQ(MOJO_RESULT_OK, d->Close());
} // Joins the threads.
@@ -570,7 +571,7 @@ TEST(SimpleDispatcherTest, MultipleWaiters) {
&did_wait[i], &result[i], &context[i], &hss[i]));
threads.back()->Start();
}
- test::Sleep(2 * test::EpsilonTimeout());
+ ThreadSleep(2 * test::EpsilonTimeout());
d->SetSatisfiedSignals(MOJO_HANDLE_SIGNAL_READABLE);
// All those waiting for writable should have timed out.
EXPECT_EQ(MOJO_RESULT_OK, d->Close());
« no previous file with comments | « mojo/edk/system/remote_message_pipe_unittest.cc ('k') | mojo/edk/system/test/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698