mirror of
https://github.com/google/sandboxed-api.git
synced 2024-03-22 13:11:30 +08:00
Replace deprecate sapi:✌️:Proto
ctor calls
PiperOrigin-RevId: 423760615 Change-Id: Id05341221fb6413d8f89d38470a9bc02f9d09b77
This commit is contained in:
parent
3c16be8347
commit
e4436c87e8
|
@ -46,14 +46,17 @@ TEST(StringopTest, ProtobufStringDuplication) {
|
|||
StringopApi api(sandbox);
|
||||
stringop::StringDuplication proto;
|
||||
proto.set_input("Hello");
|
||||
sapi::v::Proto<stringop::StringDuplication> pp(proto);
|
||||
auto pp = sapi::v::Proto<stringop::StringDuplication>::FromMessage(proto);
|
||||
if (!pp.ok()) {
|
||||
return pp.status();
|
||||
}
|
||||
{
|
||||
SAPI_ASSIGN_OR_RETURN(int return_value,
|
||||
api.pb_duplicate_string(pp.PtrBoth()));
|
||||
api.pb_duplicate_string(pp->PtrBoth()));
|
||||
TRANSACTION_FAIL_IF_NOT(return_value, "pb_duplicate_string() failed");
|
||||
}
|
||||
|
||||
SAPI_ASSIGN_OR_RETURN(auto pb_result, pp.GetMessage());
|
||||
SAPI_ASSIGN_OR_RETURN(auto pb_result, pp->GetMessage());
|
||||
LOG(INFO) << "Result PB: " << pb_result.DebugString();
|
||||
TRANSACTION_FAIL_IF_NOT(pb_result.output() == "HelloHello",
|
||||
"Incorrect output");
|
||||
|
|
|
@ -134,8 +134,11 @@ absl::Status SumTransaction::Main() {
|
|||
proto.set_a(10);
|
||||
proto.set_b(20);
|
||||
proto.set_c(30);
|
||||
sapi::v::Proto<sumsapi::SumParamsProto> pp(proto);
|
||||
SAPI_ASSIGN_OR_RETURN(v, f.sumproto(pp.PtrBefore()));
|
||||
auto pp = sapi::v::Proto<sumsapi::SumParamsProto>::FromMessage(proto);
|
||||
if (!pp.ok()) {
|
||||
return pp.status();
|
||||
}
|
||||
SAPI_ASSIGN_OR_RETURN(v, f.sumproto(pp->PtrBefore()));
|
||||
LOG(INFO) << "sumproto(proto {a = 10; b = 20; c = 30}) = " << v;
|
||||
TRANSACTION_FAIL_IF_NOT(v == 60,
|
||||
"sumproto(proto {a = 10; b = 20; c = 30}) != 60");
|
||||
|
|
Loading…
Reference in New Issue
Block a user