diff options
author | Josh Gao <jmgao@google.com> | 2020-03-02 20:46:15 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2020-03-02 20:46:15 +0000 |
commit | 9978c367548fa29473bef75dc5836000d10ad71c (patch) | |
tree | ce5381761474a3bbc1800c2abf03b665a233e65d /base/properties_test.cpp | |
parent | acb49fd07d328d6cb87fd8d9bdf49fbbaffe58a4 (diff) | |
parent | bbe3385097750842a8d87b9d3d0248c937dcdb97 (diff) |
Merge changes Ib97acc6d,I8f14004a,Id5bbfd6d,I4dfc3f52 into rvc-dev
* changes:
adbd: add runtime-configurable logging.
adb: don't hardcode ports in test_adb.
adbd: add usb thread spawn logging.
base: add CachedProperty.
Diffstat (limited to 'base/properties_test.cpp')
-rw-r--r-- | base/properties_test.cpp | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/base/properties_test.cpp b/base/properties_test.cpp index e7d4880c26..c30c41e8a5 100644 --- a/base/properties_test.cpp +++ b/base/properties_test.cpp @@ -230,3 +230,28 @@ TEST(properties, WaitForPropertyCreation_timeout) { GTEST_LOG_(INFO) << "This test does nothing on the host.\n"; #endif } + +TEST(properties, CachedProperty) { +#if defined(__BIONIC__) + android::base::CachedProperty cached_property("debug.libbase.CachedProperty_test"); + bool changed; + cached_property.Get(&changed); + + android::base::SetProperty("debug.libbase.CachedProperty_test", "foo"); + ASSERT_STREQ("foo", cached_property.Get(&changed)); + ASSERT_TRUE(changed); + + ASSERT_STREQ("foo", cached_property.Get(&changed)); + ASSERT_FALSE(changed); + + android::base::SetProperty("debug.libbase.CachedProperty_test", "bar"); + ASSERT_STREQ("bar", cached_property.Get(&changed)); + ASSERT_TRUE(changed); + + ASSERT_STREQ("bar", cached_property.Get(&changed)); + ASSERT_FALSE(changed); + +#else + GTEST_LOG_(INFO) << "This test does nothing on the host.\n"; +#endif +} |