Chromium Code Reviews| 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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 m_nativeImage = NativeImageSkia::create(); |
| 67 m_nativeImage->bitmap().setConfig(SkBitmap::kARGB_8888_Config, | 67 m_nativeImage->bitmap().allocN32Pixels(size.width(), size.height()); |
|
reed1
2014/03/21 15:18:40
ASSERT_TRUE() ?
jbroman
2014/03/21 15:39:34
Unfortunately, this isn't directly in the test or
| |
| 68 size.width(), size.height(), 0); | |
| 69 m_nativeImage->bitmap().allocPixels(); | |
| 70 } | 68 } |
| 71 | 69 |
| 72 virtual IntSize size() const OVERRIDE | 70 virtual IntSize size() const OVERRIDE |
| 73 { | 71 { |
| 74 return m_size; | 72 return m_size; |
| 75 } | 73 } |
| 76 | 74 |
| 77 virtual PassRefPtr<NativeImageSkia> nativeImageForCurrentFrame() OVERRIDE | 75 virtual PassRefPtr<NativeImageSkia> nativeImageForCurrentFrame() OVERRIDE |
| 78 { | 76 { |
| 79 if (m_size.isZero()) | 77 if (m_size.isZero()) |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 155 | 153 |
| 156 OwnPtr<DragImage> testImage = | 154 OwnPtr<DragImage> testImage = |
| 157 DragImage::create(url, testLabel, fontDescription, deviceScaleFactor); | 155 DragImage::create(url, testLabel, fontDescription, deviceScaleFactor); |
| 158 OwnPtr<DragImage> expectedImage = | 156 OwnPtr<DragImage> expectedImage = |
| 159 DragImage::create(url, expectedLabel, fontDescription, deviceScaleFactor ); | 157 DragImage::create(url, expectedLabel, fontDescription, deviceScaleFactor ); |
| 160 | 158 |
| 161 EXPECT_EQ(testImage->size().width(), expectedImage->size().width()); | 159 EXPECT_EQ(testImage->size().width(), expectedImage->size().width()); |
| 162 } | 160 } |
| 163 | 161 |
| 164 } // anonymous namespace | 162 } // anonymous namespace |
| OLD | NEW |