OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 | 56 |
57 static PassRefPtr<TestImage> create(const IntSize& size) | 57 static PassRefPtr<TestImage> create(const IntSize& size) |
58 { | 58 { |
59 return adoptRef(new TestImage(size)); | 59 return adoptRef(new TestImage(size)); |
60 } | 60 } |
61 | 61 |
62 explicit TestImage(const IntSize& size) | 62 explicit TestImage(const IntSize& size) |
63 : Image(0) | 63 : Image(0) |
64 , m_size(size) | 64 , m_size(size) |
65 { | 65 { |
66 m_nativeImage = NativeImageSkia::create(); | 66 SkBitmap bitmap; |
67 EXPECT_TRUE(m_nativeImage->bitmap().allocN32Pixels(size.width(), size.he
ight())); | 67 EXPECT_TRUE(bitmap.allocN32Pixels(size.width(), size.height())); |
| 68 m_nativeImage = NativeImageSkia::create(bitmap); |
68 } | 69 } |
69 | 70 |
70 virtual IntSize size() const OVERRIDE | 71 virtual IntSize size() const OVERRIDE |
71 { | 72 { |
72 return m_size; | 73 return m_size; |
73 } | 74 } |
74 | 75 |
75 virtual PassRefPtr<NativeImageSkia> nativeImageForCurrentFrame() OVERRIDE | 76 virtual PassRefPtr<NativeImageSkia> nativeImageForCurrentFrame() OVERRIDE |
76 { | 77 { |
77 if (m_size.isZero()) | 78 if (m_size.isZero()) |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 | 154 |
154 OwnPtr<DragImage> testImage = | 155 OwnPtr<DragImage> testImage = |
155 DragImage::create(url, testLabel, fontDescription, deviceScaleFactor); | 156 DragImage::create(url, testLabel, fontDescription, deviceScaleFactor); |
156 OwnPtr<DragImage> expectedImage = | 157 OwnPtr<DragImage> expectedImage = |
157 DragImage::create(url, expectedLabel, fontDescription, deviceScaleFactor
); | 158 DragImage::create(url, expectedLabel, fontDescription, deviceScaleFactor
); |
158 | 159 |
159 EXPECT_EQ(testImage->size().width(), expectedImage->size().width()); | 160 EXPECT_EQ(testImage->size().width(), expectedImage->size().width()); |
160 } | 161 } |
161 | 162 |
162 } // anonymous namespace | 163 } // anonymous namespace |
OLD | NEW |