summaryrefslogtreecommitdiff
path: root/absl/strings/internal/cordz_info_test.cc
diff options
context:
space:
mode:
authorGravatar Abseil Team <absl-team@google.com>2021-05-06 20:08:01 -0700
committerGravatar Andy Getz <durandal@google.com>2021-05-07 13:51:04 -0400
commit079cf662544a14bd1cfaae6d6512645541ba10fb (patch)
tree99d164c0162508aa69ace6879d9a36f89e145065 /absl/strings/internal/cordz_info_test.cc
parent70b29fe5a5c1752158830eabc9aa273718b477af (diff)
Export of internal Abseil changes
-- 51e9291d9bc385082b4061fe760b236ba59c79c3 by Abseil Team <absl-team@google.com>: Cast to uint64_t using braces instead of parentheses. PiperOrigin-RevId: 372475909 -- 939fc409855da2639dcaf2d1d4971ca0e0568d03 by Martijn Vels <mvels@google.com>: Expand # flat nodes into size detailed counters. PiperOrigin-RevId: 372474608 -- 54b158c99b32f8a14821ce74fed0f9f836525ce7 by Martijn Vels <mvels@google.com>: Make copies of sampled cords sampled as well This applies to the following methods: - Cord(const Cord&) - operator=(const Cord&) - Subcord(...) PiperOrigin-RevId: 372468160 -- 876c2581ce008871464e8b471efbb967d150f83b by Andy Getzendanner <durandal@google.com>: Document the type of an ABSL_FLAGS.OnUpdate() callback. PiperOrigin-RevId: 372406390 GitOrigin-RevId: 51e9291d9bc385082b4061fe760b236ba59c79c3 Change-Id: Ifb75122cae56b66c28128aee90a63bbb28d93817
Diffstat (limited to 'absl/strings/internal/cordz_info_test.cc')
-rw-r--r--absl/strings/internal/cordz_info_test.cc27
1 files changed, 14 insertions, 13 deletions
diff --git a/absl/strings/internal/cordz_info_test.cc b/absl/strings/internal/cordz_info_test.cc
index b7eb910d..59a8c525 100644
--- a/absl/strings/internal/cordz_info_test.cc
+++ b/absl/strings/internal/cordz_info_test.cc
@@ -74,6 +74,20 @@ TEST(CordzInfoTest, TrackCord) {
info->Untrack();
}
+TEST(CordzInfoTest, MaybeTrackCordOnSampledCord) {
+ TestCordData data1;
+ CordzInfo::TrackCord(data1.data, kTrackCordMethod);
+ CordzInfo* info1 = data1.data.cordz_info();
+ TestCordData data2;
+ CordzInfo::MaybeTrackCord(data2.data, data1.data, kTrackCordMethod);
+ CordzInfo* info2 = data2.data.cordz_info();
+ ASSERT_THAT(info2, Ne(nullptr));
+ EXPECT_THAT(info2->GetCordRepForTesting(), Eq(data2.rep.rep));
+ info2->Untrack();
+ info1->Untrack();
+}
+
+
TEST(CordzInfoTest, UntrackCord) {
TestCordData data;
CordzInfo::TrackCord(data.data, kTrackCordMethod);
@@ -291,19 +305,6 @@ TEST(CordzInfoTest, FromParent) {
info_child->Untrack();
}
-TEST(CordzInfoTest, FromParentInlined) {
- InlineData parent;
- TestCordData child;
- CordzInfo* info = TrackChildCord(child.data, parent);
- EXPECT_TRUE(info->GetParentStack().empty());
- CordzStatistics statistics = info->GetCordzStatistics();
- EXPECT_THAT(statistics.size, Eq(child.rep.rep->length));
- EXPECT_THAT(statistics.method, Eq(kChildMethod));
- EXPECT_THAT(statistics.parent_method, Eq(kUnknownMethod));
- EXPECT_THAT(statistics.update_tracker.Value(kChildMethod), Eq(1));
- info->Untrack();
-}
-
} // namespace
} // namespace cord_internal
ABSL_NAMESPACE_END