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()); |
} |