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

Unified Diff: third_party/crashpad/crashpad/util/thread/worker_thread_test.cc

Issue 2773813002: Update Crashpad to 8e37886d418dd042c3c7bfadac99214739ee4d98 (Closed)
Patch Set: Update Crashpad to 8e37886d418dd042c3c7bfadac99214739ee4d98 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
Index: third_party/crashpad/crashpad/util/thread/worker_thread_test.cc
diff --git a/third_party/crashpad/crashpad/util/thread/worker_thread_test.cc b/third_party/crashpad/crashpad/util/thread/worker_thread_test.cc
index 0cbee187fbcd1eef2c49b0b205abbe1784e32787..044734c84808edff5851738ed9dfc5688be79c84 100644
--- a/third_party/crashpad/crashpad/util/thread/worker_thread_test.cc
+++ b/third_party/crashpad/crashpad/util/thread/worker_thread_test.cc
@@ -30,8 +30,11 @@ class WorkDelegate : public WorkerThread::Delegate {
~WorkDelegate() {}
void DoWork(const WorkerThread* thread) override {
- if (++work_count_ == waiting_for_count_)
- semaphore_.Signal();
+ if (work_count_ < waiting_for_count_) {
+ if (++work_count_ == waiting_for_count_) {
+ semaphore_.Signal();
+ }
+ }
}
void SetDesiredWorkCount(int times) {
@@ -59,6 +62,7 @@ TEST(WorkerThread, DoWork) {
WorkerThread thread(0.05, &delegate);
uint64_t start = ClockMonotonicNanoseconds();
+
delegate.SetDesiredWorkCount(2);
thread.Start(0);
EXPECT_TRUE(thread.is_running());
@@ -103,12 +107,12 @@ TEST(WorkerThread, DoWorkNow) {
WorkDelegate delegate;
WorkerThread thread(100, &delegate);
+ uint64_t start = ClockMonotonicNanoseconds();
+
delegate.SetDesiredWorkCount(1);
thread.Start(0);
EXPECT_TRUE(thread.is_running());
- uint64_t start = ClockMonotonicNanoseconds();
-
delegate.WaitForWorkCount();
EXPECT_EQ(1, delegate.work_count());
« no previous file with comments | « third_party/crashpad/crashpad/util/posix/process_info_test.cc ('k') | third_party/crashpad/crashpad/util/util.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698