Uniformly return kOutOfOrderApiCall when APIs are not called in correct order.

PiperOrigin-RevId: 661300308
This commit is contained in:
Francis Tsui
2024-08-09 09:52:27 -07:00
committed by Copybara-Service
parent bac83ef6a1
commit c3f3beb349
2 changed files with 3 additions and 3 deletions
+1 -1
View File
@@ -726,7 +726,7 @@ void NearbySharingServiceImpl::SendAttachments(
if (!is_scanning_) {
NL_LOG(WARNING) << __func__
<< ": Failed to send attachments. Not scanning.";
std::move(status_codes_callback)(StatusCodes::kError);
std::move(status_codes_callback)(StatusCodes::kOutOfOrderApiCall);
return;
}
+2 -2
View File
@@ -3336,14 +3336,14 @@ TEST_F(NearbySharingServiceImplTest, SendTextAlreadySending) {
// We're now in the sending state, try to send again should fail
EXPECT_EQ(SendAttachments(target_id, CreateTextAttachments({kTextPayload})),
NearbySharingServiceImpl::StatusCodes::kError);
NearbySharingServiceImpl::StatusCodes::kOutOfOrderApiCall);
UnregisterSendSurface(&transfer_callback);
}
TEST_F(NearbySharingServiceImplTest, SendTextWithoutScanning) {
EXPECT_EQ(SendAttachments(325626L, CreateTextAttachments({kTextPayload})),
NearbySharingServiceImpl::StatusCodes::kError);
NearbySharingServiceImpl::StatusCodes::kOutOfOrderApiCall);
}
TEST_F(NearbySharingServiceImplTest, SendTextUnknownTarget) {