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

Unified Diff: sandbox/linux/services/thread_helpers_unittests.cc

Issue 1310773006: Update sandbox/linux from upstream (Closed) Base URL: ssh://ssh.github.com/domokit/mojo.git@master
Patch Set: Update to 3909ebfa69566f7374a6900e63cd4d3c73a35378 Created 5 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
« no previous file with comments | « sandbox/linux/services/thread_helpers.cc ('k') | sandbox/linux/services/yama_unittests.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sandbox/linux/services/thread_helpers_unittests.cc
diff --git a/sandbox/linux/services/thread_helpers_unittests.cc b/sandbox/linux/services/thread_helpers_unittests.cc
index 7357a0cfa7cd24dd3814c9a8f1803e4d669ae9a8..1461c35d6c77425125c6eb2940c4e1e8b47b20b6 100644
--- a/sandbox/linux/services/thread_helpers_unittests.cc
+++ b/sandbox/linux/services/thread_helpers_unittests.cc
@@ -59,7 +59,7 @@ TEST(ThreadHelpers, IsSingleThreadedBasic) {
ASSERT_TRUE(ThreadHelpers::IsSingleThreaded());
base::Thread thread("sandbox_tests");
- ASSERT_TRUE(thread.Start());
+ ASSERT_TRUE(ThreadHelpers::StartThreadAndWatchProcFS(proc_fd.fd(), &thread));
ASSERT_FALSE(ThreadHelpers::IsSingleThreaded(proc_fd.fd()));
ASSERT_FALSE(ThreadHelpers::IsSingleThreaded());
// Explicitly stop the thread here to not pollute the next test.
@@ -82,7 +82,8 @@ TEST(ThreadHelpers, IsSingleThreadedIterated) {
// Iterate to check for race conditions.
for (int i = 0; i < GetRaceTestIterations(); ++i) {
base::Thread thread("sandbox_tests");
- ASSERT_TRUE(thread.Start());
+ ASSERT_TRUE(
+ ThreadHelpers::StartThreadAndWatchProcFS(proc_fd.fd(), &thread));
ASSERT_FALSE(ThreadHelpers::IsSingleThreaded(proc_fd.fd()));
// Explicitly stop the thread here to not pollute the next test.
ASSERT_TRUE(ThreadHelpers::StopThreadAndWatchProcFS(proc_fd.fd(), &thread));
@@ -97,7 +98,8 @@ TEST(ThreadHelpers, IsSingleThreadedStartAndStop) {
// This is testing for a race condition, so iterate.
// Manually, this has been tested with more that 1M iterations.
for (int i = 0; i < GetRaceTestIterations(); ++i) {
- ASSERT_TRUE(thread.Start());
+ ASSERT_TRUE(
+ ThreadHelpers::StartThreadAndWatchProcFS(proc_fd.fd(), &thread));
ASSERT_FALSE(ThreadHelpers::IsSingleThreaded(proc_fd.fd()));
ASSERT_TRUE(ThreadHelpers::StopThreadAndWatchProcFS(proc_fd.fd(), &thread));
@@ -107,14 +109,17 @@ TEST(ThreadHelpers, IsSingleThreadedStartAndStop) {
}
SANDBOX_TEST(ThreadHelpers, AssertSingleThreadedAfterThreadStopped) {
+ ScopedProc proc_fd;
SANDBOX_ASSERT(ThreadHelpers::IsSingleThreaded());
base::Thread thread1("sandbox_tests");
base::Thread thread2("sandbox_tests");
for (int i = 0; i < GetRaceTestIterations(); ++i) {
- SANDBOX_ASSERT(thread1.Start());
- SANDBOX_ASSERT(thread2.Start());
+ SANDBOX_ASSERT(
+ ThreadHelpers::StartThreadAndWatchProcFS(proc_fd.fd(), &thread1));
+ SANDBOX_ASSERT(
+ ThreadHelpers::StartThreadAndWatchProcFS(proc_fd.fd(), &thread2));
SANDBOX_ASSERT(!ThreadHelpers::IsSingleThreaded());
thread1.Stop();
« no previous file with comments | « sandbox/linux/services/thread_helpers.cc ('k') | sandbox/linux/services/yama_unittests.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698