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

Side by Side 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: Remove some comments Created 4 years, 7 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "core/fetch/CSSStyleSheetResource.h" 5 #include "core/fetch/CSSStyleSheetResource.h"
6 6
7 #include "core/css/CSSCrossfadeValue.h" 7 #include "core/css/CSSCrossfadeValue.h"
8 #include "core/css/CSSImageValue.h" 8 #include "core/css/CSSImageValue.h"
9 #include "core/css/CSSPrimitiveValue.h" 9 #include "core/css/CSSPrimitiveValue.h"
10 #include "core/css/CSSProperty.h" 10 #include "core/css/CSSProperty.h"
11 #include "core/css/CSSSelectorList.h" 11 #include "core/css/CSSSelectorList.h"
12 #include "core/css/CSSStyleSheet.h" 12 #include "core/css/CSSStyleSheet.h"
13 #include "core/css/StylePropertySet.h" 13 #include "core/css/StylePropertySet.h"
14 #include "core/css/StyleRule.h" 14 #include "core/css/StyleRule.h"
15 #include "core/css/StyleSheetContents.h" 15 #include "core/css/StyleSheetContents.h"
16 #include "core/css/parser/CSSParserMode.h" 16 #include "core/css/parser/CSSParserMode.h"
17 #include "core/css/parser/CSSParserSelector.h" 17 #include "core/css/parser/CSSParserSelector.h"
18 #include "core/dom/Document.h" 18 #include "core/dom/Document.h"
19 #include "core/fetch/FetchContext.h" 19 #include "core/fetch/FetchContext.h"
20 #include "core/fetch/FetchInitiatorTypeNames.h" 20 #include "core/fetch/FetchInitiatorTypeNames.h"
21 #include "core/fetch/FetchRequest.h" 21 #include "core/fetch/FetchRequest.h"
22 #include "core/fetch/MemoryCache.h" 22 #include "core/fetch/MemoryCache.h"
23 #include "core/fetch/ResourceFetcher.h" 23 #include "core/fetch/ResourceFetcher.h"
24 #include "core/testing/DummyPageHolder.h" 24 #include "core/testing/DummyPageHolder.h"
25 #include "platform/heap/Handle.h" 25 #include "platform/heap/Handle.h"
26 #include "platform/heap/Heap.h"
26 #include "platform/network/ResourceRequest.h" 27 #include "platform/network/ResourceRequest.h"
27 #include "platform/testing/URLTestHelpers.h" 28 #include "platform/testing/URLTestHelpers.h"
28 #include "platform/testing/UnitTestHelpers.h" 29 #include "platform/testing/UnitTestHelpers.h"
29 #include "platform/weborigin/KURL.h" 30 #include "platform/weborigin/KURL.h"
30 #include "public/platform/Platform.h" 31 #include "public/platform/Platform.h"
31 #include "public/platform/WebURLResponse.h" 32 #include "public/platform/WebURLResponse.h"
32 #include "testing/gtest/include/gtest/gtest.h" 33 #include "testing/gtest/include/gtest/gtest.h"
33 #include "wtf/RefPtr.h" 34 #include "wtf/RefPtr.h"
34 #include "wtf/text/WTFString.h" 35 #include "wtf/text/WTFString.h"
35 36
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 CSSParserContext parserContext(HTMLStandardMode, nullptr); 138 CSSParserContext parserContext(HTMLStandardMode, nullptr);
138 StyleSheetContents* contents = StyleSheetContents::create(parserContext); 139 StyleSheetContents* contents = StyleSheetContents::create(parserContext);
139 CSSStyleSheet* sheet = CSSStyleSheet::create(contents, document()); 140 CSSStyleSheet* sheet = CSSStyleSheet::create(contents, document());
140 EXPECT_TRUE(sheet); 141 EXPECT_TRUE(sheet);
141 142
142 contents->checkLoaded(); 143 contents->checkLoaded();
143 cssResource->saveParsedStyleSheet(contents); 144 cssResource->saveParsedStyleSheet(contents);
144 145
145 // Verify that the cache will have a mapping for |imageResource| at |url|. 146 // Verify that the cache will have a mapping for |imageResource| at |url|.
146 // The underlying |contents| for the stylesheet resource must have a 147 // The underlying |contents| for the stylesheet resource must have a
147 // matching cache status. 148 // matching reference status.
148 EXPECT_TRUE(memoryCache()->contains(imageResource)); 149 EXPECT_TRUE(memoryCache()->contains(imageResource));
149 EXPECT_FALSE(memoryCache()->contains(cssResource)); 150 EXPECT_FALSE(memoryCache()->contains(cssResource));
150 EXPECT_FALSE(contents->isInMemoryCache()); 151 EXPECT_FALSE(contents->isReferencedFromResource());
151 EXPECT_FALSE(cssResource->restoreParsedStyleSheet(parserContext)); 152 EXPECT_FALSE(cssResource->restoreParsedStyleSheet(parserContext));
152 } 153 }
153 154
154 } // namespace 155 } // namespace
155 } // namespace blink 156 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/css/CSSStyleSheet.cpp ('k') | third_party/WebKit/Source/core/css/StyleSheetContents.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698