| 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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 // the image resource. | 71 // the image resource. |
| 72 document()->fetcher()->setAutoLoadImages(false); | 72 document()->fetcher()->setAutoLoadImages(false); |
| 73 | 73 |
| 74 ResourcePtr<CSSStyleSheetResource> cssResource = CSSStyleSheetResource::
createForTest(ResourceRequest(cssURL), "utf-8"); | 74 ResourcePtr<CSSStyleSheetResource> cssResource = CSSStyleSheetResource::
createForTest(ResourceRequest(cssURL), "utf-8"); |
| 75 memoryCache()->add(cssResource.get()); | 75 memoryCache()->add(cssResource.get()); |
| 76 cssResource->responseReceived(ResourceResponse(cssURL, "style/css", 0, n
ullAtom, String()), nullptr); | 76 cssResource->responseReceived(ResourceResponse(cssURL, "style/css", 0, n
ullAtom, String()), nullptr); |
| 77 cssResource->finish(); | 77 cssResource->finish(); |
| 78 | 78 |
| 79 RefPtrWillBeRawPtr<StyleSheetContents> contents = StyleSheetContents::cr
eate(CSSParserContext(HTMLStandardMode, nullptr)); | 79 RefPtrWillBeRawPtr<StyleSheetContents> contents = StyleSheetContents::cr
eate(CSSParserContext(HTMLStandardMode, nullptr)); |
| 80 RefPtrWillBeRawPtr<CSSStyleSheet> sheet = CSSStyleSheet::create(contents
, document()); | 80 RefPtrWillBeRawPtr<CSSStyleSheet> sheet = CSSStyleSheet::create(contents
, document()); |
| 81 EXPECT_TRUE(sheet.get()); |
| 81 RefPtrWillBeRawPtr<CSSCrossfadeValue> crossfade = CSSCrossfadeValue::cre
ate( | 82 RefPtrWillBeRawPtr<CSSCrossfadeValue> crossfade = CSSCrossfadeValue::cre
ate( |
| 82 CSSImageValue::create(String("image"), imageURL), | 83 CSSImageValue::create(String("image"), imageURL), |
| 83 CSSImageValue::create(String("image"), imageURL), | 84 CSSImageValue::create(String("image"), imageURL), |
| 84 CSSPrimitiveValue::create(1.0, CSSPrimitiveValue::UnitType::Number))
; | 85 CSSPrimitiveValue::create(1.0, CSSPrimitiveValue::UnitType::Number))
; |
| 85 Vector<OwnPtr<CSSParserSelector>> selectors; | 86 Vector<OwnPtr<CSSParserSelector>> selectors; |
| 86 selectors.append(adoptPtr(new CSSParserSelector())); | 87 selectors.append(adoptPtr(new CSSParserSelector())); |
| 87 selectors[0]->setMatch(CSSSelector::Id); | 88 selectors[0]->setMatch(CSSSelector::Id); |
| 88 selectors[0]->setValue("foo"); | 89 selectors[0]->setValue("foo"); |
| 89 CSSProperty property(CSSPropertyBackground, crossfade); | 90 CSSProperty property(CSSPropertyBackground, crossfade); |
| 90 contents->parserAppendRule( | 91 contents->parserAppendRule( |
| (...skipping 21 matching lines...) Expand all Loading... |
| 112 } | 113 } |
| 113 ASSERT_TRUE(memoryCache()->isInSameLRUListForTest(cssResource.get(), ima
geResource.get())); | 114 ASSERT_TRUE(memoryCache()->isInSameLRUListForTest(cssResource.get(), ima
geResource.get())); |
| 114 } | 115 } |
| 115 Heap::collectAllGarbage(); | 116 Heap::collectAllGarbage(); |
| 116 // This operation should not lead to crash! | 117 // This operation should not lead to crash! |
| 117 memoryCache()->pruneAll(); | 118 memoryCache()->pruneAll(); |
| 118 } | 119 } |
| 119 | 120 |
| 120 } // namespace | 121 } // namespace |
| 121 } // namespace blink | 122 } // namespace blink |
| OLD | NEW |