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 static PassRefPtr<TestImage> create(const IntSize& size) | 56 static PassRefPtr<TestImage> create(const IntSize& size) |
57 { | 57 { |
58 return adoptRef(new TestImage(size)); | 58 return adoptRef(new TestImage(size)); |
59 } | 59 } |
60 | 60 |
61 explicit TestImage(const IntSize& size) | 61 explicit TestImage(const IntSize& size) |
62 : Image(0) | 62 : Image(0) |
63 , m_size(size) | 63 , m_size(size) |
64 { | 64 { |
65 SkBitmap bitmap; | 65 SkBitmap bitmap; |
66 EXPECT_TRUE(bitmap.allocN32Pixels(size.width(), size.height())); | 66 bitmap.allocN32Pixels(size.width(), size.height()); |
67 m_nativeImage = NativeImageSkia::create(bitmap); | 67 m_nativeImage = NativeImageSkia::create(bitmap); |
68 } | 68 } |
69 | 69 |
70 virtual IntSize size() const OVERRIDE | 70 virtual IntSize size() const OVERRIDE |
71 { | 71 { |
72 return m_size; | 72 return m_size; |
73 } | 73 } |
74 | 74 |
75 virtual PassRefPtr<NativeImageSkia> nativeImageForCurrentFrame() OVERRIDE | 75 virtual PassRefPtr<NativeImageSkia> nativeImageForCurrentFrame() OVERRIDE |
76 { | 76 { |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 | 159 |
160 OwnPtr<DragImage> testImage = | 160 OwnPtr<DragImage> testImage = |
161 DragImage::create(url, testLabel, fontDescription, deviceScaleFactor); | 161 DragImage::create(url, testLabel, fontDescription, deviceScaleFactor); |
162 OwnPtr<DragImage> expectedImage = | 162 OwnPtr<DragImage> expectedImage = |
163 DragImage::create(url, expectedLabel, fontDescription, deviceScaleFactor
); | 163 DragImage::create(url, expectedLabel, fontDescription, deviceScaleFactor
); |
164 | 164 |
165 EXPECT_EQ(testImage->size().width(), expectedImage->size().width()); | 165 EXPECT_EQ(testImage->size().width(), expectedImage->size().width()); |
166 } | 166 } |
167 | 167 |
168 } // anonymous namespace | 168 } // anonymous namespace |
OLD | NEW |