Commit 843ce374 authored by Yoichi Osato's avatar Yoichi Osato Committed by Commit Bot

Add Resource memory size test

First, I broke the calculation by change initialization order:
https://chromium-review.googlesource.com/c/chromium/src/+/1948393
That caused apparent memory improvement.
Then another my CL fixed the order:
https://chromium-review.googlesource.com/c/chromium/src/+/2099668
Now bots computes memory size appropriately as same as before.

This CL adds a test so that no such false regression.

Bug: 1062837
Change-Id: If76707cae97f0037664facd901bfea45241c66f6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2114479Reviewed-by: default avatarYutaka Hirano <yhirano@chromium.org>
Commit-Queue: Yoichi Osato <yoichio@chromium.org>
Cr-Commit-Position: refs/heads/master@{#753462}
parent aeb94ecd
......@@ -419,6 +419,10 @@ class PLATFORM_EXPORT Resource : public GarbageCollected<Resource>,
// The caller owns the |clock| which must outlive the Resource.
static void SetClockForTesting(const base::Clock* clock);
size_t CalculateOverheadSizeForTest() const {
return CalculateOverheadSize();
}
protected:
Resource(const ResourceRequestHead&,
ResourceType,
......
......@@ -575,4 +575,11 @@ TEST(ResourceTest, StaleWhileRevalidateCacheControlWithRedirect) {
EXPECT_TRUE(resource->StaleRevalidationRequested());
}
// This is a regression test for https://crbug.com/1062837.
TEST(ResourceTest, DefaultOverheadSize) {
const KURL url("http://127.0.0.1:8000/foo.html");
auto* resource = MakeGarbageCollected<MockResource>(url);
EXPECT_EQ(resource->CalculateOverheadSizeForTest(), resource->OverheadSize());
}
} // namespace blink
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment