Add explicit Result::ok() checks where needed
This is part of a large-scale cleanup to remove operator bool() from
android::base::expected. For more details, see aosp/1533001.
Bug: 176148206
Test: m checkbuild continuous_instrumentation_tests continuous_instrumentation_tests_api_coverage continuous_native_tests device-tests platform_tests
Exempt-From-Owner-Approval: mechanical large-scale change
Change-Id: Iec637c7019927485dd1d814d38471e617276764f
diff --git a/libs/input/tests/InputDevice_test.cpp b/libs/input/tests/InputDevice_test.cpp
index e2cf245..f8f2f4e 100644
--- a/libs/input/tests/InputDevice_test.cpp
+++ b/libs/input/tests/InputDevice_test.cpp
@@ -43,7 +43,7 @@
KEY_LAYOUT);
ASSERT_FALSE(path.empty());
base::Result<std::shared_ptr<KeyLayoutMap>> ret = KeyLayoutMap::load(path);
- ASSERT_TRUE(ret) << "Cannot load KeyLayout at " << path;
+ ASSERT_TRUE(ret.ok()) << "Cannot load KeyLayout at " << path;
mKeyMap.keyLayoutMap = std::move(*ret);
mKeyMap.keyLayoutFile = path;
}
@@ -58,7 +58,7 @@
ASSERT_FALSE(path.empty()) << "KeyCharacterMap for " << name << " not found";
base::Result<std::shared_ptr<KeyCharacterMap>> ret =
KeyCharacterMap::load(path, KeyCharacterMap::Format::BASE);
- ASSERT_TRUE(ret) << "Cannot load KeyCharacterMap at " << path;
+ ASSERT_TRUE(ret.ok()) << "Cannot load KeyCharacterMap at " << path;
mKeyMap.keyCharacterMap = *ret;
mKeyMap.keyCharacterMapFile = path;
}
@@ -82,4 +82,4 @@
ASSERT_EQ(*map, *mKeyMap.keyCharacterMap);
}
-} // namespace android
\ No newline at end of file
+} // namespace android