Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(331)

Side by Side Diff: Source/platform/DragImageTest.cpp

Issue 1182703002: Fix unit test style in Source/platform/, part 1. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 11 matching lines...) Expand all
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
33 #include "platform/DragImage.h" 32 #include "platform/DragImage.h"
34 33
35 #include "platform/fonts/FontDescription.h" 34 #include "platform/fonts/FontDescription.h"
36 #include "platform/fonts/FontTraits.h" 35 #include "platform/fonts/FontTraits.h"
37 #include "platform/geometry/IntSize.h" 36 #include "platform/geometry/IntSize.h"
38 #include "platform/graphics/BitmapImage.h" 37 #include "platform/graphics/BitmapImage.h"
39 #include "platform/graphics/Image.h" 38 #include "platform/graphics/Image.h"
40 #include "platform/weborigin/KURL.h" 39 #include "platform/weborigin/KURL.h"
41 #include "third_party/skia/include/core/SkBitmap.h" 40 #include "third_party/skia/include/core/SkBitmap.h"
42 #include "third_party/skia/include/core/SkColor.h" 41 #include "third_party/skia/include/core/SkColor.h"
43 #include "third_party/skia/include/core/SkPixelRef.h" 42 #include "third_party/skia/include/core/SkPixelRef.h"
44 #include "wtf/OwnPtr.h" 43 #include "wtf/OwnPtr.h"
45 #include "wtf/PassOwnPtr.h" 44 #include "wtf/PassOwnPtr.h"
46 #include "wtf/PassRefPtr.h" 45 #include "wtf/PassRefPtr.h"
47 #include "wtf/RefPtr.h" 46 #include "wtf/RefPtr.h"
48
49 #include <gtest/gtest.h> 47 #include <gtest/gtest.h>
50 48
51 using namespace blink; 49 namespace blink {
52
53 namespace {
54 50
55 class TestImage : public Image { 51 class TestImage : public Image {
56 public: 52 public:
57 53
58 static PassRefPtr<TestImage> create(const IntSize& size) 54 static PassRefPtr<TestImage> create(const IntSize& size)
59 { 55 {
60 return adoptRef(new TestImage(size)); 56 return adoptRef(new TestImage(size));
61 } 57 }
62 58
63 explicit TestImage(const IntSize& size) 59 explicit TestImage(const IntSize& size)
(...skipping 26 matching lines...) Expand all
90 bool currentFrameKnownToBeOpaque() override 86 bool currentFrameKnownToBeOpaque() override
91 { 87 {
92 return false; 88 return false;
93 } 89 }
94 90
95 void draw(SkCanvas*, const SkPaint&, const FloatRect&, const FloatRect&, Res pectImageOrientationEnum, ImageClampingMode) override 91 void draw(SkCanvas*, const SkPaint&, const FloatRect&, const FloatRect&, Res pectImageOrientationEnum, ImageClampingMode) override
96 { 92 {
97 } 93 }
98 94
99 private: 95 private:
100
101 IntSize m_size; 96 IntSize m_size;
102
103 SkBitmap m_bitmap; 97 SkBitmap m_bitmap;
104 }; 98 };
105 99
106 TEST(DragImageTest, NullHandling) 100 TEST(DragImageTest, NullHandling)
107 { 101 {
108 EXPECT_FALSE(DragImage::create(0)); 102 EXPECT_FALSE(DragImage::create(0));
109 103
110 RefPtr<TestImage> nullTestImage(TestImage::create(IntSize())); 104 RefPtr<TestImage> nullTestImage(TestImage::create(IntSize()));
111 EXPECT_FALSE(DragImage::create(nullTestImage.get())); 105 EXPECT_FALSE(DragImage::create(nullTestImage.get()));
112 } 106 }
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 const SkBitmap& dragBitmap = dragImage->bitmap(); 233 const SkBitmap& dragBitmap = dragImage->bitmap();
240 { 234 {
241 SkAutoLockPixels lock1(dragBitmap); 235 SkAutoLockPixels lock1(dragBitmap);
242 SkAutoLockPixels lock2(expectedBitmap); 236 SkAutoLockPixels lock2(expectedBitmap);
243 for (int x = 0; x < dragBitmap.width(); ++x) 237 for (int x = 0; x < dragBitmap.width(); ++x)
244 for (int y = 0; y < dragBitmap.height(); ++y) 238 for (int y = 0; y < dragBitmap.height(); ++y)
245 EXPECT_EQ(expectedBitmap.getColor(x, y), dragBitmap.getColor(x, y)); 239 EXPECT_EQ(expectedBitmap.getColor(x, y), dragBitmap.getColor(x, y));
246 } 240 }
247 } 241 }
248 242
249 } // anonymous namespace 243 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698