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

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

Issue 1420713006: Revert "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 ab966f1ba3a332eed6934ddab7c64e38f3b73a2a..930765b35f2642f158de3dfbf469aa380b90f2c9 100644
--- a/mojo/edk/util/cond_var_unittest.cc
+++ b/mojo/edk/util/cond_var_unittest.cc
@@ -18,19 +18,13 @@
#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() {
- SleepMilliseconds(static_cast<unsigned>(rand()) % 20u);
+ system::test::SleepMilliseconds(static_cast<unsigned>(rand()) % 20u);
}
// We'll use |MojoDeadline| with |uint64_t| (for |CondVar::WaitWithTimeout()|'s
@@ -62,7 +56,8 @@ 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, DeadlineFromMilliseconds(1)));
+ EXPECT_TRUE(
+ cv.WaitWithTimeout(&mu, system::test::DeadlineFromMilliseconds(1)));
mu.AssertHeld();
}
@@ -94,7 +89,7 @@ TEST(CondVarTest, Basic) {
}
} else {
while (!condition) {
- EXPECT_FALSE(cv.WaitWithTimeout(&mu, TinyTimeout()));
+ EXPECT_FALSE(cv.WaitWithTimeout(&mu, system::test::TinyTimeout()));
mu.AssertHeld();
}
}
@@ -123,7 +118,8 @@ TEST(CondVarTest, SignalAll) {
}
} else {
while (!condition) {
- EXPECT_FALSE(cv.WaitWithTimeout(&mu, TinyTimeout()));
+ EXPECT_FALSE(
+ cv.WaitWithTimeout(&mu, system::test::TinyTimeout()));
mu.AssertHeld();
}
}
@@ -147,7 +143,7 @@ TEST(CondVarTest, SignalAll) {
TEST(CondVarTest, Timeouts) {
static const unsigned kTestTimeoutsMs[] = {0, 10, 20, 40, 80, 160};
- Stopwatch stopwatch;
+ system::test::Stopwatch stopwatch;
Mutex mu;
CondVar cv;
@@ -155,7 +151,8 @@ TEST(CondVarTest, Timeouts) {
MutexLocker locker(&mu);
for (size_t i = 0; i < MOJO_ARRAYSIZE(kTestTimeoutsMs); i++) {
- uint64_t timeout = DeadlineFromMilliseconds(kTestTimeoutsMs[i]);
+ uint64_t timeout =
+ system::test::DeadlineFromMilliseconds(kTestTimeoutsMs[i]);
stopwatch.Start();
// See note in CondVarTest.Basic about spurious wakeups.
@@ -165,7 +162,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 + EpsilonTimeout());
+ EXPECT_LT(elapsed, timeout + system::test::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