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

Side by Side Diff: third_party/WebKit/Source/core/html/parser/CSSPreloadScannerTest.cpp

Issue 2487763003: [ImageLoader 2d] Set DecodeError by calling ResourceLoader::cancel()
Patch Set: Rebase Created 4 years, 1 month 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/html/parser/CSSPreloadScanner.h" 5 #include "core/html/parser/CSSPreloadScanner.h"
6 6
7 #include "core/fetch/FetchContext.h" 7 #include "core/fetch/FetchContext.h"
8 #include "core/fetch/Resource.h" 8 #include "core/fetch/Resource.h"
9 #include "core/fetch/ResourceFetcher.h" 9 #include "core/fetch/ResourceFetcher.h"
10 #include "core/frame/Settings.h" 10 #include "core/frame/Settings.h"
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 HTMLResourcePreloader* preloader = 98 HTMLResourcePreloader* preloader =
99 HTMLResourcePreloader::create(dummyPageHolder->document()); 99 HTMLResourcePreloader::create(dummyPageHolder->document());
100 100
101 KURL url(ParsedURLString, "http://127.0.0.1/foo.css"); 101 KURL url(ParsedURLString, "http://127.0.0.1/foo.css");
102 CSSStyleSheetResource* resource = 102 CSSStyleSheetResource* resource =
103 CSSStyleSheetResource::createForTest(ResourceRequest(url), "utf-8"); 103 CSSStyleSheetResource::createForTest(ResourceRequest(url), "utf-8");
104 104
105 const char* data = "@import url('http://127.0.0.1/preload.css');"; 105 const char* data = "@import url('http://127.0.0.1/preload.css');";
106 resource->appendData(data, strlen(data)); 106 resource->appendData(data, strlen(data));
107 ResourceError error(errorDomainBlinkInternal, 0, url.getString(), ""); 107 ResourceError error(errorDomainBlinkInternal, 0, url.getString(), "");
108 resource->error(error); 108 resource->error(error, Resource::LoadError);
109 109
110 // Should not crash. 110 // Should not crash.
111 PreloadSuppressingCSSPreloaderResourceClient* resourceClient = 111 PreloadSuppressingCSSPreloaderResourceClient* resourceClient =
112 new PreloadSuppressingCSSPreloaderResourceClient(resource, preloader); 112 new PreloadSuppressingCSSPreloaderResourceClient(resource, preloader);
113 113
114 EXPECT_EQ(0u, resourceClient->m_preloads.size()); 114 EXPECT_EQ(0u, resourceClient->m_preloads.size());
115 } 115 }
116 116
117 // Regression test for crbug.com/645331, where a resource client gets callbacks 117 // Regression test for crbug.com/645331, where a resource client gets callbacks
118 // after the document is shutdown and we have no frame. 118 // after the document is shutdown and we have no frame.
(...skipping 17 matching lines...) Expand all
136 136
137 const char* data = "@import url('http://127.0.0.1/preload.css');"; 137 const char* data = "@import url('http://127.0.0.1/preload.css');";
138 resource->appendData(data, strlen(data)); 138 resource->appendData(data, strlen(data));
139 139
140 EXPECT_EQ(1u, resourceClient->m_preloads.size()); 140 EXPECT_EQ(1u, resourceClient->m_preloads.size());
141 EXPECT_EQ("http://127.0.0.1/preload.css", 141 EXPECT_EQ("http://127.0.0.1/preload.css",
142 resourceClient->m_preloads.first()->resourceURL()); 142 resourceClient->m_preloads.first()->resourceURL());
143 } 143 }
144 144
145 } // namespace blink 145 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/fetch/ResourceLoader.cpp ('k') | third_party/WebKit/Source/core/loader/FrameFetchContext.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698