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

Unified Diff: base/threading/worker_pool_unittest.cc

Issue 6079009: Move some misc thread-related stuff from base to base/thread and into the bas... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years 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 | « base/threading/worker_pool_posix_unittest.cc ('k') | base/threading/worker_pool_win.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/threading/worker_pool_unittest.cc
===================================================================
--- base/threading/worker_pool_unittest.cc (revision 0)
+++ base/threading/worker_pool_unittest.cc (revision 0)
@@ -0,0 +1,46 @@
+// Copyright (c) 2008 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "base/task.h"
+#include "base/waitable_event.h"
+#include "base/threading/worker_pool.h"
+#include "testing/gtest/include/gtest/gtest.h"
+#include "testing/platform_test.h"
+
+typedef PlatformTest WorkerPoolTest;
+
+namespace base {
+
+namespace {
+
+class PostTaskTestTask : public Task {
+ public:
+ explicit PostTaskTestTask(WaitableEvent* event) : event_(event) {
+ }
+
+ void Run() {
+ event_->Signal();
+ }
+
+ private:
+ WaitableEvent* event_;
+};
+
+} // namespace
+
+TEST_F(WorkerPoolTest, PostTask) {
+ WaitableEvent test_event(false, false);
+ WaitableEvent long_test_event(false, false);
+ bool signaled;
+
+ WorkerPool::PostTask(FROM_HERE, new PostTaskTestTask(&test_event), false);
+ WorkerPool::PostTask(FROM_HERE, new PostTaskTestTask(&long_test_event), true);
+
+ signaled = test_event.Wait();
+ EXPECT_TRUE(signaled);
+ signaled = long_test_event.Wait();
+ EXPECT_TRUE(signaled);
+}
+
+} // namespace base
Property changes on: base/threading/worker_pool_unittest.cc
___________________________________________________________________
Added: svn:eol-style
+ LF
« no previous file with comments | « base/threading/worker_pool_posix_unittest.cc ('k') | base/threading/worker_pool_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698