summaryrefslogtreecommitdiff
path: root/tools/hiddenapi/hiddenapi_test.cc
diff options
context:
space:
mode:
author Martin Stjernholm <mast@google.com> 2025-02-18 22:26:18 +0000
committer Treehugger Robot <android-test-infra-autosubmit@system.gserviceaccount.com> 2025-02-19 09:35:36 -0800
commit11bd0da6cfa3fa40bc61deae0ad1e6ba230b0954 (patch)
tree0f267c513190c11c31f02fee7e75f6b518a2f70c /tools/hiddenapi/hiddenapi_test.cc
parentc154e7f57173e1afbe8159d0ec30c3be3f67e588 (diff)
Readability fixes and some API cleanup in art::hiddenapi::ApiList.
- Describe the layout in dex_flags_ better and be more explicit about the differences between the Value and DomainApi parts. - Use factory functions instead of constructors with different types. - Hide several functions not used outside the class. - Add Value::kFuture for the de-facto Value for max-target-future. - Add static assertions for more invariants. - Note a strange behaviour in Combine() that is intentionally not addressed, to keep the refactoring pure. Test: atest art_standalone_runtime_tests art_hiddenapi_tests Test: m veridex Bug: 377676642 Change-Id: I52c1e45da94ffa6fb87e314fb423bb9994381465
Diffstat (limited to 'tools/hiddenapi/hiddenapi_test.cc')
-rw-r--r--tools/hiddenapi/hiddenapi_test.cc14
1 files changed, 8 insertions, 6 deletions
diff --git a/tools/hiddenapi/hiddenapi_test.cc b/tools/hiddenapi/hiddenapi_test.cc
index 3236dddfd3..940a2630d9 100644
--- a/tools/hiddenapi/hiddenapi_test.cc
+++ b/tools/hiddenapi/hiddenapi_test.cc
@@ -190,7 +190,7 @@ class HiddenApiTest : public CommonRuntimeTest {
const uint32_t actual_visibility = field.GetAccessFlags() & kAccVisibilityFlags;
CHECK_EQ(actual_visibility, expected_visibility)
<< "Field " << name << " in class " << accessor.GetDescriptorView();
- return hiddenapi::ApiList(field.GetHiddenapiFlags());
+ return hiddenapi::ApiList::FromDexFlags(field.GetHiddenapiFlags());
}
}
@@ -219,7 +219,7 @@ class HiddenApiTest : public CommonRuntimeTest {
const uint32_t actual_visibility = method.GetAccessFlags() & kAccVisibilityFlags;
CHECK_EQ(actual_visibility, expected_visibility)
<< "Method " << name << " in class " << accessor.GetDescriptorView();
- return hiddenapi::ApiList(method.GetHiddenapiFlags());
+ return hiddenapi::ApiList::FromDexFlags(method.GetHiddenapiFlags());
}
}
@@ -700,8 +700,9 @@ TEST_F(HiddenApiTest, InstanceFieldCorePlatformApiMatch) {
<< "LMain;->ifield:I,unsupported,core-platform-api" << std::endl;
auto dex_file = RunHiddenapiEncode(flags_csv, {}, dex);
ASSERT_NE(dex_file.get(), nullptr);
- ASSERT_EQ(hiddenapi::ApiList::CorePlatformApi() |
- hiddenapi::ApiList::Unsupported(), GetIFieldHiddenFlags(*dex_file));
+ ASSERT_EQ(hiddenapi::ApiList::Combine(hiddenapi::ApiList::CorePlatformApi(),
+ hiddenapi::ApiList::Unsupported()),
+ GetIFieldHiddenFlags(*dex_file));
}
TEST_F(HiddenApiTest, InstanceFieldTestApiMatch) {
@@ -712,8 +713,9 @@ TEST_F(HiddenApiTest, InstanceFieldTestApiMatch) {
<< "LMain;->ifield:I,unsupported,test-api" << std::endl;
auto dex_file = RunHiddenapiEncode(flags_csv, {}, dex);
ASSERT_NE(dex_file.get(), nullptr);
- ASSERT_EQ(hiddenapi::ApiList::TestApi()
- | hiddenapi::ApiList::Unsupported(), GetIFieldHiddenFlags(*dex_file));
+ ASSERT_EQ(
+ hiddenapi::ApiList::Combine(hiddenapi::ApiList::TestApi(), hiddenapi::ApiList::Unsupported()),
+ GetIFieldHiddenFlags(*dex_file));
}
TEST_F(HiddenApiTest, InstanceFieldUnknownFlagMatch) {