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

Unified Diff: third_party/WebKit/Source/core/css/CSSStyleSheetResourceTest.cpp

Issue 1807323002: [WeakMemoryCache 1a] Make Reference from Inspector to Resource weak, remove removedFromMemoryCache() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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
Index: third_party/WebKit/Source/core/css/CSSStyleSheetResourceTest.cpp
diff --git a/third_party/WebKit/Source/core/css/CSSStyleSheetResourceTest.cpp b/third_party/WebKit/Source/core/css/CSSStyleSheetResourceTest.cpp
index 8ee2ea54cf450aa244e7d7fcbf8905883991d589..ea7efd9f2d96287c5c1c737280096b9b37d1c714 100644
--- a/third_party/WebKit/Source/core/css/CSSStyleSheetResourceTest.cpp
+++ b/third_party/WebKit/Source/core/css/CSSStyleSheetResourceTest.cpp
@@ -23,6 +23,7 @@
#include "core/fetch/ResourceFetcher.h"
#include "core/testing/DummyPageHolder.h"
#include "platform/heap/Handle.h"
+#include "platform/heap/Heap.h"
#include "platform/network/ResourceRequest.h"
#include "platform/testing/URLTestHelpers.h"
#include "platform/testing/UnitTestHelpers.h"
@@ -134,19 +135,25 @@ TEST_F(CSSStyleSheetResourceTest, DuplicateResourceNotCached)
cssResource->responseReceived(ResourceResponse(cssURL, "style/css", 0, nullAtom, String()), nullptr);
cssResource->finish();
- StyleSheetContents* contents = StyleSheetContents::create(CSSParserContext(HTMLStandardMode, nullptr));
+ Persistent<StyleSheetContents> contents = StyleSheetContents::create(CSSParserContext(HTMLStandardMode, nullptr));
CSSStyleSheet* sheet = CSSStyleSheet::create(contents, document());
EXPECT_TRUE(sheet);
contents->checkLoaded();
cssResource->saveParsedStyleSheet(contents);
+ ASSERT_TRUE(contents->isReferencedFromResource());
// Verify that the cache will have a mapping for |imageResource| at |url|.
- // The underlying |contents| for the stylesheet resource must have a
- // matching cache status.
ASSERT_TRUE(memoryCache()->contains(imageResource));
ASSERT_FALSE(memoryCache()->contains(cssResource));
- ASSERT_FALSE(contents->isInMemoryCache());
+
+ // Destruct |*cssResource|.
+ cssResource = nullptr;
+ ThreadHeap::collectAllGarbage();
+
+ // The underlying |contents| for the stylesheet resource must have a
+ // matching reference status.
+ ASSERT_FALSE(contents->isReferencedFromResource());
}
} // namespace

Powered by Google App Engine
This is Rietveld 408576698