Update test to use sapi:✌️:Proto<>::FromMessage factory method

The bare constructor is deprecated.

PiperOrigin-RevId: 419583946
Change-Id: I7647b74e7f4be65e0bbeba1c1393601ffa87fd80
This commit is contained in:
Sandboxed API Team 2022-01-04 07:00:51 -08:00 committed by Copybara-Service
parent c3aa56ff37
commit 8d7a442b94

View File

@ -50,10 +50,12 @@ absl::Status InvokeStringReversal(Sandbox* sandbox) {
StringopApi api(sandbox); StringopApi api(sandbox);
stringop::StringReverse proto; stringop::StringReverse proto;
proto.set_input("Hello"); proto.set_input("Hello");
v::Proto<stringop::StringReverse> pp(proto); absl::StatusOr<v::Proto<stringop::StringReverse>> pp(
SAPI_ASSIGN_OR_RETURN(int return_code, api.pb_reverse_string(pp.PtrBoth())); v::Proto<stringop::StringReverse>::FromMessage(proto));
SAPI_RETURN_IF_ERROR(pp.status());
SAPI_ASSIGN_OR_RETURN(int return_code, api.pb_reverse_string(pp->PtrBoth()));
TRANSACTION_FAIL_IF_NOT(return_code != 0, "pb_reverse_string failed"); TRANSACTION_FAIL_IF_NOT(return_code != 0, "pb_reverse_string failed");
SAPI_ASSIGN_OR_RETURN(auto pb_result, pp.GetMessage()); SAPI_ASSIGN_OR_RETURN(auto pb_result, pp->GetMessage());
TRANSACTION_FAIL_IF_NOT(pb_result.output() == "olleH", "Incorrect output"); TRANSACTION_FAIL_IF_NOT(pb_result.output() == "olleH", "Incorrect output");
return absl::OkStatus(); return absl::OkStatus();
} }