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

Unified Diff: test/cctest/test-libplatform-worker-thread.cc

Issue 104583003: [platform] Implement a worker pool (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: updates Created 7 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 | « test/cctest/test-libplatform-task-queue.cc ('k') | tools/gyp/v8.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/test-libplatform-worker-thread.cc
diff --git a/test/cctest/test-cpu.cc b/test/cctest/test-libplatform-worker-thread.cc
similarity index 67%
copy from test/cctest/test-cpu.cc
copy to test/cctest/test-libplatform-worker-thread.cc
index 06966c68c86296e510edb8899f4d7deb0343f108..090d6e1a180d7ef4603a2ac3c36e6b96303602a3 100644
--- a/test/cctest/test-cpu.cc
+++ b/test/cctest/test-libplatform-worker-thread.cc
@@ -28,28 +28,37 @@
#include "v8.h"
#include "cctest.h"
-#include "cpu.h"
+#include "libplatform/task-queue.h"
+#include "libplatform/worker-thread.h"
+#include "test-libplatform.h"
using namespace v8::internal;
-TEST(FeatureImplications) {
- // Test for features implied by other features.
- CPU cpu;
+TEST(WorkerThread) {
+ TaskQueue queue;
+ TaskCounter task_counter;
- // ia32 and x64 features
- CHECK(!cpu.has_sse() || cpu.has_mmx());
- CHECK(!cpu.has_sse2() || cpu.has_sse());
- CHECK(!cpu.has_sse3() || cpu.has_sse2());
- CHECK(!cpu.has_ssse3() || cpu.has_sse3());
- CHECK(!cpu.has_sse41() || cpu.has_sse3());
- CHECK(!cpu.has_sse42() || cpu.has_sse41());
+ TestTask* task1 = new TestTask(&task_counter, true);
+ TestTask* task2 = new TestTask(&task_counter, true);
+ TestTask* task3 = new TestTask(&task_counter, true);
+ TestTask* task4 = new TestTask(&task_counter, true);
- // arm features
- CHECK(!cpu.has_vfp3_d32() || cpu.has_vfp3());
-}
+ WorkerThread* thread1 = new WorkerThread(&queue);
+ WorkerThread* thread2 = new WorkerThread(&queue);
+
+ CHECK_EQ(4, task_counter.GetCount());
+
+ queue.Append(task1);
+ queue.Append(task2);
+ queue.Append(task3);
+ queue.Append(task4);
+
+ // TaskQueue ASSERTs that it is empty in its destructor.
+ queue.Terminate();
+ delete thread1;
+ delete thread2;
-TEST(NumberOfProcessorsOnline) {
- CHECK_GT(CPU::NumberOfProcessorsOnline(), 0);
+ CHECK_EQ(0, task_counter.GetCount());
}
« no previous file with comments | « test/cctest/test-libplatform-task-queue.cc ('k') | tools/gyp/v8.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698