| 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
|
|
|