Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1585)

Unified Diff: tests/HashTest.cpp

Issue 2253993002: SkPDF: cache metrics once. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« src/pdf/SkPDFFont.cpp ('K') | « src/pdf/SkPDFFont.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/HashTest.cpp
diff --git a/tests/HashTest.cpp b/tests/HashTest.cpp
index c9b1bc967bd852bbf848e8c2f166d8e05da70187..70567c7522df8a76521cac98edf182a1969b1e2e 100644
--- a/tests/HashTest.cpp
+++ b/tests/HashTest.cpp
@@ -90,67 +90,3 @@ DEF_TEST(HashSet, r) {
REPORTER_ASSERT(r, set.count() == 0);
}
-namespace {
-
-class CopyCounter {
-public:
- CopyCounter() : fID(0), fCounter(nullptr) {}
-
- CopyCounter(uint32_t id, uint32_t* counter) : fID(id), fCounter(counter) {}
-
- CopyCounter(const CopyCounter& other)
- : fID(other.fID)
- , fCounter(other.fCounter) {
- SkASSERT(fCounter);
- *fCounter += 1;
- }
-
- void operator=(const CopyCounter& other) {
- fID = other.fID;
- fCounter = other.fCounter;
- *fCounter += 1;
- }
-
- bool operator==(const CopyCounter& other) const {
- return fID == other.fID;
- }
-
-private:
- uint32_t fID;
- uint32_t* fCounter;
-};
-
-struct HashCopyCounter {
- uint32_t operator()(const CopyCounter&) const {
- return 0; // let them collide, what do we care?
- }
-};
-
-}
-
-DEF_TEST(HashSetCopyCounter, r) {
- SkTHashSet<CopyCounter, HashCopyCounter> set;
-
- uint32_t globalCounter = 0;
- CopyCounter copyCounter1(1, &globalCounter);
- CopyCounter copyCounter2(2, &globalCounter);
- REPORTER_ASSERT(r, globalCounter == 0);
-
- set.add(copyCounter1);
- REPORTER_ASSERT(r, globalCounter == 1);
- REPORTER_ASSERT(r, set.contains(copyCounter1));
- REPORTER_ASSERT(r, globalCounter == 1);
- set.add(copyCounter1);
- // We allow copies for same-value adds for now.
- REPORTER_ASSERT(r, globalCounter == 2);
-
- set.add(copyCounter2);
- REPORTER_ASSERT(r, globalCounter == 3);
- REPORTER_ASSERT(r, set.contains(copyCounter1));
- REPORTER_ASSERT(r, set.contains(copyCounter2));
- REPORTER_ASSERT(r, globalCounter == 3);
- set.add(copyCounter1);
- set.add(copyCounter2);
- // We allow copies for same-value adds for now.
- REPORTER_ASSERT(r, globalCounter == 5);
-}
« src/pdf/SkPDFFont.cpp ('K') | « src/pdf/SkPDFFont.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698