diff options
| author | Colin Cross <ccross@android.com> | 2017-02-23 17:48:08 -0800 |
|---|---|---|
| committer | Colin Cross <ccross@android.com> | 2017-02-23 21:25:18 -0800 |
| commit | fe06c63301798ceb4374953d92fa1559f01f5fb8 (patch) | |
| tree | b5699feda389889f547f6483d97300acfbc54663 | |
| parent | b0145091a7a7503178fe47e6bfbe0de03caa4ba0 (diff) | |
| download | system_core-fe06c63301798ceb4374953d92fa1559f01f5fb8.tar.gz system_core-fe06c63301798ceb4374953d92fa1559f01f5fb8.tar.bz2 system_core-fe06c63301798ceb4374953d92fa1559f01f5fb8.zip | |
Fix ODR issue in StrongPointer_test.cpp
StrongPointer_test.cpp's Foo was colliding with RefBase_test.cpp's
Foo.
Test: out/host/linux-x86/nativetest64/libutils_tests/libutils_tests
from later CL
Change-Id: I2a4e956c88a07cec72d7ce734cf06c58134a4235
| -rw-r--r-- | libutils/tests/StrongPointer_test.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/libutils/tests/StrongPointer_test.cpp b/libutils/tests/StrongPointer_test.cpp index 323a6f20a..153cf9683 100644 --- a/libutils/tests/StrongPointer_test.cpp +++ b/libutils/tests/StrongPointer_test.cpp @@ -21,13 +21,13 @@ using namespace android; -class Foo : public LightRefBase<Foo> { +class SPFoo : public LightRefBase<SPFoo> { public: - explicit Foo(bool* deleted_check) : mDeleted(deleted_check) { + explicit SPFoo(bool* deleted_check) : mDeleted(deleted_check) { *mDeleted = false; } - ~Foo() { + ~SPFoo() { *mDeleted = true; } private: @@ -36,13 +36,13 @@ private: TEST(StrongPointer, move) { bool isDeleted; - Foo* foo = new Foo(&isDeleted); + SPFoo* foo = new SPFoo(&isDeleted); ASSERT_EQ(0, foo->getStrongCount()); ASSERT_FALSE(isDeleted) << "Already deleted...?"; - sp<Foo> sp1(foo); + sp<SPFoo> sp1(foo); ASSERT_EQ(1, foo->getStrongCount()); { - sp<Foo> sp2 = std::move(sp1); + sp<SPFoo> sp2 = std::move(sp1); ASSERT_EQ(1, foo->getStrongCount()) << "std::move failed, incremented refcnt"; ASSERT_EQ(nullptr, sp1.get()) << "std::move failed, sp1 is still valid"; // The strong count isn't increasing, let's double check the old object @@ -52,7 +52,7 @@ TEST(StrongPointer, move) { ASSERT_FALSE(isDeleted) << "deleted too early! still has a reference!"; { // Now let's double check it deletes on time - sp<Foo> sp2 = std::move(sp1); + sp<SPFoo> sp2 = std::move(sp1); } ASSERT_TRUE(isDeleted) << "foo was leaked!"; } |
