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

Unified Diff: mojo/edk/util/cond_var_unittest.cc

Issue 1408003013: Reland "EDK: Move //mojo/edk/system/waitable_event* to edk/util." (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « mojo/edk/util/BUILD.gn ('k') | mojo/edk/util/mutex_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/edk/util/cond_var_unittest.cc
diff --git a/mojo/edk/util/cond_var_unittest.cc b/mojo/edk/util/cond_var_unittest.cc
index 930765b35f2642f158de3dfbf469aa380b90f2c9..ab966f1ba3a332eed6934ddab7c64e38f3b73a2a 100644
--- a/mojo/edk/util/cond_var_unittest.cc
+++ b/mojo/edk/util/cond_var_unittest.cc
@@ -18,13 +18,19 @@
#include "mojo/public/cpp/system/macros.h"
#include "testing/gtest/include/gtest/gtest.h"
+using mojo::system::test::DeadlineFromMilliseconds;
+using mojo::system::test::EpsilonTimeout;
+using mojo::system::test::SleepMilliseconds;
+using mojo::system::test::Stopwatch;
+using mojo::system::test::TinyTimeout;
+
namespace mojo {
namespace util {
namespace {
// Sleeps for a "very small" amount of time.
void EpsilonRandomSleep() {
- system::test::SleepMilliseconds(static_cast<unsigned>(rand()) % 20u);
+ SleepMilliseconds(static_cast<unsigned>(rand()) % 20u);
}
// We'll use |MojoDeadline| with |uint64_t| (for |CondVar::WaitWithTimeout()|'s
@@ -56,8 +62,7 @@ TEST(CondVarTest, Basic) {
// happen if we're interrupted, e.g., by ^Z.)
EXPECT_TRUE(cv.WaitWithTimeout(&mu, 0));
mu.AssertHeld();
- EXPECT_TRUE(
- cv.WaitWithTimeout(&mu, system::test::DeadlineFromMilliseconds(1)));
+ EXPECT_TRUE(cv.WaitWithTimeout(&mu, DeadlineFromMilliseconds(1)));
mu.AssertHeld();
}
@@ -89,7 +94,7 @@ TEST(CondVarTest, Basic) {
}
} else {
while (!condition) {
- EXPECT_FALSE(cv.WaitWithTimeout(&mu, system::test::TinyTimeout()));
+ EXPECT_FALSE(cv.WaitWithTimeout(&mu, TinyTimeout()));
mu.AssertHeld();
}
}
@@ -118,8 +123,7 @@ TEST(CondVarTest, SignalAll) {
}
} else {
while (!condition) {
- EXPECT_FALSE(
- cv.WaitWithTimeout(&mu, system::test::TinyTimeout()));
+ EXPECT_FALSE(cv.WaitWithTimeout(&mu, TinyTimeout()));
mu.AssertHeld();
}
}
@@ -143,7 +147,7 @@ TEST(CondVarTest, SignalAll) {
TEST(CondVarTest, Timeouts) {
static const unsigned kTestTimeoutsMs[] = {0, 10, 20, 40, 80, 160};
- system::test::Stopwatch stopwatch;
+ Stopwatch stopwatch;
Mutex mu;
CondVar cv;
@@ -151,8 +155,7 @@ TEST(CondVarTest, Timeouts) {
MutexLocker locker(&mu);
for (size_t i = 0; i < MOJO_ARRAYSIZE(kTestTimeoutsMs); i++) {
- uint64_t timeout =
- system::test::DeadlineFromMilliseconds(kTestTimeoutsMs[i]);
+ uint64_t timeout = DeadlineFromMilliseconds(kTestTimeoutsMs[i]);
stopwatch.Start();
// See note in CondVarTest.Basic about spurious wakeups.
@@ -162,7 +165,7 @@ TEST(CondVarTest, Timeouts) {
// It should time out after *at least* the specified amount of time.
EXPECT_GE(elapsed, timeout);
// But we expect that it should time out soon after that amount of time.
- EXPECT_LT(elapsed, timeout + system::test::EpsilonTimeout());
+ EXPECT_LT(elapsed, timeout + EpsilonTimeout());
}
}
« no previous file with comments | « mojo/edk/util/BUILD.gn ('k') | mojo/edk/util/mutex_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698