1 #include <gmock/gmock.h> 2 #include <gtest/gtest.h> 5 #include <mbf_msgs/GetPathAction.h> 8 #include <mbf_abstract_nav/abstract_action_base.hpp> 19 MOCK_METHOD0(cancel,
bool());
22 MOCK_METHOD0(
run,
void());
29 :
public AbstractActionBase<mbf_msgs::GetPathAction, MockedExecution>,
37 : test_name(
"action_base"),
38 ri(tf_,
"global_frame",
"local_frame",
ros::Duration(0)),
39 AbstractActionBase(test_name, ri)
48 unsigned char slot = 1;
50 concurrency_slots_[slot].thread_ptr =
51 threads_.create_thread(boost::bind(&AbstractActionBaseFixture::run,
this,
52 boost::ref(concurrency_slots_[slot])));
55 using testing::Return;
60 for (
unsigned char slot = 0; slot != 10; ++slot) {
63 EXPECT_CALL(*concurrency_slots_[slot].execution, cancel())
64 .WillRepeatedly(Return(
true));
67 concurrency_slots_[slot].in_use =
true;
68 concurrency_slots_[slot].thread_ptr = threads_.create_thread(
69 boost::bind(&AbstractActionBaseFixture::run,
this,
70 boost::ref(concurrency_slots_[slot])));
77 for (ConcurrencyMap::iterator slot = concurrency_slots_.begin();
78 slot != concurrency_slots_.end(); ++slot)
79 ASSERT_FALSE(slot->second.in_use);
82 int main(
int argc,
char **argv)
85 ros::init(argc, argv,
"abstract_action_base");
87 testing::InitGoogleTest(&argc, argv);
88 return RUN_ALL_TESTS();
void run(class_loader::ClassLoader *loader)
ROSCPP_DECL void init(int &argc, char **argv, const std::string &name, uint32_t options=0)
TEST_F(AbstractActionBaseFixture, thread_stop)
EXPECT_CALL(action_server, publishResult(_, Field(&mbf_msgs::GetPathResult::outcome, Eq(mbf_msgs::GetPathResult::SUCCESS)))) .Times(1) .WillOnce(Notify(&done_condition_))
int main(int argc, char **argv)
Base class for running concurrent navigation tasks.
AbstractActionBaseFixture()
void runImpl(GoalHandle &goal_handle, MockedExecution &execution)
mbf_utility::RobotInformation ri
boost::shared_ptr< MockedExecution > Ptr