From 8d7a442b9499877192b21c6c16b5794e127cd22e Mon Sep 17 00:00:00 2001 From: Sandboxed API Team Date: Tue, 4 Jan 2022 07:00:51 -0800 Subject: [PATCH] Update test to use sapi::v::Proto<>::FromMessage factory method The bare constructor is deprecated. PiperOrigin-RevId: 419583946 Change-Id: I7647b74e7f4be65e0bbeba1c1393601ffa87fd80 --- sandboxed_api/sapi_test.cc | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/sandboxed_api/sapi_test.cc b/sandboxed_api/sapi_test.cc index 052b11d..fc6111d 100644 --- a/sandboxed_api/sapi_test.cc +++ b/sandboxed_api/sapi_test.cc @@ -50,10 +50,12 @@ absl::Status InvokeStringReversal(Sandbox* sandbox) { StringopApi api(sandbox); stringop::StringReverse proto; proto.set_input("Hello"); - v::Proto pp(proto); - SAPI_ASSIGN_OR_RETURN(int return_code, api.pb_reverse_string(pp.PtrBoth())); + absl::StatusOr> pp( + v::Proto::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"); - 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"); return absl::OkStatus(); }