| 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 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 ASSERT_FALSE(client.notifyFinishedCalled()); | 128 ASSERT_FALSE(client.notifyFinishedCalled()); |
| 129 | 129 |
| 130 // This part finishes. The image is created, callbacks are sent, and the dat
a buffer is cleared. | 130 // This part finishes. The image is created, callbacks are sent, and the dat
a buffer is cleared. |
| 131 cachedImage->finish(); | 131 cachedImage->finish(); |
| 132 ASSERT_FALSE(cachedImage->resourceBuffer()); | 132 ASSERT_FALSE(cachedImage->resourceBuffer()); |
| 133 ASSERT_FALSE(cachedImage->errorOccurred()); | 133 ASSERT_FALSE(cachedImage->errorOccurred()); |
| 134 ASSERT_TRUE(cachedImage->hasImage()); | 134 ASSERT_TRUE(cachedImage->hasImage()); |
| 135 ASSERT_FALSE(cachedImage->image()->isNull()); | 135 ASSERT_FALSE(cachedImage->image()->isNull()); |
| 136 ASSERT_EQ(cachedImage->image()->width(), 1); | 136 ASSERT_EQ(cachedImage->image()->width(), 1); |
| 137 ASSERT_EQ(cachedImage->image()->height(), 1); | 137 ASSERT_EQ(cachedImage->image()->height(), 1); |
| 138 ASSERT_EQ(client.imageChangedCount(), 1); | 138 ASSERT_EQ(client.imageChangedCount(), 2); |
| 139 ASSERT_TRUE(client.notifyFinishedCalled()); | 139 ASSERT_TRUE(client.notifyFinishedCalled()); |
| 140 } | 140 } |
| 141 | 141 |
| 142 TEST(ImageResourceTest, CancelOnDetach) | 142 TEST(ImageResourceTest, CancelOnDetach) |
| 143 { | 143 { |
| 144 KURL testURL(ParsedURLString, "http://www.test.com/cancelTest.html"); | 144 KURL testURL(ParsedURLString, "http://www.test.com/cancelTest.html"); |
| 145 URLTestHelpers::registerMockedURLLoad(testURL, "cancelTest.html", "text/html
"); | 145 URLTestHelpers::registerMockedURLLoad(testURL, "cancelTest.html", "text/html
"); |
| 146 | 146 |
| 147 ResourceFetcher* fetcher = ResourceFetcher::create(nullptr); | 147 ResourceFetcher* fetcher = ResourceFetcher::create(nullptr); |
| 148 | 148 |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 cachedImage->finish(); | 216 cachedImage->finish(); |
| 217 ASSERT_FALSE(cachedImage->errorOccurred()); | 217 ASSERT_FALSE(cachedImage->errorOccurred()); |
| 218 ASSERT_TRUE(cachedImage->hasImage()); | 218 ASSERT_TRUE(cachedImage->hasImage()); |
| 219 ASSERT_FALSE(cachedImage->image()->isNull()); | 219 ASSERT_FALSE(cachedImage->image()->isNull()); |
| 220 ASSERT_EQ(client.imageChangedCount(), 2); | 220 ASSERT_EQ(client.imageChangedCount(), 2); |
| 221 ASSERT_TRUE(client.notifyFinishedCalled()); | 221 ASSERT_TRUE(client.notifyFinishedCalled()); |
| 222 ASSERT_TRUE(cachedImage->image()->isBitmapImage()); | 222 ASSERT_TRUE(cachedImage->image()->isBitmapImage()); |
| 223 } | 223 } |
| 224 | 224 |
| 225 } // namespace blink | 225 } // namespace blink |
| OLD | NEW |