OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 SkAutoLockPixels autoLock2(images[1].getSkBitmap()); | 69 SkAutoLockPixels autoLock2(images[1].getSkBitmap()); |
70 EXPECT_EQ(SkColorSetARGB(255, 0, 0, 0), | 70 EXPECT_EQ(SkColorSetARGB(255, 0, 0, 0), |
71 images[1].getSkBitmap().getColor(0, 0)); | 71 images[1].getSkBitmap().getColor(0, 0)); |
72 } | 72 } |
73 | 73 |
74 TEST(WebImageTest, ICOValidHeaderMissingBitmap) { | 74 TEST(WebImageTest, ICOValidHeaderMissingBitmap) { |
75 RefPtr<SharedBuffer> data = readFile("valid_header_missing_bitmap.ico"); | 75 RefPtr<SharedBuffer> data = readFile("valid_header_missing_bitmap.ico"); |
76 ASSERT_TRUE(data.get()); | 76 ASSERT_TRUE(data.get()); |
77 | 77 |
78 WebVector<WebImage> images = WebImage::framesFromData(WebData(data)); | 78 WebVector<WebImage> images = WebImage::framesFromData(WebData(data)); |
79 ASSERT_TRUE(images.isEmpty()); | 79 ASSERT_TRUE(images.empty()); |
80 } | 80 } |
81 | 81 |
82 TEST(WebImageTest, BadImage) { | 82 TEST(WebImageTest, BadImage) { |
83 const char badImage[] = "hello world"; | 83 const char badImage[] = "hello world"; |
84 WebVector<WebImage> images = WebImage::framesFromData(WebData(badImage)); | 84 WebVector<WebImage> images = WebImage::framesFromData(WebData(badImage)); |
85 ASSERT_EQ(0u, images.size()); | 85 ASSERT_EQ(0u, images.size()); |
86 | 86 |
87 WebImage image = WebImage::fromData(WebData(badImage), WebSize()); | 87 WebImage image = WebImage::fromData(WebData(badImage), WebSize()); |
88 EXPECT_TRUE(image.getSkBitmap().empty()); | 88 EXPECT_TRUE(image.getSkBitmap().empty()); |
89 EXPECT_TRUE(image.getSkBitmap().isNull()); | 89 EXPECT_TRUE(image.getSkBitmap().isNull()); |
90 } | 90 } |
91 | 91 |
92 } // namespace blink | 92 } // namespace blink |
OLD | NEW |