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

Side by Side Diff: Source/platform/image-decoders/bmp/BMPImageDecoderTest.cpp

Issue 1184673003: Fix unit test style in Source/platform/, part 2. (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 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "config.h" 5 #include "config.h"
6
7 #include "platform/image-decoders/bmp/BMPImageDecoder.h" 6 #include "platform/image-decoders/bmp/BMPImageDecoder.h"
8 7
9 #include "platform/SharedBuffer.h" 8 #include "platform/SharedBuffer.h"
10 #include "public/platform/WebUnitTestSupport.h" 9 #include "public/platform/WebUnitTestSupport.h"
11
12 #include <gtest/gtest.h> 10 #include <gtest/gtest.h>
13 11
14 using namespace blink; 12 namespace blink {
15 13
16 namespace { 14 namespace {
17 15
18 PassRefPtr<SharedBuffer> readFile(const char* fileName) 16 PassRefPtr<SharedBuffer> readFile(const char* fileName)
19 { 17 {
20 String filePath = Platform::current()->unitTestSupport()->webKitRootDir(); 18 String filePath = Platform::current()->unitTestSupport()->webKitRootDir();
21 filePath.append(fileName); 19 filePath.append(fileName);
22 20
23 return Platform::current()->unitTestSupport()->readFromFile(filePath); 21 return Platform::current()->unitTestSupport()->readFromFile(filePath);
24 } 22 }
25 23
26 PassOwnPtr<BMPImageDecoder> createDecoder() 24 PassOwnPtr<BMPImageDecoder> createDecoder()
27 { 25 {
28 return adoptPtr(new BMPImageDecoder(ImageSource::AlphaNotPremultiplied, Imag eSource::GammaAndColorProfileApplied, ImageDecoder::noDecodedImageByteLimit)); 26 return adoptPtr(new BMPImageDecoder(ImageSource::AlphaNotPremultiplied, Imag eSource::GammaAndColorProfileApplied, ImageDecoder::noDecodedImageByteLimit));
29 } 27 }
30 28
31 } // namespace 29 } // anonymous namespace
32 30
33 TEST(BMPImageDecoderTest, isSizeAvailable) 31 TEST(BMPImageDecoderTest, isSizeAvailable)
34 { 32 {
35 const char* bmpFile = "/LayoutTests/fast/images/resources/lenna.bmp"; // 256 x256 33 const char* bmpFile = "/LayoutTests/fast/images/resources/lenna.bmp"; // 256 x256
36 RefPtr<SharedBuffer> data = readFile(bmpFile); 34 RefPtr<SharedBuffer> data = readFile(bmpFile);
37 ASSERT_TRUE(data.get()); 35 ASSERT_TRUE(data.get());
38 36
39 OwnPtr<BMPImageDecoder> decoder = createDecoder(); 37 OwnPtr<BMPImageDecoder> decoder = createDecoder();
40 decoder->setData(data.get(), true); 38 decoder->setData(data.get(), true);
41 EXPECT_TRUE(decoder->isSizeAvailable()); 39 EXPECT_TRUE(decoder->isSizeAvailable());
(...skipping 26 matching lines...) Expand all
68 ASSERT_TRUE(data.get()); 66 ASSERT_TRUE(data.get());
69 67
70 OwnPtr<BMPImageDecoder> decoder = createDecoder(); 68 OwnPtr<BMPImageDecoder> decoder = createDecoder();
71 decoder->setData(data.get(), true); 69 decoder->setData(data.get(), true);
72 70
73 ImageFrame* frame = decoder->frameBufferAtIndex(0); 71 ImageFrame* frame = decoder->frameBufferAtIndex(0);
74 ASSERT_TRUE(frame); 72 ASSERT_TRUE(frame);
75 EXPECT_EQ(ImageFrame::FrameEmpty, frame->status()); 73 EXPECT_EQ(ImageFrame::FrameEmpty, frame->status());
76 EXPECT_TRUE(decoder->failed()); 74 EXPECT_TRUE(decoder->failed());
77 } 75 }
76
77 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698