| 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 f7e301823ac473fdc39d3d2a39e63e63d21743a2..2a7d38c6b5c34fd1ab969ca695461caf1152af3b 100644
|
| --- a/third_party/WebKit/Source/core/css/CSSStyleSheetResourceTest.cpp
|
| +++ b/third_party/WebKit/Source/core/css/CSSStyleSheetResourceTest.cpp
|
| @@ -60,73 +60,6 @@ class CSSStyleSheetResourceTest : public ::testing::Test {
|
| std::unique_ptr<DummyPageHolder> m_page;
|
| };
|
|
|
| -TEST_F(CSSStyleSheetResourceTest, PruneCanCauseEviction) {
|
| - {
|
| - // We need this scope to remove all references.
|
| - KURL imageURL(KURL(), "https://localhost/image");
|
| - KURL cssURL(KURL(), "https://localhost/style.css");
|
| -
|
| - // We need to disable loading because we manually give a response to
|
| - // the image resource.
|
| - document().fetcher()->setAutoLoadImages(false);
|
| -
|
| - CSSStyleSheetResource* cssResource =
|
| - CSSStyleSheetResource::createForTest(ResourceRequest(cssURL), "utf-8");
|
| - memoryCache()->add(cssResource);
|
| - cssResource->responseReceived(
|
| - ResourceResponse(cssURL, "style/css", 0, nullAtom, String()), nullptr);
|
| - cssResource->finish();
|
| -
|
| - StyleSheetContents* contents =
|
| - StyleSheetContents::create(CSSParserContext(HTMLStandardMode, nullptr));
|
| - CSSStyleSheet* sheet = CSSStyleSheet::create(contents, document());
|
| - EXPECT_TRUE(sheet);
|
| - CSSCrossfadeValue* crossfade = CSSCrossfadeValue::create(
|
| - CSSImageValue::create(String("image"), imageURL),
|
| - CSSImageValue::create(String("image"), imageURL),
|
| - CSSPrimitiveValue::create(1.0, CSSPrimitiveValue::UnitType::Number));
|
| - Vector<std::unique_ptr<CSSParserSelector>> selectors;
|
| - selectors.append(makeUnique<CSSParserSelector>());
|
| - selectors[0]->setMatch(CSSSelector::Id);
|
| - selectors[0]->setValue("foo");
|
| - CSSProperty property(CSSPropertyBackground, *crossfade);
|
| - contents->parserAppendRule(StyleRule::create(
|
| - CSSSelectorList::adoptSelectorVector(selectors),
|
| - ImmutableStylePropertySet::create(&property, 1, HTMLStandardMode)));
|
| -
|
| - crossfade->loadSubimages(document());
|
| - Resource* imageResource = memoryCache()->resourceForURL(
|
| - imageURL, MemoryCache::defaultCacheIdentifier());
|
| - ASSERT_TRUE(imageResource);
|
| - ResourceResponse imageResponse;
|
| - imageResponse.setURL(imageURL);
|
| - imageResponse.setHTTPHeaderField("cache-control", "no-store");
|
| - imageResource->responseReceived(imageResponse, nullptr);
|
| -
|
| - contents->checkLoaded();
|
| - cssResource->saveParsedStyleSheet(contents);
|
| -
|
| - memoryCache()->update(cssResource, cssResource->size(), cssResource->size(),
|
| - false);
|
| - memoryCache()->update(imageResource, imageResource->size(),
|
| - imageResource->size(), false);
|
| - if (!memoryCache()->isInSameLRUListForTest(cssResource, imageResource)) {
|
| - // We assume that the LRU list is determined by |size / accessCount|.
|
| - for (size_t i = 0; i < cssResource->size() + 1; ++i)
|
| - memoryCache()->update(cssResource, cssResource->size(),
|
| - cssResource->size(), true);
|
| - for (size_t i = 0; i < imageResource->size() + 1; ++i)
|
| - memoryCache()->update(imageResource, imageResource->size(),
|
| - imageResource->size(), true);
|
| - }
|
| - ASSERT_TRUE(
|
| - memoryCache()->isInSameLRUListForTest(cssResource, imageResource));
|
| - }
|
| - ThreadState::current()->collectAllGarbage();
|
| - // This operation should not lead to crash!
|
| - memoryCache()->pruneAll();
|
| -}
|
| -
|
| TEST_F(CSSStyleSheetResourceTest, DuplicateResourceNotCached) {
|
| const char url[] = "https://localhost/style.css";
|
| KURL imageURL(KURL(), url);
|
|
|