| 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 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 ASSERT_EQ(cachedImage->image()->height(), 1); | 124 ASSERT_EQ(cachedImage->image()->height(), 1); |
| 125 ASSERT_EQ(client.imageChangedCount(), 2); | 125 ASSERT_EQ(client.imageChangedCount(), 2); |
| 126 ASSERT_TRUE(client.notifyFinishedCalled()); | 126 ASSERT_TRUE(client.notifyFinishedCalled()); |
| 127 } | 127 } |
| 128 | 128 |
| 129 TEST(ImageResourceTest, CancelOnDetach) | 129 TEST(ImageResourceTest, CancelOnDetach) |
| 130 { | 130 { |
| 131 KURL testURL(ParsedURLString, "http://www.test.com/cancelTest.html"); | 131 KURL testURL(ParsedURLString, "http://www.test.com/cancelTest.html"); |
| 132 URLTestHelpers::registerMockedURLLoad(testURL, "cancelTest.html", "text/html
"); | 132 URLTestHelpers::registerMockedURLLoad(testURL, "cancelTest.html", "text/html
"); |
| 133 | 133 |
| 134 RefPtrWillBeRawPtr<ResourceFetcher> fetcher = ResourceFetcher::create(nullpt
r); | 134 RefPtrWillBeRawPtr<ResourceFetcher> fetcher = ResourceFetcher::create(FetchC
ontext::create()); |
| 135 | 135 |
| 136 // Emulate starting a real load. | 136 // Emulate starting a real load. |
| 137 ResourcePtr<ImageResource> cachedImage = new ImageResource(ResourceRequest(t
estURL)); | 137 ResourcePtr<ImageResource> cachedImage = new ImageResource(ResourceRequest(t
estURL)); |
| 138 cachedImage->setIdentifier(createUniqueIdentifier()); | 138 cachedImage->setIdentifier(createUniqueIdentifier()); |
| 139 | 139 |
| 140 cachedImage->load(fetcher.get(), ResourceLoaderOptions()); | 140 cachedImage->load(fetcher.get(), ResourceLoaderOptions()); |
| 141 memoryCache()->add(cachedImage.get()); | 141 memoryCache()->add(cachedImage.get()); |
| 142 | 142 |
| 143 MockImageResourceClient client; | 143 MockImageResourceClient client; |
| 144 cachedImage->addClient(&client); | 144 cachedImage->addClient(&client); |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 ASSERT_FALSE(cachedImage->image()->isNull()); | 211 ASSERT_FALSE(cachedImage->image()->isNull()); |
| 212 ASSERT_EQ(client.imageChangedCount(), 1); | 212 ASSERT_EQ(client.imageChangedCount(), 1); |
| 213 ASSERT_TRUE(client.notifyFinishedCalled()); | 213 ASSERT_TRUE(client.notifyFinishedCalled()); |
| 214 | 214 |
| 215 HashSet<ImageResource*> bitmapImages; | 215 HashSet<ImageResource*> bitmapImages; |
| 216 ASSERT_TRUE(cachedImage->image()->isBitmapImage()); | 216 ASSERT_TRUE(cachedImage->image()->isBitmapImage()); |
| 217 bitmapImages.add(cachedImage.get()); | 217 bitmapImages.add(cachedImage.get()); |
| 218 } | 218 } |
| 219 | 219 |
| 220 } // namespace | 220 } // namespace |
| OLD | NEW |