| OLD | NEW |
| 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 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 358 Persistent<MockImageResourceClient> client = | 358 Persistent<MockImageResourceClient> client = |
| 359 new MockImageResourceClient(cachedImage); | 359 new MockImageResourceClient(cachedImage); |
| 360 | 360 |
| 361 // Send the image response. | 361 // Send the image response. |
| 362 Vector<unsigned char> jpeg = jpegImage(); | 362 Vector<unsigned char> jpeg = jpegImage(); |
| 363 cachedImage->responseReceived( | 363 cachedImage->responseReceived( |
| 364 ResourceResponse(KURL(), "image/jpeg", jpeg.size(), nullAtom, String()), | 364 ResourceResponse(KURL(), "image/jpeg", jpeg.size(), nullAtom, String()), |
| 365 nullptr); | 365 nullptr); |
| 366 cachedImage->appendData(reinterpret_cast<const char*>(jpeg.data()), | 366 cachedImage->appendData(reinterpret_cast<const char*>(jpeg.data()), |
| 367 jpeg.size()); | 367 jpeg.size()); |
| 368 EXPECT_NE(0u, cachedImage->encodedSize()); |
| 368 cachedImage->finish(); | 369 cachedImage->finish(); |
| 370 EXPECT_EQ(0u, cachedImage->encodedSize()); |
| 369 EXPECT_FALSE(cachedImage->errorOccurred()); | 371 EXPECT_FALSE(cachedImage->errorOccurred()); |
| 370 ASSERT_TRUE(cachedImage->hasImage()); | 372 ASSERT_TRUE(cachedImage->hasImage()); |
| 371 EXPECT_FALSE(cachedImage->getImage()->isNull()); | 373 EXPECT_FALSE(cachedImage->getImage()->isNull()); |
| 372 EXPECT_EQ(2, client->imageChangedCount()); | 374 EXPECT_EQ(2, client->imageChangedCount()); |
| 373 EXPECT_TRUE(client->notifyFinishedCalled()); | 375 EXPECT_TRUE(client->notifyFinishedCalled()); |
| 374 EXPECT_TRUE(cachedImage->getImage()->isBitmapImage()); | 376 EXPECT_TRUE(cachedImage->getImage()->isBitmapImage()); |
| 375 } | 377 } |
| 376 | 378 |
| 377 TEST(ImageResourceTest, ReloadIfLoFi) { | 379 TEST(ImageResourceTest, ReloadIfLoFi) { |
| 378 KURL testURL(ParsedURLString, "http://www.test.com/cancelTest.html"); | 380 KURL testURL(ParsedURLString, "http://www.test.com/cancelTest.html"); |
| (...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 685 nullptr, WrappedResourceResponse(ResourceResponse( | 687 nullptr, WrappedResourceResponse(ResourceResponse( |
| 686 testURL, "image/jpeg", 18, nullAtom, String())), | 688 testURL, "image/jpeg", 18, nullAtom, String())), |
| 687 nullptr); | 689 nullptr); |
| 688 cachedImage->loader()->didReceiveData(nullptr, "notactuallyanimage", 18, 18, | 690 cachedImage->loader()->didReceiveData(nullptr, "notactuallyanimage", 18, 18, |
| 689 18); | 691 18); |
| 690 EXPECT_EQ(Resource::DecodeError, cachedImage->getStatus()); | 692 EXPECT_EQ(Resource::DecodeError, cachedImage->getStatus()); |
| 691 EXPECT_FALSE(cachedImage->isLoading()); | 693 EXPECT_FALSE(cachedImage->isLoading()); |
| 692 } | 694 } |
| 693 | 695 |
| 694 } // namespace blink | 696 } // namespace blink |
| OLD | NEW |