Refactor PIBlockingDequeue

This commit is contained in:
3 changed files with 130 additions and 95 deletions

View File

@@ -38,8 +38,7 @@ public:
MOCK_METHOD1(waitForFinish, bool(int timeout_msecs));
};
template<typename F>
class MockDeque : public PIBlockingDequeue<F> {
class MockDeque : public PIBlockingDequeue<FunctionWrapper> {
public:
MOCK_METHOD1(offer, bool(const FunctionWrapper&));
MOCK_METHOD0(take, FunctionWrapper());
@@ -48,7 +47,7 @@ public:
MOCK_METHOD0(remainingCapacity, size_t());
};
typedef PIThreadPoolExecutorTemplate<NiceMock<MockThread>, MockDeque<FunctionWrapper>> PIThreadPoolExecutorMoc_t;
typedef PIThreadPoolExecutorTemplate<NiceMock<MockThread>, MockDeque> PIThreadPoolExecutorMoc_t;
class PIThreadPoolExecutorMoc : public PIThreadPoolExecutorMoc_t {
public:
@@ -59,7 +58,7 @@ public:
PIVector<testing::NiceMock<MockThread>*>* getThreadPool() { return &threadPool; }
bool isShutdown() { return isShutdown_; }
MockDeque<FunctionWrapper>* getTaskQueue() { return &taskQueue; }
MockDeque* getTaskQueue() { return &taskQueue; }
};
TEST(ExecutorUnitTest, is_corePool_created) {