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

Side by Side Diff: third_party/WebKit/Source/core/fetch/ImageResourceTest.cpp

Issue 2324103002: Cleanup EXPECT/ASSERTs in unit tests in core/fetch and core/loader (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 3 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 /* 1 /*
2 * Copyright (c) 2013, Google Inc. All rights reserved. 2 * Copyright (c) 2013, Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 191
192 Persistent<MockImageResourceClient> client = new MockImageResourceClient(cac hedImage); 192 Persistent<MockImageResourceClient> client = new MockImageResourceClient(cac hedImage);
193 EXPECT_EQ(Resource::Pending, cachedImage->getStatus()); 193 EXPECT_EQ(Resource::Pending, cachedImage->getStatus());
194 194
195 // Send the multipart response. No image or data buffer is created. 195 // Send the multipart response. No image or data buffer is created.
196 // Note that the response must be routed through ResourceLoader to 196 // Note that the response must be routed through ResourceLoader to
197 // ensure the load is flagged as multipart. 197 // ensure the load is flagged as multipart.
198 ResourceResponse multipartResponse(KURL(), "multipart/x-mixed-replace", 0, n ullAtom, String()); 198 ResourceResponse multipartResponse(KURL(), "multipart/x-mixed-replace", 0, n ullAtom, String());
199 multipartResponse.setMultipartBoundary("boundary", strlen("boundary")); 199 multipartResponse.setMultipartBoundary("boundary", strlen("boundary"));
200 cachedImage->loader()->didReceiveResponse(nullptr, WrappedResourceResponse(m ultipartResponse), nullptr); 200 cachedImage->loader()->didReceiveResponse(nullptr, WrappedResourceResponse(m ultipartResponse), nullptr);
201 ASSERT_FALSE(cachedImage->resourceBuffer()); 201 EXPECT_FALSE(cachedImage->resourceBuffer());
202 ASSERT_FALSE(cachedImage->hasImage()); 202 EXPECT_FALSE(cachedImage->hasImage());
203 ASSERT_EQ(client->imageChangedCount(), 0); 203 EXPECT_EQ(0, client->imageChangedCount());
204 ASSERT_FALSE(client->notifyFinishedCalled()); 204 EXPECT_FALSE(client->notifyFinishedCalled());
205 EXPECT_EQ("multipart/x-mixed-replace", cachedImage->response().mimeType()); 205 EXPECT_EQ("multipart/x-mixed-replace", cachedImage->response().mimeType());
206 206
207 const char firstPart[] = 207 const char firstPart[] =
208 "--boundary\n" 208 "--boundary\n"
209 "Content-Type: image/svg+xml\n\n"; 209 "Content-Type: image/svg+xml\n\n";
210 cachedImage->appendData(firstPart, strlen(firstPart)); 210 cachedImage->appendData(firstPart, strlen(firstPart));
211 // Send the response for the first real part. No image or data buffer is cre ated. 211 // Send the response for the first real part. No image or data buffer is cre ated.
212 ASSERT_FALSE(cachedImage->resourceBuffer()); 212 EXPECT_FALSE(cachedImage->resourceBuffer());
213 ASSERT_FALSE(cachedImage->hasImage()); 213 EXPECT_FALSE(cachedImage->hasImage());
214 ASSERT_EQ(client->imageChangedCount(), 0); 214 EXPECT_EQ(0, client->imageChangedCount());
215 ASSERT_FALSE(client->notifyFinishedCalled()); 215 EXPECT_FALSE(client->notifyFinishedCalled());
216 EXPECT_EQ("image/svg+xml", cachedImage->response().mimeType()); 216 EXPECT_EQ("image/svg+xml", cachedImage->response().mimeType());
217 217
218 const char secondPart[] = "<svg xmlns='http://www.w3.org/2000/svg' width='1' height='1'><rect width='1' height='1' fill='green'/></svg>\n"; 218 const char secondPart[] = "<svg xmlns='http://www.w3.org/2000/svg' width='1' height='1'><rect width='1' height='1' fill='green'/></svg>\n";
219 // The first bytes arrive. The data buffer is created, but no image is creat ed. 219 // The first bytes arrive. The data buffer is created, but no image is creat ed.
220 cachedImage->appendData(secondPart, strlen(secondPart)); 220 cachedImage->appendData(secondPart, strlen(secondPart));
221 ASSERT_TRUE(cachedImage->resourceBuffer()); 221 EXPECT_TRUE(cachedImage->resourceBuffer());
222 ASSERT_FALSE(cachedImage->hasImage()); 222 EXPECT_FALSE(cachedImage->hasImage());
223 ASSERT_EQ(client->imageChangedCount(), 0); 223 EXPECT_EQ(0, client->imageChangedCount());
224 ASSERT_FALSE(client->notifyFinishedCalled()); 224 EXPECT_FALSE(client->notifyFinishedCalled());
225 225
226 // Add a client to check an assertion error doesn't happen 226 // Add a client to check an assertion error doesn't happen
227 // (crbug.com/630983). 227 // (crbug.com/630983).
228 Persistent<MockImageResourceClient> client2 = new MockImageResourceClient(ca chedImage); 228 Persistent<MockImageResourceClient> client2 = new MockImageResourceClient(ca chedImage);
229 ASSERT_EQ(client2->imageChangedCount(), 0); 229 EXPECT_EQ(0, client2->imageChangedCount());
230 ASSERT_FALSE(client2->notifyFinishedCalled()); 230 EXPECT_FALSE(client2->notifyFinishedCalled());
231 231
232 const char thirdPart[] = "--boundary"; 232 const char thirdPart[] = "--boundary";
233 cachedImage->appendData(thirdPart, strlen(thirdPart)); 233 cachedImage->appendData(thirdPart, strlen(thirdPart));
234 ASSERT_TRUE(cachedImage->resourceBuffer()); 234 ASSERT_TRUE(cachedImage->resourceBuffer());
235 ASSERT_EQ(cachedImage->resourceBuffer()->size(), strlen(secondPart) - 1); 235 EXPECT_EQ(strlen(secondPart) - 1, cachedImage->resourceBuffer()->size());
236 236
237 // This part finishes. The image is created, callbacks are sent, and the dat a buffer is cleared. 237 // This part finishes. The image is created, callbacks are sent, and the dat a buffer is cleared.
238 cachedImage->loader()->didFinishLoading(nullptr, 0.0, 0); 238 cachedImage->loader()->didFinishLoading(nullptr, 0.0, 0);
239 ASSERT_TRUE(cachedImage->resourceBuffer()); 239 EXPECT_TRUE(cachedImage->resourceBuffer());
240 ASSERT_FALSE(cachedImage->errorOccurred()); 240 EXPECT_FALSE(cachedImage->errorOccurred());
241 ASSERT_TRUE(cachedImage->hasImage()); 241 ASSERT_TRUE(cachedImage->hasImage());
242 ASSERT_FALSE(cachedImage->getImage()->isNull()); 242 EXPECT_FALSE(cachedImage->getImage()->isNull());
243 ASSERT_EQ(cachedImage->getImage()->width(), 1); 243 EXPECT_EQ(1, cachedImage->getImage()->width());
244 ASSERT_EQ(cachedImage->getImage()->height(), 1); 244 EXPECT_EQ(1, cachedImage->getImage()->height());
245 ASSERT_EQ(client->imageChangedCount(), 1); 245 EXPECT_EQ(1, client->imageChangedCount());
246 ASSERT_TRUE(client->notifyFinishedCalled()); 246 EXPECT_TRUE(client->notifyFinishedCalled());
247 ASSERT_EQ(client2->imageChangedCount(), 1); 247 EXPECT_EQ(1, client2->imageChangedCount());
248 ASSERT_TRUE(client2->notifyFinishedCalled()); 248 EXPECT_TRUE(client2->notifyFinishedCalled());
249 } 249 }
250 250
251 TEST(ImageResourceTest, CancelOnDetach) 251 TEST(ImageResourceTest, CancelOnDetach)
252 { 252 {
253 KURL testURL(ParsedURLString, "http://www.test.com/cancelTest.html"); 253 KURL testURL(ParsedURLString, "http://www.test.com/cancelTest.html");
254 URLTestHelpers::registerMockedURLLoad(testURL, "cancelTest.html", "text/html "); 254 URLTestHelpers::registerMockedURLLoad(testURL, "cancelTest.html", "text/html ");
255 255
256 ResourceFetcher* fetcher = ResourceFetcher::create(ImageResourceTestMockFetc hContext::create()); 256 ResourceFetcher* fetcher = ResourceFetcher::create(ImageResourceTestMockFetc hContext::create());
257 257
258 // Emulate starting a real load. 258 // Emulate starting a real load.
259 ImageResource* cachedImage = ImageResource::create(ResourceRequest(testURL)) ; 259 ImageResource* cachedImage = ImageResource::create(ResourceRequest(testURL)) ;
260 cachedImage->setIdentifier(createUniqueIdentifier()); 260 cachedImage->setIdentifier(createUniqueIdentifier());
261 261
262 fetcher->startLoad(cachedImage); 262 fetcher->startLoad(cachedImage);
263 memoryCache()->add(cachedImage); 263 memoryCache()->add(cachedImage);
264 264
265 Persistent<MockImageResourceClient> client = new MockImageResourceClient(cac hedImage); 265 Persistent<MockImageResourceClient> client = new MockImageResourceClient(cac hedImage);
266 EXPECT_EQ(Resource::Pending, cachedImage->getStatus()); 266 EXPECT_EQ(Resource::Pending, cachedImage->getStatus());
267 267
268 // The load should still be alive, but a timer should be started to cancel t he load inside removeClient(). 268 // The load should still be alive, but a timer should be started to cancel t he load inside removeClient().
269 client->removeAsClient(); 269 client->removeAsClient();
270 EXPECT_EQ(Resource::Pending, cachedImage->getStatus()); 270 EXPECT_EQ(Resource::Pending, cachedImage->getStatus());
271 EXPECT_NE(reinterpret_cast<Resource*>(0), memoryCache()->resourceForURL(test URL)); 271 EXPECT_TRUE(memoryCache()->resourceForURL(testURL));
272 272
273 // Trigger the cancel timer, ensure the load was cancelled and the resource was evicted from the cache. 273 // Trigger the cancel timer, ensure the load was cancelled and the resource was evicted from the cache.
274 blink::testing::runPendingTasks(); 274 blink::testing::runPendingTasks();
275 EXPECT_EQ(Resource::LoadError, cachedImage->getStatus()); 275 EXPECT_EQ(Resource::LoadError, cachedImage->getStatus());
276 EXPECT_EQ(reinterpret_cast<Resource*>(0), memoryCache()->resourceForURL(test URL)); 276 EXPECT_FALSE(memoryCache()->resourceForURL(testURL));
277 277
278 Platform::current()->getURLLoaderMockFactory()->unregisterURL(testURL); 278 Platform::current()->getURLLoaderMockFactory()->unregisterURL(testURL);
279 } 279 }
280 280
281 TEST(ImageResourceTest, DecodedDataRemainsWhileHasClients) 281 TEST(ImageResourceTest, DecodedDataRemainsWhileHasClients)
282 { 282 {
283 ImageResource* cachedImage = ImageResource::create(ResourceRequest()); 283 ImageResource* cachedImage = ImageResource::create(ResourceRequest());
284 cachedImage->setStatus(Resource::Pending); 284 cachedImage->setStatus(Resource::Pending);
285 285
286 Persistent<MockImageResourceClient> client = new MockImageResourceClient(cac hedImage); 286 Persistent<MockImageResourceClient> client = new MockImageResourceClient(cac hedImage);
287 287
288 // Send the image response. 288 // Send the image response.
289 cachedImage->responseReceived(ResourceResponse(KURL(), "multipart/x-mixed-re place", 0, nullAtom, String()), nullptr); 289 cachedImage->responseReceived(ResourceResponse(KURL(), "multipart/x-mixed-re place", 0, nullAtom, String()), nullptr);
290 290
291 Vector<unsigned char> jpeg = jpegImage(); 291 Vector<unsigned char> jpeg = jpegImage();
292 cachedImage->responseReceived(ResourceResponse(KURL(), "image/jpeg", jpeg.si ze(), nullAtom, String()), nullptr); 292 cachedImage->responseReceived(ResourceResponse(KURL(), "image/jpeg", jpeg.si ze(), nullAtom, String()), nullptr);
293 cachedImage->appendData(reinterpret_cast<const char*>(jpeg.data()), jpeg.siz e()); 293 cachedImage->appendData(reinterpret_cast<const char*>(jpeg.data()), jpeg.siz e());
294 cachedImage->finish(); 294 cachedImage->finish();
295 ASSERT_FALSE(cachedImage->errorOccurred()); 295 EXPECT_FALSE(cachedImage->errorOccurred());
296 ASSERT_TRUE(cachedImage->hasImage()); 296 ASSERT_TRUE(cachedImage->hasImage());
297 ASSERT_FALSE(cachedImage->getImage()->isNull()); 297 EXPECT_FALSE(cachedImage->getImage()->isNull());
298 ASSERT_TRUE(client->notifyFinishedCalled()); 298 EXPECT_TRUE(client->notifyFinishedCalled());
299 299
300 // The prune comes when the ImageResource still has clients. The image shoul d not be deleted. 300 // The prune comes when the ImageResource still has clients. The image shoul d not be deleted.
301 cachedImage->prune(); 301 cachedImage->prune();
302 ASSERT_TRUE(cachedImage->isAlive()); 302 EXPECT_TRUE(cachedImage->isAlive());
303 ASSERT_TRUE(cachedImage->hasImage()); 303 ASSERT_TRUE(cachedImage->hasImage());
304 ASSERT_FALSE(cachedImage->getImage()->isNull()); 304 EXPECT_FALSE(cachedImage->getImage()->isNull());
305 305
306 // The ImageResource no longer has clients. The decoded image data should be 306 // The ImageResource no longer has clients. The decoded image data should be
307 // deleted by prune. 307 // deleted by prune.
308 client->removeAsClient(); 308 client->removeAsClient();
309 cachedImage->prune(); 309 cachedImage->prune();
310 ASSERT_FALSE(cachedImage->isAlive()); 310 EXPECT_FALSE(cachedImage->isAlive());
311 ASSERT_TRUE(cachedImage->hasImage()); 311 EXPECT_TRUE(cachedImage->hasImage());
312 // TODO(hajimehoshi): Should check cachedImage doesn't have decoded image 312 // TODO(hajimehoshi): Should check cachedImage doesn't have decoded image
313 // data. 313 // data.
314 } 314 }
315 315
316 TEST(ImageResourceTest, UpdateBitmapImages) 316 TEST(ImageResourceTest, UpdateBitmapImages)
317 { 317 {
318 ImageResource* cachedImage = ImageResource::create(ResourceRequest()); 318 ImageResource* cachedImage = ImageResource::create(ResourceRequest());
319 cachedImage->setStatus(Resource::Pending); 319 cachedImage->setStatus(Resource::Pending);
320 320
321 Persistent<MockImageResourceClient> client = new MockImageResourceClient(cac hedImage); 321 Persistent<MockImageResourceClient> client = new MockImageResourceClient(cac hedImage);
322 322
323 // Send the image response. 323 // Send the image response.
324 Vector<unsigned char> jpeg = jpegImage(); 324 Vector<unsigned char> jpeg = jpegImage();
325 cachedImage->responseReceived(ResourceResponse(KURL(), "image/jpeg", jpeg.si ze(), nullAtom, String()), nullptr); 325 cachedImage->responseReceived(ResourceResponse(KURL(), "image/jpeg", jpeg.si ze(), nullAtom, String()), nullptr);
326 cachedImage->appendData(reinterpret_cast<const char*>(jpeg.data()), jpeg.siz e()); 326 cachedImage->appendData(reinterpret_cast<const char*>(jpeg.data()), jpeg.siz e());
327 cachedImage->finish(); 327 cachedImage->finish();
328 ASSERT_FALSE(cachedImage->errorOccurred()); 328 EXPECT_FALSE(cachedImage->errorOccurred());
329 ASSERT_TRUE(cachedImage->hasImage()); 329 ASSERT_TRUE(cachedImage->hasImage());
330 ASSERT_FALSE(cachedImage->getImage()->isNull()); 330 EXPECT_FALSE(cachedImage->getImage()->isNull());
331 ASSERT_EQ(client->imageChangedCount(), 2); 331 EXPECT_EQ(2, client->imageChangedCount());
332 ASSERT_TRUE(client->notifyFinishedCalled()); 332 EXPECT_TRUE(client->notifyFinishedCalled());
333 ASSERT_TRUE(cachedImage->getImage()->isBitmapImage()); 333 EXPECT_TRUE(cachedImage->getImage()->isBitmapImage());
334 } 334 }
335 335
336 TEST(ImageResourceTest, ReloadIfLoFi) 336 TEST(ImageResourceTest, ReloadIfLoFi)
337 { 337 {
338 KURL testURL(ParsedURLString, "http://www.test.com/cancelTest.html"); 338 KURL testURL(ParsedURLString, "http://www.test.com/cancelTest.html");
339 URLTestHelpers::registerMockedURLLoad(testURL, "cancelTest.html", "text/html "); 339 URLTestHelpers::registerMockedURLLoad(testURL, "cancelTest.html", "text/html ");
340 ResourceRequest request = ResourceRequest(testURL); 340 ResourceRequest request = ResourceRequest(testURL);
341 request.setLoFiState(WebURLRequest::LoFiOn); 341 request.setLoFiState(WebURLRequest::LoFiOn);
342 ImageResource* cachedImage = ImageResource::create(request); 342 ImageResource* cachedImage = ImageResource::create(request);
343 cachedImage->setStatus(Resource::Pending); 343 cachedImage->setStatus(Resource::Pending);
344 344
345 Persistent<MockImageResourceClient> client = new MockImageResourceClient(cac hedImage); 345 Persistent<MockImageResourceClient> client = new MockImageResourceClient(cac hedImage);
346 ResourceFetcher* fetcher = ResourceFetcher::create(ImageResourceTestMockFetc hContext::create()); 346 ResourceFetcher* fetcher = ResourceFetcher::create(ImageResourceTestMockFetc hContext::create());
347 347
348 // Send the image response. 348 // Send the image response.
349 Vector<unsigned char> jpeg = jpegImage(); 349 Vector<unsigned char> jpeg = jpegImage();
350 ResourceResponse resourceResponse(KURL(), "image/jpeg", jpeg.size(), nullAto m, String()); 350 ResourceResponse resourceResponse(KURL(), "image/jpeg", jpeg.size(), nullAto m, String());
351 resourceResponse.addHTTPHeaderField("chrome-proxy", "q=low"); 351 resourceResponse.addHTTPHeaderField("chrome-proxy", "q=low");
352 352
353 cachedImage->responseReceived(resourceResponse, nullptr); 353 cachedImage->responseReceived(resourceResponse, nullptr);
354 cachedImage->appendData(reinterpret_cast<const char*>(jpeg.data()), jpeg.siz e()); 354 cachedImage->appendData(reinterpret_cast<const char*>(jpeg.data()), jpeg.siz e());
355 cachedImage->finish(); 355 cachedImage->finish();
356 ASSERT_FALSE(cachedImage->errorOccurred()); 356 EXPECT_FALSE(cachedImage->errorOccurred());
357 ASSERT_TRUE(cachedImage->hasImage()); 357 ASSERT_TRUE(cachedImage->hasImage());
358 ASSERT_FALSE(cachedImage->getImage()->isNull()); 358 EXPECT_FALSE(cachedImage->getImage()->isNull());
359 ASSERT_EQ(client->imageChangedCount(), 2); 359 EXPECT_EQ(2, client->imageChangedCount());
360 ASSERT_TRUE(client->notifyFinishedCalled()); 360 EXPECT_TRUE(client->notifyFinishedCalled());
361 ASSERT_TRUE(cachedImage->getImage()->isBitmapImage()); 361 EXPECT_TRUE(cachedImage->getImage()->isBitmapImage());
362 EXPECT_EQ(1, cachedImage->getImage()->width()); 362 EXPECT_EQ(1, cachedImage->getImage()->width());
363 EXPECT_EQ(1, cachedImage->getImage()->height()); 363 EXPECT_EQ(1, cachedImage->getImage()->height());
364 364
365 cachedImage->reloadIfLoFi(fetcher); 365 cachedImage->reloadIfLoFi(fetcher);
366 ASSERT_FALSE(cachedImage->errorOccurred()); 366 EXPECT_FALSE(cachedImage->errorOccurred());
367 ASSERT_FALSE(cachedImage->resourceBuffer()); 367 EXPECT_FALSE(cachedImage->resourceBuffer());
368 ASSERT_FALSE(cachedImage->hasImage()); 368 EXPECT_FALSE(cachedImage->hasImage());
369 ASSERT_EQ(client->imageChangedCount(), 3); 369 EXPECT_EQ(3, client->imageChangedCount());
370 370
371 Vector<unsigned char> jpeg2 = jpegImage2(); 371 Vector<unsigned char> jpeg2 = jpegImage2();
372 cachedImage->loader()->didReceiveResponse(nullptr, WrappedResourceResponse(r esourceResponse), nullptr); 372 cachedImage->loader()->didReceiveResponse(nullptr, WrappedResourceResponse(r esourceResponse), nullptr);
373 cachedImage->loader()->didReceiveData(nullptr, reinterpret_cast<const char*> (jpeg2.data()), jpeg2.size(), jpeg2.size(), jpeg2.size()); 373 cachedImage->loader()->didReceiveData(nullptr, reinterpret_cast<const char*> (jpeg2.data()), jpeg2.size(), jpeg2.size(), jpeg2.size());
374 cachedImage->loader()->didFinishLoading(nullptr, 0.0, jpeg2.size()); 374 cachedImage->loader()->didFinishLoading(nullptr, 0.0, jpeg2.size());
375 ASSERT_FALSE(cachedImage->errorOccurred()); 375 EXPECT_FALSE(cachedImage->errorOccurred());
376 ASSERT_TRUE(cachedImage->hasImage()); 376 ASSERT_TRUE(cachedImage->hasImage());
377 ASSERT_FALSE(cachedImage->getImage()->isNull()); 377 EXPECT_FALSE(cachedImage->getImage()->isNull());
378 ASSERT_TRUE(client->notifyFinishedCalled()); 378 EXPECT_TRUE(client->notifyFinishedCalled());
379 ASSERT_TRUE(cachedImage->getImage()->isBitmapImage()); 379 EXPECT_TRUE(cachedImage->getImage()->isBitmapImage());
380 EXPECT_EQ(50, cachedImage->getImage()->width()); 380 EXPECT_EQ(50, cachedImage->getImage()->width());
381 EXPECT_EQ(50, cachedImage->getImage()->height()); 381 EXPECT_EQ(50, cachedImage->getImage()->height());
382 } 382 }
383 383
384 TEST(ImageResourceTest, SVGImage) 384 TEST(ImageResourceTest, SVGImage)
385 { 385 {
386 KURL url(ParsedURLString, "http://127.0.0.1:8000/foo"); 386 KURL url(ParsedURLString, "http://127.0.0.1:8000/foo");
387 ImageResource* imageResource = ImageResource::create(ResourceRequest(url)); 387 ImageResource* imageResource = ImageResource::create(ResourceRequest(url));
388 Persistent<MockImageResourceClient> client = new MockImageResourceClient(ima geResource); 388 Persistent<MockImageResourceClient> client = new MockImageResourceClient(ima geResource);
389 389
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
631 ImageResource* cachedImage = ImageResource::fetch(request, fetcher); 631 ImageResource* cachedImage = ImageResource::fetch(request, fetcher);
632 Platform::current()->getURLLoaderMockFactory()->unregisterURL(testURL); 632 Platform::current()->getURLLoaderMockFactory()->unregisterURL(testURL);
633 633
634 cachedImage->loader()->didReceiveResponse(nullptr, WrappedResourceResponse(R esourceResponse(testURL, "image/jpeg", 18, nullAtom, String())), nullptr); 634 cachedImage->loader()->didReceiveResponse(nullptr, WrappedResourceResponse(R esourceResponse(testURL, "image/jpeg", 18, nullAtom, String())), nullptr);
635 cachedImage->loader()->didReceiveData(nullptr, "notactuallyanimage", 18, 18, 18); 635 cachedImage->loader()->didReceiveData(nullptr, "notactuallyanimage", 18, 18, 18);
636 EXPECT_EQ(Resource::DecodeError, cachedImage->getStatus()); 636 EXPECT_EQ(Resource::DecodeError, cachedImage->getStatus());
637 EXPECT_FALSE(cachedImage->isLoading()); 637 EXPECT_FALSE(cachedImage->isLoading());
638 } 638 }
639 639
640 } // namespace blink 640 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698