summaryrefslogtreecommitdiffstats
path: root/webkit/tools/test_shell/image_decoder_unittest.h
diff options
context:
space:
mode:
authorkkanetkar@chromium.org <kkanetkar@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-17 19:46:11 +0000
committerkkanetkar@chromium.org <kkanetkar@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-17 19:46:11 +0000
commit3cb4fcb29392b9c45fc367cf52981e88437e095f (patch)
tree8fc7a9792a85faf7620af67a5cdffc586b366fe6 /webkit/tools/test_shell/image_decoder_unittest.h
parent51cba28a4ecb800fc14ea8132773300ff3ffa6ee (diff)
downloadchromium_src-3cb4fcb29392b9c45fc367cf52981e88437e095f.zip
chromium_src-3cb4fcb29392b9c45fc367cf52981e88437e095f.tar.gz
chromium_src-3cb4fcb29392b9c45fc367cf52981e88437e095f.tar.bz2
Reapply r40951 with changes to remove a leak.
Leak in WebImageDecoder under third_party/WebKit/WebKit/chromium/src was fixed in WebKit bug: 35946. Also removing the supression for valgrind. BUG=37727 TEST=tools/valgrind/chrome_tests.sh -t test_shell --gtest_filter=BMPImageDecoderTest.DecodingFast:ICOImageDecoderTest.Decoding:ICOImageDecoderTest.ImageNonZeroFrameIndex Review URL: http://codereview.chromium.org/1020002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@41861 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/tools/test_shell/image_decoder_unittest.h')
-rw-r--r--webkit/tools/test_shell/image_decoder_unittest.h57
1 files changed, 16 insertions, 41 deletions
diff --git a/webkit/tools/test_shell/image_decoder_unittest.h b/webkit/tools/test_shell/image_decoder_unittest.h
index 03a7ae77..76fffee 100644
--- a/webkit/tools/test_shell/image_decoder_unittest.h
+++ b/webkit/tools/test_shell/image_decoder_unittest.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Copyright (c) 2006-2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -8,18 +8,20 @@
#include <string>
#include <vector>
-#include "Vector.h"
#if COMPILER(MSVC)
#pragma warning(disable: 4355) // 'this' used in initializer list
#endif
-#include "ImageDecoder.h"
#undef LOG
#include "base/basictypes.h"
#include "base/file_path.h"
+#include "base/scoped_ptr.h"
+
#include "testing/gtest/include/gtest/gtest.h"
+namespace WebKit { class WebImageDecoder; }
+
// If CALCULATE_MD5_SUMS is not defined, then this test decodes a handful of
// image files and compares their MD5 sums to the stored sums on disk.
//
@@ -32,7 +34,7 @@
// will differ, since no endianness correction is done. If we start compiling
// for big endian machines this should be fixed.
-//#define CALCULATE_MD5_SUMS
+// #define CALCULATE_MD5_SUMS
enum ImageDecoderTestFileSelection {
TEST_ALL,
@@ -40,24 +42,9 @@ enum ImageDecoderTestFileSelection {
TEST_BIGGER,
};
-// Reads the contents of the specified file into the specified vector.
-void ReadFileToVector(const FilePath& path, Vector<char>* contents);
-
// Returns the path the decoded data is saved at.
FilePath GetMD5SumPath(const FilePath& path);
-#ifdef CALCULATE_MD5_SUMS
-// Saves the MD5 sum to the specified file.
-void SaveMD5Sum(const FilePath& path, WebCore::RGBA32Buffer* buffer);
-#else
-// Verifies the image. |path| identifies the path the image was loaded from.
-// |frame_index| indicates which index from the decoder we should examine.
-void VerifyImage(WebCore::ImageDecoder* decoder,
- const FilePath& path,
- const FilePath& md5_sum_path,
- size_t frame_index);
-#endif
-
class ImageDecoderTest : public testing::Test {
public:
explicit ImageDecoderTest(const std::string& format) : format_(format) { }
@@ -71,37 +58,25 @@ class ImageDecoderTest : public testing::Test {
// Returns true if the image is bogus and should not be successfully decoded.
bool ShouldImageFail(const FilePath& path) const;
- // Creates and returns an ImageDecoder for the file at the given |path|. If
- // |split_at_random| is true, also verifies that breaking the data supplied to
- // the decoder into two random pieces does not cause problems.
- WebCore::ImageDecoder* SetupDecoder(const FilePath& path,
- bool split_at_random) const;
+ // Tests if decoder decodes image at image_path with underlying frame at
+ // index desired_frame_index. The md5_sum_path is needed if the test is not
+ // asked to generate one i.e. if # #define CALCULATE_MD5_SUMS is set.
+ void TestWebKitImageDecoder(const FilePath& image_path,
+ const FilePath& md5_sum_path, int desired_frame_index) const;
// Verifies each of the test image files is decoded correctly and matches the
// expected state. |file_selection| and |threshold| can be used to select
// files to test based on file size.
+ // If just the MD5 sum is wanted, this skips chunking.
void TestDecoding(ImageDecoderTestFileSelection file_selection,
- const int64 threshold) const;
+ const int64 threshold);
- void TestDecoding() const {
+ void TestDecoding() {
TestDecoding(TEST_ALL, 0);
}
-#ifndef CALCULATE_MD5_SUMS
- // Verifies that decoding still works correctly when the files are split into
- // pieces at a random point. |file_selection| and |threshold| can be used to
- // select files to test based on file size.
- void TestChunkedDecoding(ImageDecoderTestFileSelection file_selection,
- const int64 threshold) const;
-
- void TestChunkedDecoding() const {
- TestChunkedDecoding(TEST_ALL, 0);
- }
-
-#endif
-
- // Returns the correct type of image decoder for this test.
- virtual WebCore::ImageDecoder* CreateDecoder() const = 0;
+ // Creates WebKit API's decoder.
+ virtual WebKit::WebImageDecoder* CreateWebKitImageDecoder() const = 0;
// The format to be decoded, like "bmp" or "ico".
std::string format_;