I'm trying to put together a CL where I change a const-ref Callback to a move-only OnceCallback. There's an existing mock which uses gmock and ON_CALL().WillByDefault(Invoke(...)) to provide a default action. However, gmock doesn't like the move-only OnceCallback:
../../third_party/googletest/src/googlemock/include/gmock/gmock-generated-actions.h:113:42: error: call to deleted constructor of 'base::OnceCallback<void (bool)>'
return (obj_ptr->*method_ptr)(get<0>(args), get<1>(args));
^~~~~~~~~~~~
../../third_party/googletest/src/googlemock/include/gmock/gmock-more-actions.h:81:49: note: in instantiation of function template specialization 'testing::internal::InvokeHelper<void, std::__1::tuple<base::OnceCallback<void (bool)>, bool> >::InvokeMethod<chromeos::disks::MockDiskMountManager, void (chromeos::disks::MockDiskMountManager::*)(base::OnceCallback<void (bool)>, bool)>' requested here
return InvokeHelper<Result, ArgumentTuple>::InvokeMethod(
^
../../third_party/googletest/src/googlemock/include/gmock/gmock-actions.h:474:29: note: in instantiation of function template specialization 'testing::internal::InvokeMethodAction<chromeos::disks::MockDiskMountManager, void (chromeos::disks::MockDiskMountManager::*)(base::OnceCallback<void (bool)>, bool)>::Perform<void, std::__1::tuple<base::OnceCallback<void (bool)>, bool> >' requested here
return impl_.template Perform<Result>(args);
^
../../third_party/googletest/src/googlemock/include/gmock/gmock-actions.h:471:14: note: in instantiation of member function 'testing::PolymorphicAction<testing::internal::InvokeMethodAction<chromeos::disks::MockDiskMountManager, void (chromeos::disks::MockDiskMountManager::*)(base::OnceCallback<void (bool)>, bool)> >::MonomorphicImpl<void (base::OnceCallback<void (bool)>, bool)>::Perform' requested here
explicit MonomorphicImpl(const Impl& impl) : impl_(impl) {}
^
../../third_party/googletest/src/googlemock/include/gmock/gmock-actions.h:461:26: note: in instantiation of member function 'testing::PolymorphicAction<testing::internal::InvokeMethodAction<chromeos::disks::MockDiskMountManager, void (chromeos::disks::MockDiskMountManager::*)(base::OnceCallback<void (bool)>, bool)> >::MonomorphicImpl<void (base::OnceCallback<void (bool)>, bool)>::MonomorphicImpl' requested here
return Action<F>(new MonomorphicImpl<F>(impl_));
^
../../chromeos/disks/mock_disk_mount_manager.cc:83:22: note: in instantiation of function template specialization 'testing::PolymorphicAction<testing::internal::InvokeMethodAction<chromeos::disks::MockDiskMountManager, void (chromeos::disks::MockDiskMountManager::*)(base::OnceCallback<void (bool)>, bool)> >::operator Action<void (base::OnceCallback<void (bool)>, bool)>' requested here
.WillByDefault(Invoke(
^
../../base/callback.h:68:3: note: 'OnceCallback' has been explicitly marked deleted here
OnceCallback(const OnceCallback&) = delete;
I'm certain someone has run into this problem before. Is there a "standard" or pre-existing solution to this before I go off and invent my own?