16 #include "tensorflow_serving/servables/tensorflow/thread_pool_factory.h"
20 #include <gmock/gmock.h>
21 #include <gtest/gtest.h>
22 #include "tensorflow/core/platform/env.h"
23 #include "tensorflow/core/platform/threadpool.h"
24 #include "tensorflow/core/platform/threadpool_options.h"
25 #include "tensorflow_serving/test_util/test_util.h"
27 namespace tensorflow {
31 TEST(ScopedThreadPools, DefaultCtor) {
32 ScopedThreadPools thread_pools;
33 EXPECT_EQ(
nullptr, thread_pools.get().inter_op_threadpool);
34 EXPECT_EQ(
nullptr, thread_pools.get().intra_op_threadpool);
37 TEST(ScopedThreadPools, NonDefaultCtor) {
38 auto inter_op_thread_pool =
39 std::make_shared<test_util::CountingThreadPool>(Env::Default(),
"InterOp",
41 auto intra_op_thread_pool =
42 std::make_shared<test_util::CountingThreadPool>(Env::Default(),
"InterOp",
44 ScopedThreadPools thread_pools(inter_op_thread_pool, intra_op_thread_pool);
45 EXPECT_EQ(inter_op_thread_pool.get(), thread_pools.get().inter_op_threadpool);
46 EXPECT_EQ(intra_op_thread_pool.get(), thread_pools.get().intra_op_threadpool);