| OLD | NEW |
| 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" |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 | 127 |
| 128 Resource* imageResource = ImageResource::create(ResourceRequest(imageURL)); | 128 Resource* imageResource = ImageResource::create(ResourceRequest(imageURL)); |
| 129 ASSERT_TRUE(imageResource); | 129 ASSERT_TRUE(imageResource); |
| 130 memoryCache()->add(imageResource); | 130 memoryCache()->add(imageResource); |
| 131 ASSERT_TRUE(memoryCache()->contains(imageResource)); | 131 ASSERT_TRUE(memoryCache()->contains(imageResource)); |
| 132 | 132 |
| 133 CSSStyleSheetResource* cssResource = CSSStyleSheetResource::createForTest(Re
sourceRequest(cssURL), "utf-8"); | 133 CSSStyleSheetResource* cssResource = CSSStyleSheetResource::createForTest(Re
sourceRequest(cssURL), "utf-8"); |
| 134 cssResource->responseReceived(ResourceResponse(cssURL, "style/css", 0, nullA
tom, String()), nullptr); | 134 cssResource->responseReceived(ResourceResponse(cssURL, "style/css", 0, nullA
tom, String()), nullptr); |
| 135 cssResource->finish(); | 135 cssResource->finish(); |
| 136 | 136 |
| 137 StyleSheetContents* contents = StyleSheetContents::create(CSSParserContext(H
TMLStandardMode, nullptr)); | 137 CSSParserContext parserContext(HTMLStandardMode, nullptr); |
| 138 StyleSheetContents* contents = StyleSheetContents::create(parserContext); |
| 138 CSSStyleSheet* sheet = CSSStyleSheet::create(contents, document()); | 139 CSSStyleSheet* sheet = CSSStyleSheet::create(contents, document()); |
| 139 EXPECT_TRUE(sheet); | 140 EXPECT_TRUE(sheet); |
| 140 | 141 |
| 141 contents->checkLoaded(); | 142 contents->checkLoaded(); |
| 142 cssResource->saveParsedStyleSheet(contents); | 143 cssResource->saveParsedStyleSheet(contents); |
| 143 | 144 |
| 144 // Verify that the cache will have a mapping for |imageResource| at |url|. | 145 // Verify that the cache will have a mapping for |imageResource| at |url|. |
| 145 // The underlying |contents| for the stylesheet resource must have a | 146 // The underlying |contents| for the stylesheet resource must have a |
| 146 // matching cache status. | 147 // matching cache status. |
| 147 ASSERT_TRUE(memoryCache()->contains(imageResource)); | 148 EXPECT_TRUE(memoryCache()->contains(imageResource)); |
| 148 ASSERT_FALSE(memoryCache()->contains(cssResource)); | 149 EXPECT_FALSE(memoryCache()->contains(cssResource)); |
| 149 ASSERT_FALSE(contents->isInMemoryCache()); | 150 EXPECT_FALSE(contents->isInMemoryCache()); |
| 151 EXPECT_FALSE(cssResource->restoreParsedStyleSheet(parserContext)); |
| 150 } | 152 } |
| 151 | 153 |
| 152 } // namespace | 154 } // namespace |
| 153 } // namespace blink | 155 } // namespace blink |
| OLD | NEW |