@@ -68,6 +68,13 @@ namespace {
6868using ::absl_testing::IsOk;
6969using ::absl_testing::IsOkAndHolds;
7070using ::absl_testing::StatusIs;
71+ using ::google::protobuf::Descriptor;
72+ using ::google::protobuf::EnumDescriptor;
73+ using ::google::protobuf::EnumValueDescriptor;
74+ using ::google::protobuf::FieldDescriptor;
75+ using ::google::protobuf::Map;
76+ using ::google::protobuf::Message;
77+ using ::google::protobuf::Reflection;
7178using ::google::protobuf::TextFormat;
7279using ::testing::AllOf;
7380using ::testing::ElementsAre;
@@ -570,7 +577,7 @@ TEST(BrushTest, EncodeBrushFamilyTextureMap) {
570577 .blend_mode = BrushPaint::BlendMode::kSrcIn }},
571578 .self_overlap = BrushPaint::SelfOverlap::kDiscard });
572579 ASSERT_EQ (family.status (), absl::OkStatus ());
573- google::protobuf:: Map<std::string, std::string> texture_id_to_bitmap_proto_out;
580+ Map<std::string, std::string> texture_id_to_bitmap_proto_out;
574581 int distinct_texture_ids_count = 0 ;
575582 TextureBitmapProvider callback =
576583 [&distinct_texture_ids_count](
@@ -600,7 +607,7 @@ TEST(BrushTest, EncodeBrushFamilyTextureMap) {
600607TEST (BrushTest, EncodeBrushFamilyTextureMapWithNonEmptyProto) {
601608 absl::StatusOr<BrushFamily> family = BrushFamily ();
602609 ASSERT_EQ (family.status (), absl::OkStatus ());
603- google::protobuf:: Map<std::string, std::string> texture_id_to_bitmap_proto_out;
610+ Map<std::string, std::string> texture_id_to_bitmap_proto_out;
604611 texture_id_to_bitmap_proto_out.insert ({" existing_id" , TestPngBytes1x1 ()});
605612
606613 int callback_count = 0 ;
@@ -992,18 +999,17 @@ void EncodeDecodeValidBrushBehaviorNodeRoundTrip(
992999FUZZ_TEST (BrushTest, EncodeDecodeValidBrushBehaviorNodeRoundTrip)
9931000 .WithDomains(SerializableBrushBehaviorNode());
9941001
995- void GetMaxProtoVersion (const google::protobuf::Message& message,
996- int32_t & max_version_out) {
997- const google::protobuf::Descriptor* descriptor = message.GetDescriptor ();
1002+ void GetMaxProtoVersion (const Message& message, int32_t & max_version_out) {
1003+ const Descriptor* descriptor = message.GetDescriptor ();
9981004 if (descriptor->options ().HasExtension (ink::proto::message_min_version)) {
9991005 int32_t message_version =
10001006 descriptor->options ().GetExtension (ink::proto::message_min_version);
10011007 EXPECT_THAT (message_version, Le (Version::kDevelopment ().value ()));
10021008 max_version_out = std::max (max_version_out, message_version);
10031009 }
10041010
1005- const google::protobuf:: Reflection* reflection = message.GetReflection ();
1006- std::vector<const google::protobuf:: FieldDescriptor*> fields;
1011+ const Reflection* reflection = message.GetReflection ();
1012+ std::vector<const FieldDescriptor*> fields;
10071013 reflection->ListFields (message, &fields);
10081014
10091015 for (const auto * field : fields) {
@@ -1014,10 +1020,10 @@ void GetMaxProtoVersion(const google::protobuf::Message& message,
10141020 max_version_out = std::max (max_version_out, field_version);
10151021 }
10161022
1017- if (field->cpp_type () == google::protobuf:: FieldDescriptor::CPPTYPE_ENUM ) {
1023+ if (field->cpp_type () == FieldDescriptor::CPPTYPE_ENUM ) {
10181024 if (field->is_repeated ()) {
10191025 for (int i = 0 ; i < reflection->FieldSize (message, field); ++i) {
1020- const google::protobuf:: EnumValueDescriptor* enum_value =
1026+ const EnumValueDescriptor* enum_value =
10211027 reflection->GetRepeatedEnum (message, field, i);
10221028 if (enum_value->options ().HasExtension (
10231029 ink::proto::enum_value_min_version)) {
@@ -1029,7 +1035,7 @@ void GetMaxProtoVersion(const google::protobuf::Message& message,
10291035 }
10301036 }
10311037 } else {
1032- const google::protobuf:: EnumValueDescriptor* enum_value =
1038+ const EnumValueDescriptor* enum_value =
10331039 reflection->GetEnum (message, field);
10341040 if (enum_value->options ().HasExtension (
10351041 ink::proto::enum_value_min_version)) {
@@ -1039,7 +1045,7 @@ void GetMaxProtoVersion(const google::protobuf::Message& message,
10391045 max_version_out = std::max (max_version_out, enum_value_version);
10401046 }
10411047 }
1042- } else if (field->cpp_type () == google::protobuf:: FieldDescriptor::CPPTYPE_MESSAGE ) {
1048+ } else if (field->cpp_type () == FieldDescriptor::CPPTYPE_MESSAGE ) {
10431049 if (field->is_repeated ()) {
10441050 for (int i = 0 ; i < reflection->FieldSize (message, field); ++i) {
10451051 GetMaxProtoVersion (reflection->GetRepeatedMessage (message, field, i),
@@ -1074,9 +1080,9 @@ FUZZ_TEST(BrushTest, CalculateMinimumRequiredVersionMatchesProtoOptions)
10741080 .WithDomains(SerializableBrushFamily());
10751081
10761082void CheckMinVersionExistsAndIsValid (
1077- const google::protobuf:: Descriptor* descriptor,
1078- absl::flat_hash_set<const google::protobuf:: Descriptor*>& visited_messages,
1079- absl::flat_hash_set<const google::protobuf:: EnumDescriptor*>& visited_enums) {
1083+ const Descriptor* descriptor,
1084+ absl::flat_hash_set<const Descriptor*>& visited_messages,
1085+ absl::flat_hash_set<const EnumDescriptor*>& visited_enums) {
10801086 if (visited_messages.contains (descriptor) ||
10811087 descriptor->file ()->name () !=
10821088 " third_party/ink/storage/proto/brush_family.proto" ||
@@ -1099,7 +1105,7 @@ void CheckMinVersionExistsAndIsValid(
10991105 }
11001106
11011107 for (int i = 0 ; i < descriptor->field_count (); ++i) {
1102- const google::protobuf:: FieldDescriptor* field = descriptor->field (i);
1108+ const FieldDescriptor* field = descriptor->field (i);
11031109 EXPECT_TRUE (field->options ().HasExtension (ink::proto::field_min_version))
11041110 << " Field " << field->full_name ()
11051111 << " is missing field_min_version option." ;
@@ -1108,20 +1114,19 @@ void CheckMinVersionExistsAndIsValid(
11081114 if (field_version != Version::kDevelopment ().value ()) {
11091115 EXPECT_THAT (field_version, Le (Version::kMaxSupported ().value ()));
11101116 }
1111- if (field->cpp_type () == google::protobuf:: FieldDescriptor::CPPTYPE_MESSAGE ) {
1117+ if (field->cpp_type () == FieldDescriptor::CPPTYPE_MESSAGE ) {
11121118 CheckMinVersionExistsAndIsValid (field->message_type (), visited_messages,
11131119 visited_enums);
1114- } else if (field->cpp_type () == google::protobuf:: FieldDescriptor::CPPTYPE_ENUM ) {
1115- const google::protobuf:: EnumDescriptor* enum_descriptor = field->enum_type ();
1120+ } else if (field->cpp_type () == FieldDescriptor::CPPTYPE_ENUM ) {
1121+ const EnumDescriptor* enum_descriptor = field->enum_type ();
11161122 if (enum_descriptor->file ()->name () !=
11171123 " third_party/ink/storage/proto/brush_family.proto" ) {
11181124 continue ;
11191125 }
11201126 if (visited_enums.contains (enum_descriptor)) continue ;
11211127 visited_enums.insert (enum_descriptor);
11221128 for (int j = 0 ; j < enum_descriptor->value_count (); ++j) {
1123- const google::protobuf::EnumValueDescriptor* enum_value =
1124- enum_descriptor->value (j);
1129+ const EnumValueDescriptor* enum_value = enum_descriptor->value (j);
11251130 EXPECT_TRUE (enum_value->options ().HasExtension (
11261131 ink::proto::enum_value_min_version))
11271132 << " Enum value " << enum_value->full_name ()
@@ -1144,8 +1149,8 @@ TEST(BrushTest,
11441149 // kDevelopment. This ensures that they are well documented, valid to be
11451150 // loaded, and will be covered by the
11461151 // `CalculateMinimumRequiredVersionMatchesProtoOptions` test.
1147- absl::flat_hash_set<const google::protobuf:: Descriptor*> visited_messages;
1148- absl::flat_hash_set<const google::protobuf:: EnumDescriptor*> visited_enums;
1152+ absl::flat_hash_set<const Descriptor*> visited_messages;
1153+ absl::flat_hash_set<const EnumDescriptor*> visited_enums;
11491154 CheckMinVersionExistsAndIsValid (proto::BrushFamily::descriptor (),
11501155 visited_messages, visited_enums);
11511156}
0 commit comments