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 11 matching lines...) Expand all Loading... |
22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
29 */ | 29 */ |
30 | 30 |
31 #include "config.h" | 31 #include "config.h" |
32 #include "core/fetch/ImageResource.h" | 32 #include "core/dom/ImageResource.h" |
33 | 33 |
34 #include "core/fetch/ImageResourceClient.h" | 34 #include "core/dom/MockImageResourceClient.h" |
35 #include "core/fetch/MemoryCache.h" | 35 #include "core/fetch/MemoryCache.h" |
36 #include "core/fetch/MockImageResourceClient.h" | |
37 #include "core/fetch/ResourceFetcher.h" | 36 #include "core/fetch/ResourceFetcher.h" |
38 #include "core/fetch/ResourceLoader.h" | 37 #include "core/fetch/ResourceLoader.h" |
39 #include "core/fetch/ResourcePtr.h" | 38 #include "core/fetch/ResourcePtr.h" |
40 #include "core/fetch/UniqueIdentifier.h" | 39 #include "core/fetch/UniqueIdentifier.h" |
41 #include "platform/SharedBuffer.h" | 40 #include "platform/SharedBuffer.h" |
42 #include "platform/exported/WrappedResourceResponse.h" | 41 #include "platform/exported/WrappedResourceResponse.h" |
43 #include "platform/graphics/Image.h" | 42 #include "platform/graphics/Image.h" |
44 #include "platform/testing/URLTestHelpers.h" | 43 #include "platform/testing/URLTestHelpers.h" |
45 #include "platform/testing/UnitTestHelpers.h" | 44 #include "platform/testing/UnitTestHelpers.h" |
46 #include "public/platform/Platform.h" | 45 #include "public/platform/Platform.h" |
47 #include "public/platform/WebURL.h" | 46 #include "public/platform/WebURL.h" |
48 #include "public/platform/WebURLResponse.h" | 47 #include "public/platform/WebURLResponse.h" |
49 #include "public/platform/WebUnitTestSupport.h" | 48 #include "public/platform/WebUnitTestSupport.h" |
50 | 49 |
| 50 #include <gtest/gtest.h> |
| 51 |
51 namespace blink { | 52 namespace blink { |
52 | 53 |
53 static Vector<unsigned char> jpegImage() | 54 static Vector<unsigned char> jpegImage() |
54 { | 55 { |
55 Vector<unsigned char> jpeg; | 56 Vector<unsigned char> jpeg; |
56 | 57 |
57 static const unsigned char data[] = { | 58 static const unsigned char data[] = { |
58 0xff, 0xd8, 0xff, 0xe0, 0x00, 0x10, 0x4a, 0x46, 0x49, 0x46, 0x00, 0x01,
0x01, 0x01, 0x00, | 59 0xff, 0xd8, 0xff, 0xe0, 0x00, 0x10, 0x4a, 0x46, 0x49, 0x46, 0x00, 0x01,
0x01, 0x01, 0x00, |
59 0x48, 0x00, 0x48, 0x00, 0x00, 0xff, 0xfe, 0x00, 0x13, 0x43, 0x72, 0x65,
0x61, 0x74, 0x65, | 60 0x48, 0x00, 0x48, 0x00, 0x00, 0xff, 0xfe, 0x00, 0x13, 0x43, 0x72, 0x65,
0x61, 0x74, 0x65, |
60 0x64, 0x20, 0x77, 0x69, 0x74, 0x68, 0x20, 0x47, 0x49, 0x4d, 0x50, 0xff,
0xdb, 0x00, 0x43, | 61 0x64, 0x20, 0x77, 0x69, 0x74, 0x68, 0x20, 0x47, 0x49, 0x4d, 0x50, 0xff,
0xdb, 0x00, 0x43, |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 ASSERT_FALSE(cachedImage->image()->isNull()); | 222 ASSERT_FALSE(cachedImage->image()->isNull()); |
222 ASSERT_EQ(client.imageChangedCount(), 2); | 223 ASSERT_EQ(client.imageChangedCount(), 2); |
223 ASSERT_TRUE(client.notifyFinishedCalled()); | 224 ASSERT_TRUE(client.notifyFinishedCalled()); |
224 | 225 |
225 HashSet<ImageResource*> bitmapImages; | 226 HashSet<ImageResource*> bitmapImages; |
226 ASSERT_TRUE(cachedImage->image()->isBitmapImage()); | 227 ASSERT_TRUE(cachedImage->image()->isBitmapImage()); |
227 bitmapImages.add(cachedImage.get()); | 228 bitmapImages.add(cachedImage.get()); |
228 } | 229 } |
229 | 230 |
230 } // namespace blink | 231 } // namespace blink |
OLD | NEW |